From 3ab9a63cb638a1fd99475668e2da9c237495aeda Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 13 May 2022 11:40:01 -0400 Subject: 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 --- src/backend/nodes/readfuncs.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/backend/nodes/readfuncs.c') diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index ddf76ac778f..6a05b694152 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -1484,13 +1484,13 @@ _readJsonConstructorExpr(void) { READ_LOCALS(JsonConstructorExpr); + READ_ENUM_FIELD(type, JsonConstructorType); READ_NODE_FIELD(args); READ_NODE_FIELD(func); READ_NODE_FIELD(coercion); - READ_INT_FIELD(type); READ_NODE_FIELD(returning); - READ_BOOL_FIELD(unique); READ_BOOL_FIELD(absent_on_null); + READ_BOOL_FIELD(unique); READ_LOCATION_FIELD(location); READ_DONE(); @@ -1523,11 +1523,11 @@ _readJsonExpr(void) READ_NODE_FIELD(result_coercion); READ_NODE_FIELD(format); READ_NODE_FIELD(path_spec); - READ_NODE_FIELD(passing_values); READ_NODE_FIELD(passing_names); + READ_NODE_FIELD(passing_values); READ_NODE_FIELD(returning); - READ_NODE_FIELD(on_error); READ_NODE_FIELD(on_empty); + READ_NODE_FIELD(on_error); READ_NODE_FIELD(coercions); READ_ENUM_FIELD(wrapper, JsonWrapper); READ_BOOL_FIELD(omit_quotes); @@ -1547,6 +1547,7 @@ _readJsonTableParent(void) READ_BOOL_FIELD(outerJoin); READ_INT_FIELD(colMin); READ_INT_FIELD(colMax); + READ_BOOL_FIELD(errorOnError); READ_DONE(); } @@ -1610,7 +1611,8 @@ _readJsonIsPredicate() READ_LOCALS(JsonIsPredicate); READ_NODE_FIELD(expr); - READ_ENUM_FIELD(value_type, JsonValueType); + READ_NODE_FIELD(format); + READ_ENUM_FIELD(item_type, JsonValueType); READ_BOOL_FIELD(unique_keys); READ_LOCATION_FIELD(location); @@ -3229,9 +3231,9 @@ parseNodeString(void) return_value = _readJsonCoercion(); else if (MATCH("JSONITEMCOERCIONS", 17)) return_value = _readJsonItemCoercions(); - else if (MATCH("JSONTABPNODE", 12)) + else if (MATCH("JSONTABLEPARENT", 15)) return_value = _readJsonTableParent(); - else if (MATCH("JSONTABSNODE", 12)) + else if (MATCH("JSONTABLESIBLING", 16)) return_value = _readJsonTableSibling(); else { -- cgit v1.2.3