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/parser/parse_expr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/parser/parse_expr.c') diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 17709c3416b..0dc2fc472e5 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -4018,8 +4018,7 @@ transformJsonParseArg(ParseState *pstate, Node *jsexpr, JsonFormat *format, } /* - * Transform IS JSON predicate into - * json[b]_is_valid(json, value_type [, check_key_uniqueness]) call. + * Transform IS JSON predicate. */ static Node * transformJsonIsPredicate(ParseState *pstate, JsonIsPredicate *pred) @@ -4035,7 +4034,8 @@ transformJsonIsPredicate(ParseState *pstate, JsonIsPredicate *pred) errmsg("cannot use type %s in IS JSON predicate", format_type_be(exprtype)))); - return makeJsonIsPredicate(expr, NULL, pred->value_type, + /* This intentionally(?) drops the format clause. */ + return makeJsonIsPredicate(expr, NULL, pred->item_type, pred->unique_keys, pred->location); } -- cgit v1.2.3