aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/queryjumble.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-05-13 11:40:01 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-05-13 11:40:08 -0400
commit3ab9a63cb638a1fd99475668e2da9c237495aeda (patch)
treefac93993a8a296e02fd12a4b222887f0d6b7d38e /src/backend/utils/misc/queryjumble.c
parent2454cb07eed1ec7e68b9953b03d473d3c334ba05 (diff)
downloadpostgresql-3ab9a63cb638a1fd99475668e2da9c237495aeda.tar.gz
postgresql-3ab9a63cb638a1fd99475668e2da9c237495aeda.zip
Rename JsonIsPredicate.value_type, fix JSON backend/nodes/ infrastructure.
I started out with the intention to rename value_type to item_type to avoid a collision with a typedef name that appears on some platforms. Along the way, I noticed that the adjacent field "format" was not being correctly handled by the backend/nodes/ infrastructure functions: copyfuncs.c erroneously treated it as a scalar, while equalfuncs, outfuncs, and readfuncs omitted handling it at all. This looks like it might be cosmetic at the moment because the field is always NULL after parse analysis; but that's likely a bug in itself, and the code's certainly not very future-proof. Let's fix it while we can still do so without forcing an initdb on beta testers. Further study found a few other inconsistencies in the backend/nodes/ infrastructure for the recently-added JSON node types, so fix those too. catversion bumped because of potential change in stored rules. Discussion: https://postgr.es/m/526703.1652385613@sss.pgh.pa.us
Diffstat (limited to 'src/backend/utils/misc/queryjumble.c')
-rw-r--r--src/backend/utils/misc/queryjumble.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/utils/misc/queryjumble.c b/src/backend/utils/misc/queryjumble.c
index d35027275f1..eeaa0b31fe2 100644
--- a/src/backend/utils/misc/queryjumble.c
+++ b/src/backend/utils/misc/queryjumble.c
@@ -741,7 +741,7 @@ JumbleExpr(JumbleState *jstate, Node *node)
{
JsonFormat *format = (JsonFormat *) node;
- APP_JUMB(format->type);
+ APP_JUMB(format->format_type);
APP_JUMB(format->encoding);
}
break;
@@ -767,12 +767,13 @@ JumbleExpr(JumbleState *jstate, Node *node)
{
JsonConstructorExpr *ctor = (JsonConstructorExpr *) node;
+ APP_JUMB(ctor->type);
+ JumbleExpr(jstate, (Node *) ctor->args);
JumbleExpr(jstate, (Node *) ctor->func);
JumbleExpr(jstate, (Node *) ctor->coercion);
JumbleExpr(jstate, (Node *) ctor->returning);
- APP_JUMB(ctor->type);
- APP_JUMB(ctor->unique);
APP_JUMB(ctor->absent_on_null);
+ APP_JUMB(ctor->unique);
}
break;
case T_JsonIsPredicate:
@@ -781,8 +782,8 @@ JumbleExpr(JumbleState *jstate, Node *node)
JumbleExpr(jstate, (Node *) pred->expr);
JumbleExpr(jstate, (Node *) pred->format);
+ APP_JUMB(pred->item_type);
APP_JUMB(pred->unique_keys);
- APP_JUMB(pred->value_type);
}
break;
case T_JsonExpr: