mirror of
https://github.com/postgres/postgres.git
synced 2025-11-29 23:43:17 +03:00
Revert SQL/JSON features
The reverts the following and makes some associated cleanups:
commit f79b803dc: Common SQL/JSON clauses
commit f4fb45d15: SQL/JSON constructors
commit 5f0adec25: Make STRING an unreserved_keyword.
commit 33a377608: IS JSON predicate
commit 1a36bc9db: SQL/JSON query functions
commit 606948b05: SQL JSON functions
commit 49082c2cc: RETURNING clause for JSON() and JSON_SCALAR()
commit 4e34747c8: JSON_TABLE
commit fadb48b00: PLAN clauses for JSON_TABLE
commit 2ef6f11b0: Reduce running time of jsonb_sqljson test
commit 14d3f24fa: Further improve jsonb_sqljson parallel test
commit a6baa4bad: Documentation for SQL/JSON features
commit b46bcf7a4: Improve readability of SQL/JSON documentation.
commit 112fdb352: Fix finalization for json_objectagg and friends
commit fcdb35c32: Fix transformJsonBehavior
commit 4cd8717af: Improve a couple of sql/json error messages
commit f7a605f63: Small cleanups in SQL/JSON code
commit 9c3d25e17: Fix JSON_OBJECTAGG uniquefying bug
commit a79153b7a: Claim SQL standard compliance for SQL/JSON features
commit a1e7616d6: Rework SQL/JSON documentation
commit 8d9f9634e: Fix errors in copyfuncs/equalfuncs support for JSON node types.
commit 3c633f32b: Only allow returning string types or bytea from json_serialize
commit 67b26703b: expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size.
The release notes are also adjusted.
Backpatch to release 15.
Discussion: https://postgr.es/m/40d2c882-bcac-19a9-754d-4299e1d87ac7@postgresql.org
This commit is contained in:
@@ -1398,7 +1398,6 @@ _copyTableFunc(const TableFunc *from)
|
||||
{
|
||||
TableFunc *newnode = makeNode(TableFunc);
|
||||
|
||||
COPY_SCALAR_FIELD(functype);
|
||||
COPY_NODE_FIELD(ns_uris);
|
||||
COPY_NODE_FIELD(ns_names);
|
||||
COPY_NODE_FIELD(docexpr);
|
||||
@@ -1409,9 +1408,7 @@ _copyTableFunc(const TableFunc *from)
|
||||
COPY_NODE_FIELD(colcollations);
|
||||
COPY_NODE_FIELD(colexprs);
|
||||
COPY_NODE_FIELD(coldefexprs);
|
||||
COPY_NODE_FIELD(colvalexprs);
|
||||
COPY_BITMAPSET_FIELD(notnulls);
|
||||
COPY_NODE_FIELD(plan);
|
||||
COPY_SCALAR_FIELD(ordinalitycol);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
@@ -2306,485 +2303,6 @@ _copyOnConflictExpr(const OnConflictExpr *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* _copyJsonFormat
|
||||
*/
|
||||
static JsonFormat *
|
||||
_copyJsonFormat(const JsonFormat *from)
|
||||
{
|
||||
JsonFormat *newnode = makeNode(JsonFormat);
|
||||
|
||||
COPY_SCALAR_FIELD(format_type);
|
||||
COPY_SCALAR_FIELD(encoding);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonReturning
|
||||
*/
|
||||
static JsonReturning *
|
||||
_copyJsonReturning(const JsonReturning *from)
|
||||
{
|
||||
JsonReturning *newnode = makeNode(JsonReturning);
|
||||
|
||||
COPY_NODE_FIELD(format);
|
||||
COPY_SCALAR_FIELD(typid);
|
||||
COPY_SCALAR_FIELD(typmod);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonValueExpr
|
||||
*/
|
||||
static JsonValueExpr *
|
||||
_copyJsonValueExpr(const JsonValueExpr *from)
|
||||
{
|
||||
JsonValueExpr *newnode = makeNode(JsonValueExpr);
|
||||
|
||||
COPY_NODE_FIELD(raw_expr);
|
||||
COPY_NODE_FIELD(formatted_expr);
|
||||
COPY_NODE_FIELD(format);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonParseExpr
|
||||
*/
|
||||
static JsonParseExpr *
|
||||
_copyJsonParseExpr(const JsonParseExpr *from)
|
||||
{
|
||||
JsonParseExpr *newnode = makeNode(JsonParseExpr);
|
||||
|
||||
COPY_NODE_FIELD(expr);
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_SCALAR_FIELD(unique_keys);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonScalarExpr
|
||||
*/
|
||||
static JsonScalarExpr *
|
||||
_copyJsonScalarExpr(const JsonScalarExpr *from)
|
||||
{
|
||||
JsonScalarExpr *newnode = makeNode(JsonScalarExpr);
|
||||
|
||||
COPY_NODE_FIELD(expr);
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonSerializeExpr
|
||||
*/
|
||||
static JsonSerializeExpr *
|
||||
_copyJsonSerializeExpr(const JsonSerializeExpr *from)
|
||||
{
|
||||
JsonSerializeExpr *newnode = makeNode(JsonSerializeExpr);
|
||||
|
||||
COPY_NODE_FIELD(expr);
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonConstructorExpr
|
||||
*/
|
||||
static JsonConstructorExpr *
|
||||
_copyJsonConstructorExpr(const JsonConstructorExpr *from)
|
||||
{
|
||||
JsonConstructorExpr *newnode = makeNode(JsonConstructorExpr);
|
||||
|
||||
COPY_SCALAR_FIELD(type);
|
||||
COPY_NODE_FIELD(args);
|
||||
COPY_NODE_FIELD(func);
|
||||
COPY_NODE_FIELD(coercion);
|
||||
COPY_NODE_FIELD(returning);
|
||||
COPY_SCALAR_FIELD(absent_on_null);
|
||||
COPY_SCALAR_FIELD(unique);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonKeyValue
|
||||
*/
|
||||
static JsonKeyValue *
|
||||
_copyJsonKeyValue(const JsonKeyValue *from)
|
||||
{
|
||||
JsonKeyValue *newnode = makeNode(JsonKeyValue);
|
||||
|
||||
COPY_NODE_FIELD(key);
|
||||
COPY_NODE_FIELD(value);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonObjectConstructor
|
||||
*/
|
||||
static JsonObjectConstructor *
|
||||
_copyJsonObjectConstructor(const JsonObjectConstructor *from)
|
||||
{
|
||||
JsonObjectConstructor *newnode = makeNode(JsonObjectConstructor);
|
||||
|
||||
COPY_NODE_FIELD(exprs);
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_SCALAR_FIELD(absent_on_null);
|
||||
COPY_SCALAR_FIELD(unique);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonAggConstructor
|
||||
*/
|
||||
static JsonAggConstructor *
|
||||
_copyJsonAggConstructor(const JsonAggConstructor *from)
|
||||
{
|
||||
JsonAggConstructor *newnode = makeNode(JsonAggConstructor);
|
||||
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_NODE_FIELD(agg_filter);
|
||||
COPY_NODE_FIELD(agg_order);
|
||||
COPY_NODE_FIELD(over);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonObjectAgg
|
||||
*/
|
||||
static JsonObjectAgg *
|
||||
_copyJsonObjectAgg(const JsonObjectAgg *from)
|
||||
{
|
||||
JsonObjectAgg *newnode = makeNode(JsonObjectAgg);
|
||||
|
||||
COPY_NODE_FIELD(constructor);
|
||||
COPY_NODE_FIELD(arg);
|
||||
COPY_SCALAR_FIELD(absent_on_null);
|
||||
COPY_SCALAR_FIELD(unique);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonOutput
|
||||
*/
|
||||
static JsonOutput *
|
||||
_copyJsonOutput(const JsonOutput *from)
|
||||
{
|
||||
JsonOutput *newnode = makeNode(JsonOutput);
|
||||
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_NODE_FIELD(returning);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonArrayConstructor
|
||||
*/
|
||||
static JsonArrayConstructor *
|
||||
_copyJsonArrayConstructor(const JsonArrayConstructor *from)
|
||||
{
|
||||
JsonArrayConstructor *newnode = makeNode(JsonArrayConstructor);
|
||||
|
||||
COPY_NODE_FIELD(exprs);
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_SCALAR_FIELD(absent_on_null);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonArrayAgg
|
||||
*/
|
||||
static JsonArrayAgg *
|
||||
_copyJsonArrayAgg(const JsonArrayAgg *from)
|
||||
{
|
||||
JsonArrayAgg *newnode = makeNode(JsonArrayAgg);
|
||||
|
||||
COPY_NODE_FIELD(constructor);
|
||||
COPY_NODE_FIELD(arg);
|
||||
COPY_SCALAR_FIELD(absent_on_null);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonArrayQueryConstructor
|
||||
*/
|
||||
static JsonArrayQueryConstructor *
|
||||
_copyJsonArrayQueryConstructor(const JsonArrayQueryConstructor *from)
|
||||
{
|
||||
JsonArrayQueryConstructor *newnode = makeNode(JsonArrayQueryConstructor);
|
||||
|
||||
COPY_NODE_FIELD(query);
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_NODE_FIELD(format);
|
||||
COPY_SCALAR_FIELD(absent_on_null);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonExpr
|
||||
*/
|
||||
static JsonExpr *
|
||||
_copyJsonExpr(const JsonExpr *from)
|
||||
{
|
||||
JsonExpr *newnode = makeNode(JsonExpr);
|
||||
|
||||
COPY_SCALAR_FIELD(op);
|
||||
COPY_NODE_FIELD(formatted_expr);
|
||||
COPY_NODE_FIELD(result_coercion);
|
||||
COPY_NODE_FIELD(format);
|
||||
COPY_NODE_FIELD(path_spec);
|
||||
COPY_NODE_FIELD(passing_names);
|
||||
COPY_NODE_FIELD(passing_values);
|
||||
COPY_NODE_FIELD(returning);
|
||||
COPY_NODE_FIELD(on_empty);
|
||||
COPY_NODE_FIELD(on_error);
|
||||
COPY_NODE_FIELD(coercions);
|
||||
COPY_SCALAR_FIELD(wrapper);
|
||||
COPY_SCALAR_FIELD(omit_quotes);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonCoercion
|
||||
*/
|
||||
static JsonCoercion *
|
||||
_copyJsonCoercion(const JsonCoercion *from)
|
||||
{
|
||||
JsonCoercion *newnode = makeNode(JsonCoercion);
|
||||
|
||||
COPY_NODE_FIELD(expr);
|
||||
COPY_SCALAR_FIELD(via_populate);
|
||||
COPY_SCALAR_FIELD(via_io);
|
||||
COPY_SCALAR_FIELD(collation);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonItemCoercions
|
||||
*/
|
||||
static JsonItemCoercions *
|
||||
_copyJsonItemCoercions(const JsonItemCoercions *from)
|
||||
{
|
||||
JsonItemCoercions *newnode = makeNode(JsonItemCoercions);
|
||||
|
||||
COPY_NODE_FIELD(null);
|
||||
COPY_NODE_FIELD(string);
|
||||
COPY_NODE_FIELD(numeric);
|
||||
COPY_NODE_FIELD(boolean);
|
||||
COPY_NODE_FIELD(date);
|
||||
COPY_NODE_FIELD(time);
|
||||
COPY_NODE_FIELD(timetz);
|
||||
COPY_NODE_FIELD(timestamp);
|
||||
COPY_NODE_FIELD(timestamptz);
|
||||
COPY_NODE_FIELD(composite);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonFuncExpr
|
||||
*/
|
||||
static JsonFuncExpr *
|
||||
_copyJsonFuncExpr(const JsonFuncExpr *from)
|
||||
{
|
||||
JsonFuncExpr *newnode = makeNode(JsonFuncExpr);
|
||||
|
||||
COPY_SCALAR_FIELD(op);
|
||||
COPY_NODE_FIELD(common);
|
||||
COPY_NODE_FIELD(output);
|
||||
COPY_NODE_FIELD(on_empty);
|
||||
COPY_NODE_FIELD(on_error);
|
||||
COPY_SCALAR_FIELD(wrapper);
|
||||
COPY_SCALAR_FIELD(omit_quotes);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonIsPredicate
|
||||
*/
|
||||
static JsonIsPredicate *
|
||||
_copyJsonIsPredicate(const JsonIsPredicate *from)
|
||||
{
|
||||
JsonIsPredicate *newnode = makeNode(JsonIsPredicate);
|
||||
|
||||
COPY_NODE_FIELD(expr);
|
||||
COPY_NODE_FIELD(format);
|
||||
COPY_SCALAR_FIELD(item_type);
|
||||
COPY_SCALAR_FIELD(unique_keys);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonBehavior
|
||||
*/
|
||||
static JsonBehavior *
|
||||
_copyJsonBehavior(const JsonBehavior *from)
|
||||
{
|
||||
JsonBehavior *newnode = makeNode(JsonBehavior);
|
||||
|
||||
COPY_SCALAR_FIELD(btype);
|
||||
COPY_NODE_FIELD(default_expr);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonCommon
|
||||
*/
|
||||
static JsonCommon *
|
||||
_copyJsonCommon(const JsonCommon *from)
|
||||
{
|
||||
JsonCommon *newnode = makeNode(JsonCommon);
|
||||
|
||||
COPY_NODE_FIELD(expr);
|
||||
COPY_NODE_FIELD(pathspec);
|
||||
COPY_STRING_FIELD(pathname);
|
||||
COPY_NODE_FIELD(passing);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonArgument
|
||||
*/
|
||||
static JsonArgument *
|
||||
_copyJsonArgument(const JsonArgument *from)
|
||||
{
|
||||
JsonArgument *newnode = makeNode(JsonArgument);
|
||||
|
||||
COPY_NODE_FIELD(val);
|
||||
COPY_STRING_FIELD(name);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonTable
|
||||
*/
|
||||
static JsonTable *
|
||||
_copyJsonTable(const JsonTable *from)
|
||||
{
|
||||
JsonTable *newnode = makeNode(JsonTable);
|
||||
|
||||
COPY_NODE_FIELD(common);
|
||||
COPY_NODE_FIELD(columns);
|
||||
COPY_NODE_FIELD(plan);
|
||||
COPY_NODE_FIELD(on_error);
|
||||
COPY_NODE_FIELD(alias);
|
||||
COPY_SCALAR_FIELD(lateral);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonTableColumn
|
||||
*/
|
||||
static JsonTableColumn *
|
||||
_copyJsonTableColumn(const JsonTableColumn *from)
|
||||
{
|
||||
JsonTableColumn *newnode = makeNode(JsonTableColumn);
|
||||
|
||||
COPY_SCALAR_FIELD(coltype);
|
||||
COPY_STRING_FIELD(name);
|
||||
COPY_NODE_FIELD(typeName);
|
||||
COPY_STRING_FIELD(pathspec);
|
||||
COPY_STRING_FIELD(pathname);
|
||||
COPY_NODE_FIELD(format);
|
||||
COPY_SCALAR_FIELD(wrapper);
|
||||
COPY_SCALAR_FIELD(omit_quotes);
|
||||
COPY_NODE_FIELD(columns);
|
||||
COPY_NODE_FIELD(on_empty);
|
||||
COPY_NODE_FIELD(on_error);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonTablePlan
|
||||
*/
|
||||
static JsonTablePlan *
|
||||
_copyJsonTablePlan(const JsonTablePlan *from)
|
||||
{
|
||||
JsonTablePlan *newnode = makeNode(JsonTablePlan);
|
||||
|
||||
COPY_SCALAR_FIELD(plan_type);
|
||||
COPY_SCALAR_FIELD(join_type);
|
||||
COPY_NODE_FIELD(plan1);
|
||||
COPY_NODE_FIELD(plan2);
|
||||
COPY_STRING_FIELD(pathname);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonTableParent
|
||||
*/
|
||||
static JsonTableParent *
|
||||
_copyJsonTableParent(const JsonTableParent *from)
|
||||
{
|
||||
JsonTableParent *newnode = makeNode(JsonTableParent);
|
||||
|
||||
COPY_NODE_FIELD(path);
|
||||
COPY_STRING_FIELD(name);
|
||||
COPY_NODE_FIELD(child);
|
||||
COPY_SCALAR_FIELD(outerJoin);
|
||||
COPY_SCALAR_FIELD(colMin);
|
||||
COPY_SCALAR_FIELD(colMax);
|
||||
COPY_SCALAR_FIELD(errorOnError);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyJsonTableSibling
|
||||
*/
|
||||
static JsonTableSibling *
|
||||
_copyJsonTableSibling(const JsonTableSibling *from)
|
||||
{
|
||||
JsonTableSibling *newnode = makeNode(JsonTableSibling);
|
||||
|
||||
COPY_NODE_FIELD(larg);
|
||||
COPY_NODE_FIELD(rarg);
|
||||
COPY_SCALAR_FIELD(cross);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ****************************************************************
|
||||
* pathnodes.h copy functions
|
||||
*
|
||||
@@ -5885,90 +5403,6 @@ copyObjectImpl(const void *from)
|
||||
case T_OnConflictExpr:
|
||||
retval = _copyOnConflictExpr(from);
|
||||
break;
|
||||
case T_JsonFormat:
|
||||
retval = _copyJsonFormat(from);
|
||||
break;
|
||||
case T_JsonReturning:
|
||||
retval = _copyJsonReturning(from);
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
retval = _copyJsonValueExpr(from);
|
||||
break;
|
||||
case T_JsonParseExpr:
|
||||
retval = _copyJsonParseExpr(from);
|
||||
break;
|
||||
case T_JsonScalarExpr:
|
||||
retval = _copyJsonScalarExpr(from);
|
||||
break;
|
||||
case T_JsonSerializeExpr:
|
||||
retval = _copyJsonSerializeExpr(from);
|
||||
break;
|
||||
case T_JsonKeyValue:
|
||||
retval = _copyJsonKeyValue(from);
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
retval = _copyJsonConstructorExpr(from);
|
||||
break;
|
||||
case T_JsonObjectConstructor:
|
||||
retval = _copyJsonObjectConstructor(from);
|
||||
break;
|
||||
case T_JsonAggConstructor:
|
||||
retval = _copyJsonAggConstructor(from);
|
||||
break;
|
||||
case T_JsonObjectAgg:
|
||||
retval = _copyJsonObjectAgg(from);
|
||||
break;
|
||||
case T_JsonOutput:
|
||||
retval = _copyJsonOutput(from);
|
||||
break;
|
||||
case T_JsonArrayConstructor:
|
||||
retval = _copyJsonArrayConstructor(from);
|
||||
break;
|
||||
case T_JsonArrayQueryConstructor:
|
||||
retval = _copyJsonArrayQueryConstructor(from);
|
||||
break;
|
||||
case T_JsonArrayAgg:
|
||||
retval = _copyJsonArrayAgg(from);
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
retval = _copyJsonIsPredicate(from);
|
||||
break;
|
||||
case T_JsonFuncExpr:
|
||||
retval = _copyJsonFuncExpr(from);
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
retval = _copyJsonExpr(from);
|
||||
break;
|
||||
case T_JsonCommon:
|
||||
retval = _copyJsonCommon(from);
|
||||
break;
|
||||
case T_JsonBehavior:
|
||||
retval = _copyJsonBehavior(from);
|
||||
break;
|
||||
case T_JsonArgument:
|
||||
retval = _copyJsonArgument(from);
|
||||
break;
|
||||
case T_JsonCoercion:
|
||||
retval = _copyJsonCoercion(from);
|
||||
break;
|
||||
case T_JsonItemCoercions:
|
||||
retval = _copyJsonItemCoercions(from);
|
||||
break;
|
||||
case T_JsonTable:
|
||||
retval = _copyJsonTable(from);
|
||||
break;
|
||||
case T_JsonTableColumn:
|
||||
retval = _copyJsonTableColumn(from);
|
||||
break;
|
||||
case T_JsonTablePlan:
|
||||
retval = _copyJsonTablePlan(from);
|
||||
break;
|
||||
case T_JsonTableParent:
|
||||
retval = _copyJsonTableParent(from);
|
||||
break;
|
||||
case T_JsonTableSibling:
|
||||
retval = _copyJsonTableSibling(from);
|
||||
break;
|
||||
|
||||
/*
|
||||
* RELATION NODES
|
||||
|
||||
@@ -127,7 +127,6 @@ _equalRangeVar(const RangeVar *a, const RangeVar *b)
|
||||
static bool
|
||||
_equalTableFunc(const TableFunc *a, const TableFunc *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(functype);
|
||||
COMPARE_NODE_FIELD(ns_uris);
|
||||
COMPARE_NODE_FIELD(ns_names);
|
||||
COMPARE_NODE_FIELD(docexpr);
|
||||
@@ -138,85 +137,13 @@ _equalTableFunc(const TableFunc *a, const TableFunc *b)
|
||||
COMPARE_NODE_FIELD(colcollations);
|
||||
COMPARE_NODE_FIELD(colexprs);
|
||||
COMPARE_NODE_FIELD(coldefexprs);
|
||||
COMPARE_NODE_FIELD(colvalexprs);
|
||||
COMPARE_BITMAPSET_FIELD(notnulls);
|
||||
COMPARE_NODE_FIELD(plan);
|
||||
COMPARE_SCALAR_FIELD(ordinalitycol);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonTablePlan(const JsonTablePlan *a, const JsonTablePlan *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(plan_type);
|
||||
COMPARE_SCALAR_FIELD(join_type);
|
||||
COMPARE_NODE_FIELD(plan1);
|
||||
COMPARE_NODE_FIELD(plan2);
|
||||
COMPARE_STRING_FIELD(pathname);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonTable(const JsonTable *a, const JsonTable *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(common);
|
||||
COMPARE_NODE_FIELD(columns);
|
||||
COMPARE_NODE_FIELD(plan);
|
||||
COMPARE_NODE_FIELD(on_error);
|
||||
COMPARE_NODE_FIELD(alias);
|
||||
COMPARE_SCALAR_FIELD(lateral);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonTableColumn(const JsonTableColumn *a, const JsonTableColumn *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(coltype);
|
||||
COMPARE_STRING_FIELD(name);
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_STRING_FIELD(pathspec);
|
||||
COMPARE_STRING_FIELD(pathname);
|
||||
COMPARE_NODE_FIELD(format);
|
||||
COMPARE_SCALAR_FIELD(wrapper);
|
||||
COMPARE_SCALAR_FIELD(omit_quotes);
|
||||
COMPARE_NODE_FIELD(columns);
|
||||
COMPARE_NODE_FIELD(on_empty);
|
||||
COMPARE_NODE_FIELD(on_error);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonTableParent(const JsonTableParent *a, const JsonTableParent *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(path);
|
||||
COMPARE_STRING_FIELD(name);
|
||||
COMPARE_NODE_FIELD(child);
|
||||
COMPARE_SCALAR_FIELD(outerJoin);
|
||||
COMPARE_SCALAR_FIELD(colMin);
|
||||
COMPARE_SCALAR_FIELD(colMax);
|
||||
COMPARE_SCALAR_FIELD(errorOnError);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonTableSibling(const JsonTableSibling *a, const JsonTableSibling *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(larg);
|
||||
COMPARE_NODE_FIELD(rarg);
|
||||
COMPARE_SCALAR_FIELD(cross);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalIntoClause(const IntoClause *a, const IntoClause *b)
|
||||
{
|
||||
@@ -914,291 +841,6 @@ _equalOnConflictExpr(const OnConflictExpr *a, const OnConflictExpr *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonFormat(const JsonFormat *a, const JsonFormat *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(format_type);
|
||||
COMPARE_SCALAR_FIELD(encoding);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonReturning(const JsonReturning *a, const JsonReturning *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(format);
|
||||
COMPARE_SCALAR_FIELD(typid);
|
||||
COMPARE_SCALAR_FIELD(typmod);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonValueExpr(const JsonValueExpr *a, const JsonValueExpr *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(raw_expr);
|
||||
COMPARE_NODE_FIELD(formatted_expr);
|
||||
COMPARE_NODE_FIELD(format);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonParseExpr(const JsonParseExpr *a, const JsonParseExpr *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(expr);
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_SCALAR_FIELD(unique_keys);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonScalarExpr(const JsonScalarExpr *a, const JsonScalarExpr *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(expr);
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonSerializeExpr(const JsonSerializeExpr *a, const JsonSerializeExpr *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(expr);
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonConstructorExpr(const JsonConstructorExpr *a, const JsonConstructorExpr *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(type);
|
||||
COMPARE_NODE_FIELD(args);
|
||||
COMPARE_NODE_FIELD(func);
|
||||
COMPARE_NODE_FIELD(coercion);
|
||||
COMPARE_NODE_FIELD(returning);
|
||||
COMPARE_SCALAR_FIELD(absent_on_null);
|
||||
COMPARE_SCALAR_FIELD(unique);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonKeyValue(const JsonKeyValue *a, const JsonKeyValue *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(key);
|
||||
COMPARE_NODE_FIELD(value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonObjectConstructor(const JsonObjectConstructor *a,
|
||||
const JsonObjectConstructor *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(exprs);
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_SCALAR_FIELD(absent_on_null);
|
||||
COMPARE_SCALAR_FIELD(unique);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonAggConstructor(const JsonAggConstructor *a,
|
||||
const JsonAggConstructor *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_NODE_FIELD(agg_filter);
|
||||
COMPARE_NODE_FIELD(agg_order);
|
||||
COMPARE_NODE_FIELD(over);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonObjectAgg(const JsonObjectAgg *a, const JsonObjectAgg *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(constructor);
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
COMPARE_SCALAR_FIELD(absent_on_null);
|
||||
COMPARE_SCALAR_FIELD(unique);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonOutput(const JsonOutput *a, const JsonOutput *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(typeName);
|
||||
COMPARE_NODE_FIELD(returning);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonArrayConstructor(const JsonArrayConstructor *a,
|
||||
const JsonArrayConstructor *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(exprs);
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_SCALAR_FIELD(absent_on_null);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonArrayAgg(const JsonArrayAgg *a, const JsonArrayAgg *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(constructor);
|
||||
COMPARE_NODE_FIELD(arg);
|
||||
COMPARE_SCALAR_FIELD(absent_on_null);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonArrayQueryConstructor(const JsonArrayQueryConstructor *a,
|
||||
const JsonArrayQueryConstructor *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(query);
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_NODE_FIELD(format);
|
||||
COMPARE_SCALAR_FIELD(absent_on_null);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonFuncExpr(const JsonFuncExpr *a, const JsonFuncExpr *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(op);
|
||||
COMPARE_NODE_FIELD(common);
|
||||
COMPARE_NODE_FIELD(output);
|
||||
COMPARE_NODE_FIELD(on_empty);
|
||||
COMPARE_NODE_FIELD(on_error);
|
||||
COMPARE_SCALAR_FIELD(wrapper);
|
||||
COMPARE_SCALAR_FIELD(omit_quotes);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonCommon(const JsonCommon *a, const JsonCommon *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(expr);
|
||||
COMPARE_NODE_FIELD(pathspec);
|
||||
COMPARE_STRING_FIELD(pathname);
|
||||
COMPARE_NODE_FIELD(passing);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonArgument(const JsonArgument *a, const JsonArgument *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(val);
|
||||
COMPARE_STRING_FIELD(name);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalJsonIsPredicate(const JsonIsPredicate *a,
|
||||
const JsonIsPredicate *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(expr);
|
||||
COMPARE_NODE_FIELD(format);
|
||||
COMPARE_SCALAR_FIELD(item_type);
|
||||
COMPARE_SCALAR_FIELD(unique_keys);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* _equalJsonBehavior
|
||||
*/
|
||||
static bool
|
||||
_equalJsonBehavior(const JsonBehavior *a, const JsonBehavior *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(btype);
|
||||
COMPARE_NODE_FIELD(default_expr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* _equalJsonExpr
|
||||
*/
|
||||
static bool
|
||||
_equalJsonExpr(const JsonExpr *a, const JsonExpr *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(op);
|
||||
COMPARE_NODE_FIELD(formatted_expr);
|
||||
COMPARE_NODE_FIELD(result_coercion);
|
||||
COMPARE_NODE_FIELD(format);
|
||||
COMPARE_NODE_FIELD(path_spec);
|
||||
COMPARE_NODE_FIELD(passing_names);
|
||||
COMPARE_NODE_FIELD(passing_values);
|
||||
COMPARE_NODE_FIELD(returning);
|
||||
COMPARE_NODE_FIELD(on_empty);
|
||||
COMPARE_NODE_FIELD(on_error);
|
||||
COMPARE_NODE_FIELD(coercions);
|
||||
COMPARE_SCALAR_FIELD(wrapper);
|
||||
COMPARE_SCALAR_FIELD(omit_quotes);
|
||||
COMPARE_LOCATION_FIELD(location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* _equalJsonCoercion
|
||||
*/
|
||||
static bool
|
||||
_equalJsonCoercion(const JsonCoercion *a, const JsonCoercion *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(expr);
|
||||
COMPARE_SCALAR_FIELD(via_populate);
|
||||
COMPARE_SCALAR_FIELD(via_io);
|
||||
COMPARE_SCALAR_FIELD(collation);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* _equalJsonItemCoercions
|
||||
*/
|
||||
static bool
|
||||
_equalJsonItemCoercions(const JsonItemCoercions *a, const JsonItemCoercions *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(null);
|
||||
COMPARE_NODE_FIELD(string);
|
||||
COMPARE_NODE_FIELD(numeric);
|
||||
COMPARE_NODE_FIELD(boolean);
|
||||
COMPARE_NODE_FIELD(date);
|
||||
COMPARE_NODE_FIELD(time);
|
||||
COMPARE_NODE_FIELD(timetz);
|
||||
COMPARE_NODE_FIELD(timestamp);
|
||||
COMPARE_NODE_FIELD(timestamptz);
|
||||
COMPARE_NODE_FIELD(composite);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stuff from pathnodes.h
|
||||
*/
|
||||
@@ -3758,48 +3400,6 @@ equal(const void *a, const void *b)
|
||||
case T_JoinExpr:
|
||||
retval = _equalJoinExpr(a, b);
|
||||
break;
|
||||
case T_JsonFormat:
|
||||
retval = _equalJsonFormat(a, b);
|
||||
break;
|
||||
case T_JsonReturning:
|
||||
retval = _equalJsonReturning(a, b);
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
retval = _equalJsonValueExpr(a, b);
|
||||
break;
|
||||
case T_JsonParseExpr:
|
||||
retval = _equalJsonParseExpr(a, b);
|
||||
break;
|
||||
case T_JsonScalarExpr:
|
||||
retval = _equalJsonScalarExpr(a, b);
|
||||
break;
|
||||
case T_JsonSerializeExpr:
|
||||
retval = _equalJsonSerializeExpr(a, b);
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
retval = _equalJsonConstructorExpr(a, b);
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
retval = _equalJsonIsPredicate(a, b);
|
||||
break;
|
||||
case T_JsonBehavior:
|
||||
retval = _equalJsonBehavior(a, b);
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
retval = _equalJsonExpr(a, b);
|
||||
break;
|
||||
case T_JsonCoercion:
|
||||
retval = _equalJsonCoercion(a, b);
|
||||
break;
|
||||
case T_JsonItemCoercions:
|
||||
retval = _equalJsonItemCoercions(a, b);
|
||||
break;
|
||||
case T_JsonTableParent:
|
||||
retval = _equalJsonTableParent(a, b);
|
||||
break;
|
||||
case T_JsonTableSibling:
|
||||
retval = _equalJsonTableSibling(a, b);
|
||||
break;
|
||||
|
||||
/*
|
||||
* RELATION NODES
|
||||
@@ -4389,48 +3989,6 @@ equal(const void *a, const void *b)
|
||||
case T_PublicationTable:
|
||||
retval = _equalPublicationTable(a, b);
|
||||
break;
|
||||
case T_JsonKeyValue:
|
||||
retval = _equalJsonKeyValue(a, b);
|
||||
break;
|
||||
case T_JsonObjectConstructor:
|
||||
retval = _equalJsonObjectConstructor(a, b);
|
||||
break;
|
||||
case T_JsonAggConstructor:
|
||||
retval = _equalJsonAggConstructor(a, b);
|
||||
break;
|
||||
case T_JsonObjectAgg:
|
||||
retval = _equalJsonObjectAgg(a, b);
|
||||
break;
|
||||
case T_JsonOutput:
|
||||
retval = _equalJsonOutput(a, b);
|
||||
break;
|
||||
case T_JsonArrayConstructor:
|
||||
retval = _equalJsonArrayConstructor(a, b);
|
||||
break;
|
||||
case T_JsonArrayQueryConstructor:
|
||||
retval = _equalJsonArrayQueryConstructor(a, b);
|
||||
break;
|
||||
case T_JsonArrayAgg:
|
||||
retval = _equalJsonArrayAgg(a, b);
|
||||
break;
|
||||
case T_JsonFuncExpr:
|
||||
retval = _equalJsonFuncExpr(a, b);
|
||||
break;
|
||||
case T_JsonCommon:
|
||||
retval = _equalJsonCommon(a, b);
|
||||
break;
|
||||
case T_JsonArgument:
|
||||
retval = _equalJsonArgument(a, b);
|
||||
break;
|
||||
case T_JsonTablePlan:
|
||||
retval = _equalJsonTablePlan(a, b);
|
||||
break;
|
||||
case T_JsonTable:
|
||||
retval = _equalJsonTable(a, b);
|
||||
break;
|
||||
case T_JsonTableColumn:
|
||||
retval = _equalJsonTableColumn(a, b);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d",
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "catalog/pg_type.h"
|
||||
#include "nodes/makefuncs.h"
|
||||
#include "nodes/nodeFuncs.h"
|
||||
#include "utils/errcodes.h"
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
|
||||
@@ -819,124 +818,3 @@ makeVacuumRelation(RangeVar *relation, Oid oid, List *va_cols)
|
||||
v->va_cols = va_cols;
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeJsonFormat -
|
||||
* creates a JsonFormat node
|
||||
*/
|
||||
JsonFormat *
|
||||
makeJsonFormat(JsonFormatType type, JsonEncoding encoding, int location)
|
||||
{
|
||||
JsonFormat *jf = makeNode(JsonFormat);
|
||||
|
||||
jf->format_type = type;
|
||||
jf->encoding = encoding;
|
||||
jf->location = location;
|
||||
|
||||
return jf;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeJsonValueExpr -
|
||||
* creates a JsonValueExpr node
|
||||
*/
|
||||
JsonValueExpr *
|
||||
makeJsonValueExpr(Expr *expr, JsonFormat *format)
|
||||
{
|
||||
JsonValueExpr *jve = makeNode(JsonValueExpr);
|
||||
|
||||
jve->raw_expr = expr;
|
||||
jve->formatted_expr = NULL;
|
||||
jve->format = format;
|
||||
|
||||
return jve;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeJsonBehavior -
|
||||
* creates a JsonBehavior node
|
||||
*/
|
||||
JsonBehavior *
|
||||
makeJsonBehavior(JsonBehaviorType type, Node *default_expr)
|
||||
{
|
||||
JsonBehavior *behavior = makeNode(JsonBehavior);
|
||||
|
||||
behavior->btype = type;
|
||||
behavior->default_expr = default_expr;
|
||||
|
||||
return behavior;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeJsonTableJoinedPlan -
|
||||
* creates a joined JsonTablePlan node
|
||||
*/
|
||||
Node *
|
||||
makeJsonTableJoinedPlan(JsonTablePlanJoinType type, Node *plan1, Node *plan2,
|
||||
int location)
|
||||
{
|
||||
JsonTablePlan *n = makeNode(JsonTablePlan);
|
||||
|
||||
n->plan_type = JSTP_JOINED;
|
||||
n->join_type = type;
|
||||
n->plan1 = castNode(JsonTablePlan, plan1);
|
||||
n->plan2 = castNode(JsonTablePlan, plan2);
|
||||
n->location = location;
|
||||
|
||||
return (Node *) n;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeJsonEncoding -
|
||||
* converts JSON encoding name to enum JsonEncoding
|
||||
*/
|
||||
JsonEncoding
|
||||
makeJsonEncoding(char *name)
|
||||
{
|
||||
if (!pg_strcasecmp(name, "utf8"))
|
||||
return JS_ENC_UTF8;
|
||||
if (!pg_strcasecmp(name, "utf16"))
|
||||
return JS_ENC_UTF16;
|
||||
if (!pg_strcasecmp(name, "utf32"))
|
||||
return JS_ENC_UTF32;
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("unrecognized JSON encoding: %s", name)));
|
||||
|
||||
return JS_ENC_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeJsonKeyValue -
|
||||
* creates a JsonKeyValue node
|
||||
*/
|
||||
Node *
|
||||
makeJsonKeyValue(Node *key, Node *value)
|
||||
{
|
||||
JsonKeyValue *n = makeNode(JsonKeyValue);
|
||||
|
||||
n->key = (Expr *) key;
|
||||
n->value = castNode(JsonValueExpr, value);
|
||||
|
||||
return (Node *) n;
|
||||
}
|
||||
|
||||
/*
|
||||
* makeJsonIsPredicate -
|
||||
* creates a JsonIsPredicate node
|
||||
*/
|
||||
Node *
|
||||
makeJsonIsPredicate(Node *expr, JsonFormat *format, JsonValueType item_type,
|
||||
bool unique_keys, int location)
|
||||
{
|
||||
JsonIsPredicate *n = makeNode(JsonIsPredicate);
|
||||
|
||||
n->expr = expr;
|
||||
n->format = format;
|
||||
n->item_type = item_type;
|
||||
n->unique_keys = unique_keys;
|
||||
n->location = location;
|
||||
|
||||
return (Node *) n;
|
||||
}
|
||||
|
||||
@@ -250,25 +250,6 @@ exprType(const Node *expr)
|
||||
case T_PlaceHolderVar:
|
||||
type = exprType((Node *) ((const PlaceHolderVar *) expr)->phexpr);
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
{
|
||||
const JsonValueExpr *jve = (const JsonValueExpr *) expr;
|
||||
|
||||
type = exprType((Node *) (jve->formatted_expr ? jve->formatted_expr : jve->raw_expr));
|
||||
}
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
type = ((const JsonConstructorExpr *) expr)->returning->typid;
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
type = BOOLOID;
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
type = ((const JsonExpr *) expr)->returning->typid;
|
||||
break;
|
||||
case T_JsonCoercion:
|
||||
type = exprType(((const JsonCoercion *) expr)->expr);
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(expr));
|
||||
type = InvalidOid; /* keep compiler quiet */
|
||||
@@ -501,14 +482,6 @@ exprTypmod(const Node *expr)
|
||||
return ((const SetToDefault *) expr)->typeMod;
|
||||
case T_PlaceHolderVar:
|
||||
return exprTypmod((Node *) ((const PlaceHolderVar *) expr)->phexpr);
|
||||
case T_JsonValueExpr:
|
||||
return exprTypmod((Node *) ((const JsonValueExpr *) expr)->formatted_expr);
|
||||
case T_JsonConstructorExpr:
|
||||
return ((const JsonConstructorExpr *) expr)->returning->typmod;
|
||||
case T_JsonExpr:
|
||||
return ((JsonExpr *) expr)->returning->typmod;
|
||||
case T_JsonCoercion:
|
||||
return exprTypmod(((const JsonCoercion *) expr)->expr);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -991,37 +964,6 @@ exprCollation(const Node *expr)
|
||||
case T_PlaceHolderVar:
|
||||
coll = exprCollation((Node *) ((const PlaceHolderVar *) expr)->phexpr);
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
coll = exprCollation((Node *) ((const JsonValueExpr *) expr)->formatted_expr);
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
{
|
||||
const JsonConstructorExpr *ctor = (const JsonConstructorExpr *) expr;
|
||||
|
||||
if (ctor->coercion)
|
||||
coll = exprCollation((Node *) ctor->coercion);
|
||||
else
|
||||
coll = InvalidOid;
|
||||
}
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
coll = InvalidOid; /* result is always an boolean type */
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
{
|
||||
JsonExpr *jexpr = (JsonExpr *) expr;
|
||||
JsonCoercion *coercion = jexpr->result_coercion;
|
||||
|
||||
if (!coercion)
|
||||
coll = InvalidOid;
|
||||
else if (coercion->expr)
|
||||
coll = exprCollation(coercion->expr);
|
||||
else if (coercion->via_io || coercion->via_populate)
|
||||
coll = coercion->collation;
|
||||
else
|
||||
coll = InvalidOid;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(expr));
|
||||
coll = InvalidOid; /* keep compiler quiet */
|
||||
@@ -1234,39 +1176,6 @@ exprSetCollation(Node *expr, Oid collation)
|
||||
/* NextValueExpr's result is an integer type ... */
|
||||
Assert(!OidIsValid(collation)); /* ... so never set a collation */
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
exprSetCollation((Node *) ((JsonValueExpr *) expr)->formatted_expr,
|
||||
collation);
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
{
|
||||
JsonConstructorExpr *ctor = (JsonConstructorExpr *) expr;
|
||||
|
||||
if (ctor->coercion)
|
||||
exprSetCollation((Node *) ctor->coercion, collation);
|
||||
else
|
||||
Assert(!OidIsValid(collation)); /* result is always a
|
||||
* json[b] type */
|
||||
}
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
Assert(!OidIsValid(collation)); /* result is always boolean */
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
{
|
||||
JsonExpr *jexpr = (JsonExpr *) expr;
|
||||
JsonCoercion *coercion = jexpr->result_coercion;
|
||||
|
||||
if (!coercion)
|
||||
Assert(!OidIsValid(collation));
|
||||
else if (coercion->expr)
|
||||
exprSetCollation(coercion->expr, collation);
|
||||
else if (coercion->via_io || coercion->via_populate)
|
||||
coercion->collation = collation;
|
||||
else
|
||||
Assert(!OidIsValid(collation));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(expr));
|
||||
break;
|
||||
@@ -1713,24 +1622,6 @@ exprLocation(const Node *expr)
|
||||
case T_PartitionRangeDatum:
|
||||
loc = ((const PartitionRangeDatum *) expr)->location;
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
loc = exprLocation((Node *) ((const JsonValueExpr *) expr)->raw_expr);
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
loc = ((const JsonConstructorExpr *) expr)->location;
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
loc = ((const JsonIsPredicate *) expr)->location;
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
{
|
||||
const JsonExpr *jsexpr = (const JsonExpr *) expr;
|
||||
|
||||
/* consider both function name and leftmost arg */
|
||||
loc = leftmostLoc(jsexpr->location,
|
||||
exprLocation(jsexpr->formatted_expr));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* for any other node type it's just unknown... */
|
||||
loc = -1;
|
||||
@@ -2473,80 +2364,6 @@ expression_tree_walker(Node *node,
|
||||
return true;
|
||||
if (walker(tf->coldefexprs, context))
|
||||
return true;
|
||||
if (walker(tf->colvalexprs, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
{
|
||||
JsonValueExpr *jve = (JsonValueExpr *) node;
|
||||
|
||||
if (walker(jve->raw_expr, context))
|
||||
return true;
|
||||
if (walker(jve->formatted_expr, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
{
|
||||
JsonConstructorExpr *ctor = (JsonConstructorExpr *) node;
|
||||
|
||||
if (walker(ctor->args, context))
|
||||
return true;
|
||||
if (walker(ctor->func, context))
|
||||
return true;
|
||||
if (walker(ctor->coercion, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
return walker(((JsonIsPredicate *) node)->expr, context);
|
||||
case T_JsonExpr:
|
||||
{
|
||||
JsonExpr *jexpr = (JsonExpr *) node;
|
||||
|
||||
if (walker(jexpr->formatted_expr, context))
|
||||
return true;
|
||||
if (walker(jexpr->result_coercion, context))
|
||||
return true;
|
||||
if (walker(jexpr->passing_values, context))
|
||||
return true;
|
||||
/* we assume walker doesn't care about passing_names */
|
||||
if (jexpr->on_empty &&
|
||||
walker(jexpr->on_empty->default_expr, context))
|
||||
return true;
|
||||
if (walker(jexpr->on_error->default_expr, context))
|
||||
return true;
|
||||
if (walker(jexpr->coercions, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonCoercion:
|
||||
return walker(((JsonCoercion *) node)->expr, context);
|
||||
case T_JsonItemCoercions:
|
||||
{
|
||||
JsonItemCoercions *coercions = (JsonItemCoercions *) node;
|
||||
|
||||
if (walker(coercions->null, context))
|
||||
return true;
|
||||
if (walker(coercions->string, context))
|
||||
return true;
|
||||
if (walker(coercions->numeric, context))
|
||||
return true;
|
||||
if (walker(coercions->boolean, context))
|
||||
return true;
|
||||
if (walker(coercions->date, context))
|
||||
return true;
|
||||
if (walker(coercions->time, context))
|
||||
return true;
|
||||
if (walker(coercions->timetz, context))
|
||||
return true;
|
||||
if (walker(coercions->timestamp, context))
|
||||
return true;
|
||||
if (walker(coercions->timestamptz, context))
|
||||
return true;
|
||||
if (walker(coercions->composite, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -2876,7 +2693,6 @@ expression_tree_mutator(Node *node,
|
||||
case T_RangeTblRef:
|
||||
case T_SortGroupClause:
|
||||
case T_CTESearchClause:
|
||||
case T_JsonFormat:
|
||||
return (Node *) copyObject(node);
|
||||
case T_WithCheckOption:
|
||||
{
|
||||
@@ -3517,102 +3333,6 @@ expression_tree_mutator(Node *node,
|
||||
MUTATE(newnode->rowexpr, tf->rowexpr, Node *);
|
||||
MUTATE(newnode->colexprs, tf->colexprs, List *);
|
||||
MUTATE(newnode->coldefexprs, tf->coldefexprs, List *);
|
||||
MUTATE(newnode->colvalexprs, tf->colvalexprs, List *);
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
case T_JsonReturning:
|
||||
{
|
||||
JsonReturning *jr = (JsonReturning *) node;
|
||||
JsonReturning *newnode;
|
||||
|
||||
FLATCOPY(newnode, jr, JsonReturning);
|
||||
MUTATE(newnode->format, jr->format, JsonFormat *);
|
||||
|
||||
return (Node *) newnode;
|
||||
}
|
||||
case T_JsonValueExpr:
|
||||
{
|
||||
JsonValueExpr *jve = (JsonValueExpr *) node;
|
||||
JsonValueExpr *newnode;
|
||||
|
||||
FLATCOPY(newnode, jve, JsonValueExpr);
|
||||
MUTATE(newnode->raw_expr, jve->raw_expr, Expr *);
|
||||
MUTATE(newnode->formatted_expr, jve->formatted_expr, Expr *);
|
||||
MUTATE(newnode->format, jve->format, JsonFormat *);
|
||||
|
||||
return (Node *) newnode;
|
||||
}
|
||||
case T_JsonConstructorExpr:
|
||||
{
|
||||
JsonConstructorExpr *jve = (JsonConstructorExpr *) node;
|
||||
JsonConstructorExpr *newnode;
|
||||
|
||||
FLATCOPY(newnode, jve, JsonConstructorExpr);
|
||||
MUTATE(newnode->args, jve->args, List *);
|
||||
MUTATE(newnode->func, jve->func, Expr *);
|
||||
MUTATE(newnode->coercion, jve->coercion, Expr *);
|
||||
MUTATE(newnode->returning, jve->returning, JsonReturning *);
|
||||
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
{
|
||||
JsonIsPredicate *pred = (JsonIsPredicate *) node;
|
||||
JsonIsPredicate *newnode;
|
||||
|
||||
FLATCOPY(newnode, pred, JsonIsPredicate);
|
||||
MUTATE(newnode->expr, pred->expr, Node *);
|
||||
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
{
|
||||
JsonExpr *jexpr = (JsonExpr *) node;
|
||||
JsonExpr *newnode;
|
||||
|
||||
FLATCOPY(newnode, jexpr, JsonExpr);
|
||||
MUTATE(newnode->path_spec, jexpr->path_spec, Node *);
|
||||
MUTATE(newnode->formatted_expr, jexpr->formatted_expr, Node *);
|
||||
MUTATE(newnode->result_coercion, jexpr->result_coercion, JsonCoercion *);
|
||||
MUTATE(newnode->passing_values, jexpr->passing_values, List *);
|
||||
/* assume mutator does not care about passing_names */
|
||||
if (newnode->on_empty)
|
||||
MUTATE(newnode->on_empty->default_expr,
|
||||
jexpr->on_empty->default_expr, Node *);
|
||||
MUTATE(newnode->on_error->default_expr,
|
||||
jexpr->on_error->default_expr, Node *);
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
case T_JsonCoercion:
|
||||
{
|
||||
JsonCoercion *coercion = (JsonCoercion *) node;
|
||||
JsonCoercion *newnode;
|
||||
|
||||
FLATCOPY(newnode, coercion, JsonCoercion);
|
||||
MUTATE(newnode->expr, coercion->expr, Node *);
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
case T_JsonItemCoercions:
|
||||
{
|
||||
JsonItemCoercions *coercions = (JsonItemCoercions *) node;
|
||||
JsonItemCoercions *newnode;
|
||||
|
||||
FLATCOPY(newnode, coercions, JsonItemCoercions);
|
||||
MUTATE(newnode->null, coercions->null, JsonCoercion *);
|
||||
MUTATE(newnode->string, coercions->string, JsonCoercion *);
|
||||
MUTATE(newnode->numeric, coercions->numeric, JsonCoercion *);
|
||||
MUTATE(newnode->boolean, coercions->boolean, JsonCoercion *);
|
||||
MUTATE(newnode->date, coercions->date, JsonCoercion *);
|
||||
MUTATE(newnode->time, coercions->time, JsonCoercion *);
|
||||
MUTATE(newnode->timetz, coercions->timetz, JsonCoercion *);
|
||||
MUTATE(newnode->timestamp, coercions->timestamp, JsonCoercion *);
|
||||
MUTATE(newnode->timestamptz, coercions->timestamptz, JsonCoercion *);
|
||||
MUTATE(newnode->composite, coercions->composite, JsonCoercion *);
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
@@ -3888,7 +3608,6 @@ raw_expression_tree_walker(Node *node,
|
||||
case T_ParamRef:
|
||||
case T_A_Const:
|
||||
case T_A_Star:
|
||||
case T_JsonFormat:
|
||||
/* primitive node types with no subnodes */
|
||||
break;
|
||||
case T_Alias:
|
||||
@@ -4351,211 +4070,6 @@ raw_expression_tree_walker(Node *node,
|
||||
case T_CommonTableExpr:
|
||||
/* search_clause and cycle_clause are not interesting here */
|
||||
return walker(((CommonTableExpr *) node)->ctequery, context);
|
||||
case T_JsonReturning:
|
||||
return walker(((JsonReturning *) node)->format, context);
|
||||
case T_JsonValueExpr:
|
||||
{
|
||||
JsonValueExpr *jve = (JsonValueExpr *) node;
|
||||
|
||||
if (walker(jve->raw_expr, context))
|
||||
return true;
|
||||
if (walker(jve->formatted_expr, context))
|
||||
return true;
|
||||
if (walker(jve->format, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonParseExpr:
|
||||
{
|
||||
JsonParseExpr *jpe = (JsonParseExpr *) node;
|
||||
|
||||
if (walker(jpe->expr, context))
|
||||
return true;
|
||||
if (walker(jpe->output, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonScalarExpr:
|
||||
{
|
||||
JsonScalarExpr *jse = (JsonScalarExpr *) node;
|
||||
|
||||
if (walker(jse->expr, context))
|
||||
return true;
|
||||
if (walker(jse->output, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonSerializeExpr:
|
||||
{
|
||||
JsonSerializeExpr *jse = (JsonSerializeExpr *) node;
|
||||
|
||||
if (walker(jse->expr, context))
|
||||
return true;
|
||||
if (walker(jse->output, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
{
|
||||
JsonConstructorExpr *ctor = (JsonConstructorExpr *) node;
|
||||
|
||||
if (walker(ctor->args, context))
|
||||
return true;
|
||||
if (walker(ctor->func, context))
|
||||
return true;
|
||||
if (walker(ctor->coercion, context))
|
||||
return true;
|
||||
if (walker(ctor->returning, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonOutput:
|
||||
{
|
||||
JsonOutput *out = (JsonOutput *) node;
|
||||
|
||||
if (walker(out->typeName, context))
|
||||
return true;
|
||||
if (walker(out->returning, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonKeyValue:
|
||||
{
|
||||
JsonKeyValue *jkv = (JsonKeyValue *) node;
|
||||
|
||||
if (walker(jkv->key, context))
|
||||
return true;
|
||||
if (walker(jkv->value, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonObjectConstructor:
|
||||
{
|
||||
JsonObjectConstructor *joc = (JsonObjectConstructor *) node;
|
||||
|
||||
if (walker(joc->output, context))
|
||||
return true;
|
||||
if (walker(joc->exprs, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonArrayConstructor:
|
||||
{
|
||||
JsonArrayConstructor *jac = (JsonArrayConstructor *) node;
|
||||
|
||||
if (walker(jac->output, context))
|
||||
return true;
|
||||
if (walker(jac->exprs, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonAggConstructor:
|
||||
{
|
||||
JsonAggConstructor *ctor = (JsonAggConstructor *) node;
|
||||
|
||||
if (walker(ctor->output, context))
|
||||
return true;
|
||||
if (walker(ctor->agg_order, context))
|
||||
return true;
|
||||
if (walker(ctor->agg_filter, context))
|
||||
return true;
|
||||
if (walker(ctor->over, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonObjectAgg:
|
||||
{
|
||||
JsonObjectAgg *joa = (JsonObjectAgg *) node;
|
||||
|
||||
if (walker(joa->constructor, context))
|
||||
return true;
|
||||
if (walker(joa->arg, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonArrayAgg:
|
||||
{
|
||||
JsonArrayAgg *jaa = (JsonArrayAgg *) node;
|
||||
|
||||
if (walker(jaa->constructor, context))
|
||||
return true;
|
||||
if (walker(jaa->arg, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonArrayQueryConstructor:
|
||||
{
|
||||
JsonArrayQueryConstructor *jaqc = (JsonArrayQueryConstructor *) node;
|
||||
|
||||
if (walker(jaqc->output, context))
|
||||
return true;
|
||||
if (walker(jaqc->query, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
return walker(((JsonIsPredicate *) node)->expr, context);
|
||||
case T_JsonArgument:
|
||||
return walker(((JsonArgument *) node)->val, context);
|
||||
case T_JsonCommon:
|
||||
{
|
||||
JsonCommon *jc = (JsonCommon *) node;
|
||||
|
||||
if (walker(jc->expr, context))
|
||||
return true;
|
||||
if (walker(jc->pathspec, context))
|
||||
return true;
|
||||
if (walker(jc->passing, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonBehavior:
|
||||
{
|
||||
JsonBehavior *jb = (JsonBehavior *) node;
|
||||
|
||||
if (jb->btype == JSON_BEHAVIOR_DEFAULT &&
|
||||
walker(jb->default_expr, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonFuncExpr:
|
||||
{
|
||||
JsonFuncExpr *jfe = (JsonFuncExpr *) node;
|
||||
|
||||
if (walker(jfe->common, context))
|
||||
return true;
|
||||
if (jfe->output && walker(jfe->output, context))
|
||||
return true;
|
||||
if (walker(jfe->on_empty, context))
|
||||
return true;
|
||||
if (walker(jfe->on_error, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonTable:
|
||||
{
|
||||
JsonTable *jt = (JsonTable *) node;
|
||||
|
||||
if (walker(jt->common, context))
|
||||
return true;
|
||||
if (walker(jt->columns, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_JsonTableColumn:
|
||||
{
|
||||
JsonTableColumn *jtc = (JsonTableColumn *) node;
|
||||
|
||||
if (walker(jtc->typeName, context))
|
||||
return true;
|
||||
if (walker(jtc->on_empty, context))
|
||||
return true;
|
||||
if (walker(jtc->on_error, context))
|
||||
return true;
|
||||
if (jtc->coltype == JTC_NESTED && walker(jtc->columns, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d",
|
||||
(int) nodeTag(node));
|
||||
|
||||
@@ -1103,7 +1103,6 @@ _outTableFunc(StringInfo str, const TableFunc *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("TABLEFUNC");
|
||||
|
||||
WRITE_ENUM_FIELD(functype, TableFuncType);
|
||||
WRITE_NODE_FIELD(ns_uris);
|
||||
WRITE_NODE_FIELD(ns_names);
|
||||
WRITE_NODE_FIELD(docexpr);
|
||||
@@ -1114,9 +1113,7 @@ _outTableFunc(StringInfo str, const TableFunc *node)
|
||||
WRITE_NODE_FIELD(colcollations);
|
||||
WRITE_NODE_FIELD(colexprs);
|
||||
WRITE_NODE_FIELD(coldefexprs);
|
||||
WRITE_NODE_FIELD(colvalexprs);
|
||||
WRITE_BITMAPSET_FIELD(notnulls);
|
||||
WRITE_NODE_FIELD(plan);
|
||||
WRITE_INT_FIELD(ordinalitycol);
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
@@ -1766,145 +1763,6 @@ _outOnConflictExpr(StringInfo str, const OnConflictExpr *node)
|
||||
WRITE_NODE_FIELD(exclRelTlist);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonFormat(StringInfo str, const JsonFormat *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONFORMAT");
|
||||
|
||||
WRITE_ENUM_FIELD(format_type, JsonFormatType);
|
||||
WRITE_ENUM_FIELD(encoding, JsonEncoding);
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonReturning(StringInfo str, const JsonReturning *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONRETURNING");
|
||||
|
||||
WRITE_NODE_FIELD(format);
|
||||
WRITE_OID_FIELD(typid);
|
||||
WRITE_INT_FIELD(typmod);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonValueExpr(StringInfo str, const JsonValueExpr *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONVALUEEXPR");
|
||||
|
||||
WRITE_NODE_FIELD(raw_expr);
|
||||
WRITE_NODE_FIELD(formatted_expr);
|
||||
WRITE_NODE_FIELD(format);
|
||||
}
|
||||
|
||||
static void
|
||||
_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_NODE_FIELD(returning);
|
||||
WRITE_BOOL_FIELD(absent_on_null);
|
||||
WRITE_BOOL_FIELD(unique);
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonIsPredicate(StringInfo str, const JsonIsPredicate *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONISPREDICATE");
|
||||
|
||||
WRITE_NODE_FIELD(expr);
|
||||
WRITE_NODE_FIELD(format);
|
||||
WRITE_ENUM_FIELD(item_type, JsonValueType);
|
||||
WRITE_BOOL_FIELD(unique_keys);
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonBehavior(StringInfo str, const JsonBehavior *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONBEHAVIOR");
|
||||
|
||||
WRITE_ENUM_FIELD(btype, JsonBehaviorType);
|
||||
WRITE_NODE_FIELD(default_expr);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonExpr(StringInfo str, const JsonExpr *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONEXPR");
|
||||
|
||||
WRITE_ENUM_FIELD(op, JsonExprOp);
|
||||
WRITE_NODE_FIELD(formatted_expr);
|
||||
WRITE_NODE_FIELD(result_coercion);
|
||||
WRITE_NODE_FIELD(format);
|
||||
WRITE_NODE_FIELD(path_spec);
|
||||
WRITE_NODE_FIELD(passing_names);
|
||||
WRITE_NODE_FIELD(passing_values);
|
||||
WRITE_NODE_FIELD(returning);
|
||||
WRITE_NODE_FIELD(on_empty);
|
||||
WRITE_NODE_FIELD(on_error);
|
||||
WRITE_NODE_FIELD(coercions);
|
||||
WRITE_ENUM_FIELD(wrapper, JsonWrapper);
|
||||
WRITE_BOOL_FIELD(omit_quotes);
|
||||
WRITE_LOCATION_FIELD(location);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonCoercion(StringInfo str, const JsonCoercion *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONCOERCION");
|
||||
|
||||
WRITE_NODE_FIELD(expr);
|
||||
WRITE_BOOL_FIELD(via_populate);
|
||||
WRITE_BOOL_FIELD(via_io);
|
||||
WRITE_OID_FIELD(collation);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonItemCoercions(StringInfo str, const JsonItemCoercions *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONITEMCOERCIONS");
|
||||
|
||||
WRITE_NODE_FIELD(null);
|
||||
WRITE_NODE_FIELD(string);
|
||||
WRITE_NODE_FIELD(numeric);
|
||||
WRITE_NODE_FIELD(boolean);
|
||||
WRITE_NODE_FIELD(date);
|
||||
WRITE_NODE_FIELD(time);
|
||||
WRITE_NODE_FIELD(timetz);
|
||||
WRITE_NODE_FIELD(timestamp);
|
||||
WRITE_NODE_FIELD(timestamptz);
|
||||
WRITE_NODE_FIELD(composite);
|
||||
}
|
||||
|
||||
static void
|
||||
_outJsonTableParent(StringInfo str, const JsonTableParent *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("JSONTABLEPARENT");
|
||||
|
||||
WRITE_NODE_FIELD(path);
|
||||
WRITE_STRING_FIELD(name);
|
||||
WRITE_NODE_FIELD(child);
|
||||
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("JSONTABLESIBLING");
|
||||
|
||||
WRITE_NODE_FIELD(larg);
|
||||
WRITE_NODE_FIELD(rarg);
|
||||
WRITE_BOOL_FIELD(cross);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Stuff from pathnodes.h.
|
||||
@@ -4730,39 +4588,6 @@ outNode(StringInfo str, const void *obj)
|
||||
case T_PartitionRangeDatum:
|
||||
_outPartitionRangeDatum(str, obj);
|
||||
break;
|
||||
case T_JsonFormat:
|
||||
_outJsonFormat(str, obj);
|
||||
break;
|
||||
case T_JsonReturning:
|
||||
_outJsonReturning(str, obj);
|
||||
break;
|
||||
case T_JsonValueExpr:
|
||||
_outJsonValueExpr(str, obj);
|
||||
break;
|
||||
case T_JsonConstructorExpr:
|
||||
_outJsonConstructorExpr(str, obj);
|
||||
break;
|
||||
case T_JsonIsPredicate:
|
||||
_outJsonIsPredicate(str, obj);
|
||||
break;
|
||||
case T_JsonBehavior:
|
||||
_outJsonBehavior(str, obj);
|
||||
break;
|
||||
case T_JsonExpr:
|
||||
_outJsonExpr(str, obj);
|
||||
break;
|
||||
case T_JsonCoercion:
|
||||
_outJsonCoercion(str, obj);
|
||||
break;
|
||||
case T_JsonItemCoercions:
|
||||
_outJsonItemCoercions(str, obj);
|
||||
break;
|
||||
case T_JsonTableParent:
|
||||
_outJsonTableParent(str, obj);
|
||||
break;
|
||||
case T_JsonTableSibling:
|
||||
_outJsonTableSibling(str, obj);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
||||
@@ -572,7 +572,6 @@ _readTableFunc(void)
|
||||
{
|
||||
READ_LOCALS(TableFunc);
|
||||
|
||||
READ_ENUM_FIELD(functype, TableFuncType);
|
||||
READ_NODE_FIELD(ns_uris);
|
||||
READ_NODE_FIELD(ns_names);
|
||||
READ_NODE_FIELD(docexpr);
|
||||
@@ -583,9 +582,7 @@ _readTableFunc(void)
|
||||
READ_NODE_FIELD(colcollations);
|
||||
READ_NODE_FIELD(colexprs);
|
||||
READ_NODE_FIELD(coldefexprs);
|
||||
READ_NODE_FIELD(colvalexprs);
|
||||
READ_BITMAPSET_FIELD(notnulls);
|
||||
READ_NODE_FIELD(plan);
|
||||
READ_INT_FIELD(ordinalitycol);
|
||||
READ_LOCATION_FIELD(location);
|
||||
|
||||
@@ -1431,194 +1428,6 @@ _readOnConflictExpr(void)
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonFormat
|
||||
*/
|
||||
static JsonFormat *
|
||||
_readJsonFormat(void)
|
||||
{
|
||||
READ_LOCALS(JsonFormat);
|
||||
|
||||
READ_ENUM_FIELD(format_type, JsonFormatType);
|
||||
READ_ENUM_FIELD(encoding, JsonEncoding);
|
||||
READ_LOCATION_FIELD(location);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonReturning
|
||||
*/
|
||||
static JsonReturning *
|
||||
_readJsonReturning(void)
|
||||
{
|
||||
READ_LOCALS(JsonReturning);
|
||||
|
||||
READ_NODE_FIELD(format);
|
||||
READ_OID_FIELD(typid);
|
||||
READ_INT_FIELD(typmod);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonValueExpr
|
||||
*/
|
||||
static JsonValueExpr *
|
||||
_readJsonValueExpr(void)
|
||||
{
|
||||
READ_LOCALS(JsonValueExpr);
|
||||
|
||||
READ_NODE_FIELD(raw_expr);
|
||||
READ_NODE_FIELD(formatted_expr);
|
||||
READ_NODE_FIELD(format);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonConstructorExpr
|
||||
*/
|
||||
static JsonConstructorExpr *
|
||||
_readJsonConstructorExpr(void)
|
||||
{
|
||||
READ_LOCALS(JsonConstructorExpr);
|
||||
|
||||
READ_ENUM_FIELD(type, JsonConstructorType);
|
||||
READ_NODE_FIELD(args);
|
||||
READ_NODE_FIELD(func);
|
||||
READ_NODE_FIELD(coercion);
|
||||
READ_NODE_FIELD(returning);
|
||||
READ_BOOL_FIELD(absent_on_null);
|
||||
READ_BOOL_FIELD(unique);
|
||||
READ_LOCATION_FIELD(location);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonBehavior
|
||||
*/
|
||||
static JsonBehavior *
|
||||
_readJsonBehavior(void)
|
||||
{
|
||||
READ_LOCALS(JsonBehavior);
|
||||
|
||||
READ_ENUM_FIELD(btype, JsonBehaviorType);
|
||||
READ_NODE_FIELD(default_expr);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonExpr
|
||||
*/
|
||||
static JsonExpr *
|
||||
_readJsonExpr(void)
|
||||
{
|
||||
READ_LOCALS(JsonExpr);
|
||||
|
||||
READ_ENUM_FIELD(op, JsonExprOp);
|
||||
READ_NODE_FIELD(formatted_expr);
|
||||
READ_NODE_FIELD(result_coercion);
|
||||
READ_NODE_FIELD(format);
|
||||
READ_NODE_FIELD(path_spec);
|
||||
READ_NODE_FIELD(passing_names);
|
||||
READ_NODE_FIELD(passing_values);
|
||||
READ_NODE_FIELD(returning);
|
||||
READ_NODE_FIELD(on_empty);
|
||||
READ_NODE_FIELD(on_error);
|
||||
READ_NODE_FIELD(coercions);
|
||||
READ_ENUM_FIELD(wrapper, JsonWrapper);
|
||||
READ_BOOL_FIELD(omit_quotes);
|
||||
READ_LOCATION_FIELD(location);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
static JsonTableParent *
|
||||
_readJsonTableParent(void)
|
||||
{
|
||||
READ_LOCALS(JsonTableParent);
|
||||
|
||||
READ_NODE_FIELD(path);
|
||||
READ_STRING_FIELD(name);
|
||||
READ_NODE_FIELD(child);
|
||||
READ_BOOL_FIELD(outerJoin);
|
||||
READ_INT_FIELD(colMin);
|
||||
READ_INT_FIELD(colMax);
|
||||
READ_BOOL_FIELD(errorOnError);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
static JsonTableSibling *
|
||||
_readJsonTableSibling(void)
|
||||
{
|
||||
READ_LOCALS(JsonTableSibling);
|
||||
|
||||
READ_NODE_FIELD(larg);
|
||||
READ_NODE_FIELD(rarg);
|
||||
READ_BOOL_FIELD(cross);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonCoercion
|
||||
*/
|
||||
static JsonCoercion *
|
||||
_readJsonCoercion(void)
|
||||
{
|
||||
READ_LOCALS(JsonCoercion);
|
||||
|
||||
READ_NODE_FIELD(expr);
|
||||
READ_BOOL_FIELD(via_populate);
|
||||
READ_BOOL_FIELD(via_io);
|
||||
READ_OID_FIELD(collation);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonItemCoercions
|
||||
*/
|
||||
static JsonItemCoercions *
|
||||
_readJsonItemCoercions(void)
|
||||
{
|
||||
READ_LOCALS(JsonItemCoercions);
|
||||
|
||||
READ_NODE_FIELD(null);
|
||||
READ_NODE_FIELD(string);
|
||||
READ_NODE_FIELD(numeric);
|
||||
READ_NODE_FIELD(boolean);
|
||||
READ_NODE_FIELD(date);
|
||||
READ_NODE_FIELD(time);
|
||||
READ_NODE_FIELD(timetz);
|
||||
READ_NODE_FIELD(timestamp);
|
||||
READ_NODE_FIELD(timestamptz);
|
||||
READ_NODE_FIELD(composite);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readJsonIsPredicate
|
||||
*/
|
||||
static JsonIsPredicate *
|
||||
_readJsonIsPredicate()
|
||||
{
|
||||
READ_LOCALS(JsonIsPredicate);
|
||||
|
||||
READ_NODE_FIELD(expr);
|
||||
READ_NODE_FIELD(format);
|
||||
READ_ENUM_FIELD(item_type, JsonValueType);
|
||||
READ_BOOL_FIELD(unique_keys);
|
||||
READ_LOCATION_FIELD(location);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* Stuff from pathnodes.h.
|
||||
*
|
||||
@@ -3213,28 +3022,6 @@ parseNodeString(void)
|
||||
return_value = _readPartitionBoundSpec();
|
||||
else if (MATCH("PARTITIONRANGEDATUM", 19))
|
||||
return_value = _readPartitionRangeDatum();
|
||||
else if (MATCH("JSONFORMAT", 10))
|
||||
return_value = _readJsonFormat();
|
||||
else if (MATCH("JSONRETURNING", 13))
|
||||
return_value = _readJsonReturning();
|
||||
else if (MATCH("JSONVALUEEXPR", 13))
|
||||
return_value = _readJsonValueExpr();
|
||||
else if (MATCH("JSONCONSTRUCTOREXPR", 19))
|
||||
return_value = _readJsonConstructorExpr();
|
||||
else if (MATCH("JSONISPREDICATE", 15))
|
||||
return_value = _readJsonIsPredicate();
|
||||
else if (MATCH("JSONBEHAVIOR", 12))
|
||||
return_value = _readJsonBehavior();
|
||||
else if (MATCH("JSONEXPR", 8))
|
||||
return_value = _readJsonExpr();
|
||||
else if (MATCH("JSONCOERCION", 12))
|
||||
return_value = _readJsonCoercion();
|
||||
else if (MATCH("JSONITEMCOERCIONS", 17))
|
||||
return_value = _readJsonItemCoercions();
|
||||
else if (MATCH("JSONTABLEPARENT", 15))
|
||||
return_value = _readJsonTableParent();
|
||||
else if (MATCH("JSONTABLESIBLING", 16))
|
||||
return_value = _readJsonTableSibling();
|
||||
else
|
||||
{
|
||||
elog(ERROR, "badly formatted node string \"%.32s\"...", token);
|
||||
|
||||
Reference in New Issue
Block a user