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/copyfuncs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/backend/nodes/copyfuncs.c') diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 205506305b0..51d630fa892 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -2557,11 +2557,11 @@ _copyJsonExpr(const JsonExpr *from) COPY_NODE_FIELD(result_coercion); COPY_NODE_FIELD(format); COPY_NODE_FIELD(path_spec); - COPY_NODE_FIELD(passing_values); COPY_NODE_FIELD(passing_names); + COPY_NODE_FIELD(passing_values); COPY_NODE_FIELD(returning); - COPY_NODE_FIELD(on_error); COPY_NODE_FIELD(on_empty); + COPY_NODE_FIELD(on_error); COPY_NODE_FIELD(coercions); COPY_SCALAR_FIELD(wrapper); COPY_SCALAR_FIELD(omit_quotes); @@ -2637,8 +2637,8 @@ _copyJsonIsPredicate(const JsonIsPredicate *from) JsonIsPredicate *newnode = makeNode(JsonIsPredicate); COPY_NODE_FIELD(expr); - COPY_SCALAR_FIELD(format); - COPY_SCALAR_FIELD(value_type); + COPY_NODE_FIELD(format); + COPY_SCALAR_FIELD(item_type); COPY_SCALAR_FIELD(unique_keys); COPY_LOCATION_FIELD(location); @@ -2764,6 +2764,7 @@ _copyJsonTableParent(const JsonTableParent *from) COPY_SCALAR_FIELD(outerJoin); COPY_SCALAR_FIELD(colMin); COPY_SCALAR_FIELD(colMax); + COPY_SCALAR_FIELD(errorOnError); return newnode; } -- cgit v1.2.3