aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.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/nodes/outfuncs.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/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 0271ea9d786..ce129155925 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -1801,13 +1801,13 @@ _outJsonConstructorExpr(StringInfo str, const JsonConstructorExpr *node)
{
WRITE_NODE_TYPE("JSONCONSTRUCTOREXPR");
+ WRITE_ENUM_FIELD(type, JsonConstructorType);
WRITE_NODE_FIELD(args);
WRITE_NODE_FIELD(func);
WRITE_NODE_FIELD(coercion);
- WRITE_ENUM_FIELD(type, JsonConstructorType);
WRITE_NODE_FIELD(returning);
- WRITE_BOOL_FIELD(unique);
WRITE_BOOL_FIELD(absent_on_null);
+ WRITE_BOOL_FIELD(unique);
WRITE_LOCATION_FIELD(location);
}
@@ -1817,7 +1817,8 @@ _outJsonIsPredicate(StringInfo str, const JsonIsPredicate *node)
WRITE_NODE_TYPE("JSONISPREDICATE");
WRITE_NODE_FIELD(expr);
- WRITE_ENUM_FIELD(value_type, JsonValueType);
+ WRITE_NODE_FIELD(format);
+ WRITE_ENUM_FIELD(item_type, JsonValueType);
WRITE_BOOL_FIELD(unique_keys);
WRITE_LOCATION_FIELD(location);
}
@@ -1841,11 +1842,11 @@ _outJsonExpr(StringInfo str, const JsonExpr *node)
WRITE_NODE_FIELD(result_coercion);
WRITE_NODE_FIELD(format);
WRITE_NODE_FIELD(path_spec);
- WRITE_NODE_FIELD(passing_values);
WRITE_NODE_FIELD(passing_names);
+ WRITE_NODE_FIELD(passing_values);
WRITE_NODE_FIELD(returning);
- WRITE_NODE_FIELD(on_error);
WRITE_NODE_FIELD(on_empty);
+ WRITE_NODE_FIELD(on_error);
WRITE_NODE_FIELD(coercions);
WRITE_ENUM_FIELD(wrapper, JsonWrapper);
WRITE_BOOL_FIELD(omit_quotes);
@@ -1883,7 +1884,7 @@ _outJsonItemCoercions(StringInfo str, const JsonItemCoercions *node)
static void
_outJsonTableParent(StringInfo str, const JsonTableParent *node)
{
- WRITE_NODE_TYPE("JSONTABPNODE");
+ WRITE_NODE_TYPE("JSONTABLEPARENT");
WRITE_NODE_FIELD(path);
WRITE_STRING_FIELD(name);
@@ -1891,12 +1892,13 @@ _outJsonTableParent(StringInfo str, const JsonTableParent *node)
WRITE_BOOL_FIELD(outerJoin);
WRITE_INT_FIELD(colMin);
WRITE_INT_FIELD(colMax);
+ WRITE_BOOL_FIELD(errorOnError);
}
static void
_outJsonTableSibling(StringInfo str, const JsonTableSibling *node)
{
- WRITE_NODE_TYPE("JSONTABSNODE");
+ WRITE_NODE_TYPE("JSONTABLESIBLING");
WRITE_NODE_FIELD(larg);
WRITE_NODE_FIELD(rarg);