1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

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
This commit is contained in:
Tom Lane
2022-05-13 11:40:01 -04:00
parent 2454cb07ee
commit 3ab9a63cb6
12 changed files with 52 additions and 42 deletions

View File

@@ -186,6 +186,7 @@ _equalJsonTableParent(const JsonTableParent *a, const JsonTableParent *b)
COMPARE_SCALAR_FIELD(outerJoin);
COMPARE_SCALAR_FIELD(colMin);
COMPARE_SCALAR_FIELD(colMax);
COMPARE_SCALAR_FIELD(errorOnError);
return true;
}
@@ -1104,7 +1105,8 @@ _equalJsonIsPredicate(const JsonIsPredicate *a,
const JsonIsPredicate *b)
{
COMPARE_NODE_FIELD(expr);
COMPARE_SCALAR_FIELD(value_type);
COMPARE_NODE_FIELD(format);
COMPARE_SCALAR_FIELD(item_type);
COMPARE_SCALAR_FIELD(unique_keys);
COMPARE_LOCATION_FIELD(location);
@@ -1134,11 +1136,11 @@ _equalJsonExpr(const JsonExpr *a, const JsonExpr *b)
COMPARE_NODE_FIELD(result_coercion);
COMPARE_NODE_FIELD(format);
COMPARE_NODE_FIELD(path_spec);
COMPARE_NODE_FIELD(passing_values);
COMPARE_NODE_FIELD(passing_names);
COMPARE_NODE_FIELD(passing_values);
COMPARE_NODE_FIELD(returning);
COMPARE_NODE_FIELD(on_error);
COMPARE_NODE_FIELD(on_empty);
COMPARE_NODE_FIELD(on_error);
COMPARE_NODE_FIELD(coercions);
COMPARE_SCALAR_FIELD(wrapper);
COMPARE_SCALAR_FIELD(omit_quotes);