mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user