From 2f2b18bd3f554e96a8cc885b177211be12288e4a Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Thu, 1 Sep 2022 17:07:14 -0400 Subject: 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 --- src/backend/optimizer/path/costsize.c | 3 +- src/backend/optimizer/util/clauses.c | 78 ----------------------------------- 2 files changed, 1 insertion(+), 80 deletions(-) (limited to 'src/backend/optimizer') diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 75acea149c7..f486d42441b 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -4923,8 +4923,7 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context) IsA(node, SQLValueFunction) || IsA(node, XmlExpr) || IsA(node, CoerceToDomain) || - IsA(node, NextValueExpr) || - IsA(node, JsonExpr)) + IsA(node, NextValueExpr)) { /* Treat all these as having cost 1 */ context->total.per_tuple += cpu_operator_cost; diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index 533df86ff77..5c54171fee0 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -28,7 +28,6 @@ #include "catalog/pg_type.h" #include "executor/executor.h" #include "executor/functions.h" -#include "executor/execExpr.h" #include "funcapi.h" #include "miscadmin.h" #include "nodes/makefuncs.h" @@ -51,9 +50,6 @@ #include "utils/builtins.h" #include "utils/datum.h" #include "utils/fmgroids.h" -#include "utils/json.h" -#include "utils/jsonb.h" -#include "utils/jsonpath.h" #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/syscache.h" @@ -386,45 +382,6 @@ contain_mutable_functions_walker(Node *node, void *context) context)) return true; - if (IsA(node, JsonConstructorExpr)) - { - const JsonConstructorExpr *ctor = (JsonConstructorExpr *) node; - ListCell *lc; - bool is_jsonb = - ctor->returning->format->format_type == JS_FORMAT_JSONB; - - /* Check argument_type => json[b] conversions */ - foreach(lc, ctor->args) - { - Oid typid = exprType(lfirst(lc)); - - if (is_jsonb ? - !to_jsonb_is_immutable(typid) : - !to_json_is_immutable(typid)) - return true; - } - - /* Check all subnodes */ - } - - if (IsA(node, JsonExpr)) - { - JsonExpr *jexpr = castNode(JsonExpr, node); - Const *cnst; - - if (!IsA(jexpr->path_spec, Const)) - return true; - - cnst = castNode(Const, jexpr->path_spec); - - Assert(cnst->consttype == JSONPATHOID); - if (cnst->constisnull) - return false; - - return jspIsMutable(DatumGetJsonPathP(cnst->constvalue), - jexpr->passing_names, jexpr->passing_values); - } - if (IsA(node, SQLValueFunction)) { /* all variants of SQLValueFunction are stable */ @@ -896,18 +853,6 @@ max_parallel_hazard_walker(Node *node, max_parallel_hazard_context *context) context, 0); } - /* JsonExpr is parallel-unsafe if subtransactions can be used. */ - else if (IsA(node, JsonExpr)) - { - JsonExpr *jsexpr = (JsonExpr *) node; - - if (ExecEvalJsonNeedsSubTransaction(jsexpr, NULL)) - { - context->max_hazard = PROPARALLEL_UNSAFE; - return true; - } - } - /* Recurse to check arguments */ return expression_tree_walker(node, max_parallel_hazard_walker, @@ -3567,29 +3512,6 @@ eval_const_expressions_mutator(Node *node, return ece_evaluate_expr((Node *) newcre); return (Node *) newcre; } - case T_JsonValueExpr: - { - JsonValueExpr *jve = (JsonValueExpr *) node; - Node *raw = eval_const_expressions_mutator((Node *) jve->raw_expr, - context); - - if (raw && IsA(raw, Const)) - { - Node *formatted; - Node *save_case_val = context->case_val; - - context->case_val = raw; - - formatted = eval_const_expressions_mutator((Node *) jve->formatted_expr, - context); - - context->case_val = save_case_val; - - if (formatted && IsA(formatted, Const)) - return formatted; - } - break; - } default: break; } -- cgit v1.2.3