diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
-rw-r--r-- | src/include/catalog/pg_aggregate.dat | 22 | ||||
-rw-r--r-- | src/include/catalog/pg_proc.dat | 74 | ||||
-rw-r--r-- | src/include/executor/execExpr.h | 98 | ||||
-rw-r--r-- | src/include/executor/executor.h | 2 | ||||
-rw-r--r-- | src/include/nodes/makefuncs.h | 12 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 287 | ||||
-rw-r--r-- | src/include/nodes/primnodes.h | 265 | ||||
-rw-r--r-- | src/include/parser/kwlist.h | 26 | ||||
-rw-r--r-- | src/include/parser/parse_clause.h | 3 | ||||
-rw-r--r-- | src/include/utils/formatting.h | 4 | ||||
-rw-r--r-- | src/include/utils/json.h | 26 | ||||
-rw-r--r-- | src/include/utils/jsonb.h | 33 | ||||
-rw-r--r-- | src/include/utils/jsonfuncs.h | 7 | ||||
-rw-r--r-- | src/include/utils/jsonpath.h | 37 |
15 files changed, 2 insertions, 896 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 7482c85a86c..78d25036b35 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202208251 +#define CATALOG_VERSION_NO 202209011 #endif diff --git a/src/include/catalog/pg_aggregate.dat b/src/include/catalog/pg_aggregate.dat index 86cc6507983..b9110a52985 100644 --- a/src/include/catalog/pg_aggregate.dat +++ b/src/include/catalog/pg_aggregate.dat @@ -571,36 +571,14 @@ # json { aggfnoid => 'json_agg', aggtransfn => 'json_agg_transfn', aggfinalfn => 'json_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'json_agg_strict', aggtransfn => 'json_agg_strict_transfn', - aggfinalfn => 'json_agg_finalfn', aggtranstype => 'internal' }, { aggfnoid => 'json_object_agg', aggtransfn => 'json_object_agg_transfn', aggfinalfn => 'json_object_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'json_object_agg_unique', - aggtransfn => 'json_object_agg_unique_transfn', - aggfinalfn => 'json_object_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'json_object_agg_strict', - aggtransfn => 'json_object_agg_strict_transfn', - aggfinalfn => 'json_object_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'json_object_agg_unique_strict', - aggtransfn => 'json_object_agg_unique_strict_transfn', - aggfinalfn => 'json_object_agg_finalfn', aggtranstype => 'internal' }, # jsonb { aggfnoid => 'jsonb_agg', aggtransfn => 'jsonb_agg_transfn', aggfinalfn => 'jsonb_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'jsonb_agg_strict', aggtransfn => 'jsonb_agg_strict_transfn', - aggfinalfn => 'jsonb_agg_finalfn', aggtranstype => 'internal' }, { aggfnoid => 'jsonb_object_agg', aggtransfn => 'jsonb_object_agg_transfn', aggfinalfn => 'jsonb_object_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'jsonb_object_agg_unique', - aggtransfn => 'jsonb_object_agg_unique_transfn', - aggfinalfn => 'jsonb_object_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'jsonb_object_agg_strict', - aggtransfn => 'jsonb_object_agg_strict_transfn', - aggfinalfn => 'jsonb_object_agg_finalfn', aggtranstype => 'internal' }, -{ aggfnoid => 'jsonb_object_agg_unique_strict', - aggtransfn => 'jsonb_object_agg_unique_strict_transfn', - aggfinalfn => 'jsonb_object_agg_finalfn', aggtranstype => 'internal' }, # ordered-set and hypothetical-set aggregates { aggfnoid => 'percentile_disc(float8,anyelement)', aggkind => 'o', diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index be47583122b..a07e737a337 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -8785,10 +8785,6 @@ proname => 'json_agg_transfn', proisstrict => 'f', provolatile => 's', prorettype => 'internal', proargtypes => 'internal anyelement', prosrc => 'json_agg_transfn' }, -{ oid => '6208', descr => 'json aggregate transition function', - proname => 'json_agg_strict_transfn', proisstrict => 'f', provolatile => 's', - prorettype => 'internal', proargtypes => 'internal anyelement', - prosrc => 'json_agg_strict_transfn' }, { oid => '3174', descr => 'json aggregate final function', proname => 'json_agg_finalfn', proisstrict => 'f', prorettype => 'json', proargtypes => 'internal', prosrc => 'json_agg_finalfn' }, @@ -8796,29 +8792,10 @@ proname => 'json_agg', prokind => 'a', proisstrict => 'f', provolatile => 's', prorettype => 'json', proargtypes => 'anyelement', prosrc => 'aggregate_dummy' }, -{ oid => '6209', descr => 'aggregate input into json', - proname => 'json_agg_strict', prokind => 'a', proisstrict => 'f', - provolatile => 's', prorettype => 'json', proargtypes => 'anyelement', - prosrc => 'aggregate_dummy' }, { oid => '3180', descr => 'json object aggregate transition function', proname => 'json_object_agg_transfn', proisstrict => 'f', provolatile => 's', prorettype => 'internal', proargtypes => 'internal any any', prosrc => 'json_object_agg_transfn' }, -{ oid => '6210', descr => 'json object aggregate transition function', - proname => 'json_object_agg_strict_transfn', proisstrict => 'f', - provolatile => 's', prorettype => 'internal', - proargtypes => 'internal any any', - prosrc => 'json_object_agg_strict_transfn' }, -{ oid => '6211', descr => 'json object aggregate transition function', - proname => 'json_object_agg_unique_transfn', proisstrict => 'f', - provolatile => 's', prorettype => 'internal', - proargtypes => 'internal any any', - prosrc => 'json_object_agg_unique_transfn' }, -{ oid => '6212', descr => 'json object aggregate transition function', - proname => 'json_object_agg_unique_strict_transfn', proisstrict => 'f', - provolatile => 's', prorettype => 'internal', - proargtypes => 'internal any any', - prosrc => 'json_object_agg_unique_strict_transfn' }, { oid => '3196', descr => 'json object aggregate final function', proname => 'json_object_agg_finalfn', proisstrict => 'f', prorettype => 'json', proargtypes => 'internal', @@ -8827,20 +8804,6 @@ proname => 'json_object_agg', prokind => 'a', proisstrict => 'f', provolatile => 's', prorettype => 'json', proargtypes => 'any any', prosrc => 'aggregate_dummy' }, -{ oid => '6213', descr => 'aggregate non-NULL input into a json object', - proname => 'json_object_agg_strict', prokind => 'a', proisstrict => 'f', - provolatile => 's', prorettype => 'json', proargtypes => 'any any', - prosrc => 'aggregate_dummy' }, -{ oid => '6214', - descr => 'aggregate input into a json object with unique keys', - proname => 'json_object_agg_unique', prokind => 'a', proisstrict => 'f', - provolatile => 's', prorettype => 'json', proargtypes => 'any any', - prosrc => 'aggregate_dummy' }, -{ oid => '6215', - descr => 'aggregate non-NULL input into a json object with unique keys', - proname => 'json_object_agg_unique_strict', prokind => 'a', - proisstrict => 'f', provolatile => 's', prorettype => 'json', - proargtypes => 'any any', prosrc => 'aggregate_dummy' }, { oid => '3198', descr => 'build a json array from any inputs', proname => 'json_build_array', provariadic => 'any', proisstrict => 'f', provolatile => 's', prorettype => 'json', proargtypes => 'any', @@ -9713,10 +9676,6 @@ proname => 'jsonb_agg_transfn', proisstrict => 'f', provolatile => 's', prorettype => 'internal', proargtypes => 'internal anyelement', prosrc => 'jsonb_agg_transfn' }, -{ oid => '6216', descr => 'jsonb aggregate transition function', - proname => 'jsonb_agg_strict_transfn', proisstrict => 'f', provolatile => 's', - prorettype => 'internal', proargtypes => 'internal anyelement', - prosrc => 'jsonb_agg_strict_transfn' }, { oid => '3266', descr => 'jsonb aggregate final function', proname => 'jsonb_agg_finalfn', proisstrict => 'f', provolatile => 's', prorettype => 'jsonb', proargtypes => 'internal', @@ -9725,29 +9684,10 @@ proname => 'jsonb_agg', prokind => 'a', proisstrict => 'f', provolatile => 's', prorettype => 'jsonb', proargtypes => 'anyelement', prosrc => 'aggregate_dummy' }, -{ oid => '6217', descr => 'aggregate input into jsonb skipping nulls', - proname => 'jsonb_agg_strict', prokind => 'a', proisstrict => 'f', - provolatile => 's', prorettype => 'jsonb', proargtypes => 'anyelement', - prosrc => 'aggregate_dummy' }, { oid => '3268', descr => 'jsonb object aggregate transition function', proname => 'jsonb_object_agg_transfn', proisstrict => 'f', provolatile => 's', prorettype => 'internal', proargtypes => 'internal any any', prosrc => 'jsonb_object_agg_transfn' }, -{ oid => '6218', descr => 'jsonb object aggregate transition function', - proname => 'jsonb_object_agg_strict_transfn', proisstrict => 'f', - provolatile => 's', prorettype => 'internal', - proargtypes => 'internal any any', - prosrc => 'jsonb_object_agg_strict_transfn' }, -{ oid => '6219', descr => 'jsonb object aggregate transition function', - proname => 'jsonb_object_agg_unique_transfn', proisstrict => 'f', - provolatile => 's', prorettype => 'internal', - proargtypes => 'internal any any', - prosrc => 'jsonb_object_agg_unique_transfn' }, -{ oid => '6220', descr => 'jsonb object aggregate transition function', - proname => 'jsonb_object_agg_unique_strict_transfn', proisstrict => 'f', - provolatile => 's', prorettype => 'internal', - proargtypes => 'internal any any', - prosrc => 'jsonb_object_agg_unique_strict_transfn' }, { oid => '3269', descr => 'jsonb object aggregate final function', proname => 'jsonb_object_agg_finalfn', proisstrict => 'f', provolatile => 's', prorettype => 'jsonb', proargtypes => 'internal', @@ -9756,20 +9696,6 @@ proname => 'jsonb_object_agg', prokind => 'a', proisstrict => 'f', prorettype => 'jsonb', proargtypes => 'any any', prosrc => 'aggregate_dummy' }, -{ oid => '6221', descr => 'aggregate non-NULL inputs into jsonb object', - proname => 'jsonb_object_agg_strict', prokind => 'a', proisstrict => 'f', - prorettype => 'jsonb', proargtypes => 'any any', - prosrc => 'aggregate_dummy' }, -{ oid => '6222', - descr => 'aggregate inputs into jsonb object checking key uniqueness', - proname => 'jsonb_object_agg_unique', prokind => 'a', proisstrict => 'f', - prorettype => 'jsonb', proargtypes => 'any any', - prosrc => 'aggregate_dummy' }, -{ oid => '6223', - descr => 'aggregate non-NULL inputs into jsonb object checking key uniqueness', - proname => 'jsonb_object_agg_unique_strict', prokind => 'a', - proisstrict => 'f', prorettype => 'jsonb', proargtypes => 'any any', - prosrc => 'aggregate_dummy' }, { oid => '3271', descr => 'build a jsonb array from any inputs', proname => 'jsonb_build_array', provariadic => 'any', proisstrict => 'f', provolatile => 's', prorettype => 'jsonb', proargtypes => 'any', diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index c8ef917ffe0..e14f15d435b 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -21,9 +21,6 @@ struct ExprEvalStep; struct SubscriptingRefState; struct ScalarArrayOpExprHashTable; -struct JsonbValue; -struct JsonExprState; -struct JsonConstructorExprState; /* Bits in ExprState->flags (see also execnodes.h for public flag bits): */ /* expression's interpreter has been initialized */ @@ -242,9 +239,6 @@ typedef enum ExprEvalOp EEOP_GROUPING_FUNC, EEOP_WINDOW_FUNC, EEOP_SUBPLAN, - EEOP_JSON_CONSTRUCTOR, - EEOP_IS_JSON, - EEOP_JSONEXPR, /* aggregation related nodes */ EEOP_AGG_STRICT_DESERIALIZE, @@ -679,25 +673,6 @@ typedef struct ExprEvalStep int transno; int setoff; } agg_trans; - - /* for EEOP_JSON_CONSTRUCTOR */ - struct - { - struct JsonConstructorExprState *jcstate; - } json_constructor; - - /* for EEOP_IS_JSON */ - struct - { - JsonIsPredicate *pred; /* original expression node */ - } is_json; - - /* for EEOP_JSONEXPR */ - struct - { - struct JsonExprState *jsestate; - } jsonexpr; - } d; } ExprEvalStep; @@ -742,64 +717,6 @@ typedef struct SubscriptExecSteps ExecEvalSubroutine sbs_fetch_old; /* fetch old value for assignment */ } SubscriptExecSteps; -/* EEOP_JSON_CONSTRUCTOR state, too big to inline */ -typedef struct JsonConstructorExprState -{ - JsonConstructorExpr *constructor; - Datum *arg_values; - bool *arg_nulls; - Oid *arg_types; - struct - { - int category; - Oid outfuncid; - } *arg_type_cache; /* cache for datum_to_json[b]() */ - int nargs; -} JsonConstructorExprState; - -/* EEOP_JSONEXPR state, too big to inline */ -typedef struct JsonExprState -{ - JsonExpr *jsexpr; /* original expression node */ - - struct - { - FmgrInfo func; /* typinput function for output type */ - Oid typioparam; - } input; /* I/O info for output type */ - - NullableDatum - *formatted_expr, /* formatted context item value */ - *res_expr, /* result item */ - *coercion_expr, /* input for JSON item coercion */ - *pathspec; /* path specification value */ - - ExprState *result_expr; /* coerced to output type */ - ExprState *default_on_empty; /* ON EMPTY DEFAULT expression */ - ExprState *default_on_error; /* ON ERROR DEFAULT expression */ - List *args; /* passing arguments */ - - void *cache; /* cache for json_populate_type() */ - - struct JsonCoercionsState - { - struct JsonCoercionState - { - JsonCoercion *coercion; /* coercion expression */ - ExprState *estate; /* coercion expression state */ - } null, - string, - numeric , - boolean, - date, - time, - timetz, - timestamp, - timestamptz, - composite; - } coercions; /* states for coercion from SQL/JSON item - * types directly to the output type */ -} JsonExprState; /* functions in execExpr.c */ extern void ExprEvalPushStep(ExprState *es, const ExprEvalStep *s); @@ -850,7 +767,6 @@ extern void ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, extern void ExecEvalConstraintNotNull(ExprState *state, ExprEvalStep *op); extern void ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op); extern void ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op); -extern void ExecEvalJsonIsPredicate(ExprState *state, ExprEvalStep *op); extern void ExecEvalGroupingFunc(ExprState *state, ExprEvalStep *op); extern void ExecEvalSubPlan(ExprState *state, ExprEvalStep *op, ExprContext *econtext); @@ -858,20 +774,6 @@ extern void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext); extern void ExecEvalSysVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext, TupleTableSlot *slot); -extern void ExecEvalJsonConstructor(ExprState *state, ExprEvalStep *op, - ExprContext *econtext); -extern void ExecEvalJson(ExprState *state, ExprEvalStep *op, - ExprContext *econtext); -extern Datum ExecPrepareJsonItemCoercion(struct JsonbValue *item, - JsonReturning *returning, - struct JsonCoercionsState *coercions, - struct JsonCoercionState **pjcstate); -extern bool ExecEvalJsonNeedsSubTransaction(JsonExpr *jsexpr, - struct JsonCoercionsState *); -extern Datum ExecEvalExprPassingCaseValue(ExprState *estate, - ExprContext *econtext, bool *isnull, - Datum caseval_datum, - bool caseval_isnull); extern void ExecAggInitGroup(AggState *aggstate, AggStatePerTrans pertrans, AggStatePerGroup pergroup, ExprContext *aggcontext); diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index d68a6b9d28c..82925b4b633 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -265,8 +265,6 @@ ExecProcNode(PlanState *node) */ extern ExprState *ExecInitExpr(Expr *node, PlanState *parent); extern ExprState *ExecInitExprWithParams(Expr *node, ParamListInfo ext_params); -extern ExprState *ExecInitExprWithCaseValue(Expr *node, PlanState *parent, - Datum *caseval, bool *casenull); extern ExprState *ExecInitQual(List *qual, PlanState *parent); extern ExprState *ExecInitCheck(List *qual, PlanState *parent); extern List *ExecInitExprList(List *nodes, PlanState *parent); diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h index 06e6369026a..50de4c62af7 100644 --- a/src/include/nodes/makefuncs.h +++ b/src/include/nodes/makefuncs.h @@ -106,16 +106,4 @@ extern GroupingSet *makeGroupingSet(GroupingSetKind kind, List *content, int loc extern VacuumRelation *makeVacuumRelation(RangeVar *relation, Oid oid, List *va_cols); -extern JsonFormat *makeJsonFormat(JsonFormatType type, JsonEncoding encoding, - int location); -extern JsonValueExpr *makeJsonValueExpr(Expr *expr, JsonFormat *format); -extern JsonBehavior *makeJsonBehavior(JsonBehaviorType type, Node *expr); -extern Node *makeJsonTableJoinedPlan(JsonTablePlanJoinType type, - Node *plan1, Node *plan2, int location); -extern Node *makeJsonKeyValue(Node *key, Node *value); -extern Node *makeJsonIsPredicate(Node *expr, JsonFormat *format, - JsonValueType item_type, bool unique_keys, - int location); -extern JsonEncoding makeJsonEncoding(char *name); - #endif /* MAKEFUNC_H */ diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 469a5c46f62..6958306a7dc 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -1606,293 +1606,6 @@ typedef struct TriggerTransition bool isTable; } TriggerTransition; -/* Nodes for SQL/JSON support */ - -/* - * JsonQuotes - - * representation of [KEEP|OMIT] QUOTES clause for JSON_QUERY() - */ -typedef enum JsonQuotes -{ - JS_QUOTES_UNSPEC, /* unspecified */ - JS_QUOTES_KEEP, /* KEEP QUOTES */ - JS_QUOTES_OMIT /* OMIT QUOTES */ -} JsonQuotes; - -/* - * JsonTableColumnType - - * enumeration of JSON_TABLE column types - */ -typedef enum JsonTableColumnType -{ - JTC_FOR_ORDINALITY, - JTC_REGULAR, - JTC_EXISTS, - JTC_FORMATTED, - JTC_NESTED, -} JsonTableColumnType; - -/* - * JsonOutput - - * representation of JSON output clause (RETURNING type [FORMAT format]) - */ -typedef struct JsonOutput -{ - NodeTag type; - TypeName *typeName; /* RETURNING type name, if specified */ - JsonReturning *returning; /* RETURNING FORMAT clause and type Oids */ -} JsonOutput; - -/* - * JsonArgument - - * representation of argument from JSON PASSING clause - */ -typedef struct JsonArgument -{ - NodeTag type; - JsonValueExpr *val; /* argument value expression */ - char *name; /* argument name */ -} JsonArgument; - -/* - * JsonCommon - - * representation of common syntax of functions using JSON path - */ -typedef struct JsonCommon -{ - NodeTag type; - JsonValueExpr *expr; /* context item expression */ - Node *pathspec; /* JSON path specification expression */ - char *pathname; /* path name, if any */ - List *passing; /* list of PASSING clause arguments, if any */ - int location; /* token location, or -1 if unknown */ -} JsonCommon; - -/* - * JsonFuncExpr - - * untransformed representation of JSON function expressions - */ -typedef struct JsonFuncExpr -{ - NodeTag type; - JsonExprOp op; /* expression type */ - JsonCommon *common; /* common syntax */ - JsonOutput *output; /* output clause, if specified */ - JsonBehavior *on_empty; /* ON EMPTY behavior, if specified */ - JsonBehavior *on_error; /* ON ERROR behavior, if specified */ - JsonWrapper wrapper; /* array wrapper behavior (JSON_QUERY only) */ - bool omit_quotes; /* omit or keep quotes? (JSON_QUERY only) */ - int location; /* token location, or -1 if unknown */ -} JsonFuncExpr; - -/* - * JsonTableColumn - - * untransformed representation of JSON_TABLE column - */ -typedef struct JsonTableColumn -{ - NodeTag type; - JsonTableColumnType coltype; /* column type */ - char *name; /* column name */ - TypeName *typeName; /* column type name */ - char *pathspec; /* path specification, if any */ - char *pathname; /* path name, if any */ - JsonFormat *format; /* JSON format clause, if specified */ - JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */ - bool omit_quotes; /* omit or keep quotes on scalar strings? */ - List *columns; /* nested columns */ - JsonBehavior *on_empty; /* ON EMPTY behavior */ - JsonBehavior *on_error; /* ON ERROR behavior */ - int location; /* token location, or -1 if unknown */ -} JsonTableColumn; - -/* - * JsonTablePlanType - - * flags for JSON_TABLE plan node types representation - */ -typedef enum JsonTablePlanType -{ - JSTP_DEFAULT, - JSTP_SIMPLE, - JSTP_JOINED, -} JsonTablePlanType; - -/* - * JsonTablePlanJoinType - - * flags for JSON_TABLE join types representation - */ -typedef enum JsonTablePlanJoinType -{ - JSTPJ_INNER = 0x01, - JSTPJ_OUTER = 0x02, - JSTPJ_CROSS = 0x04, - JSTPJ_UNION = 0x08, -} JsonTablePlanJoinType; - -typedef struct JsonTablePlan JsonTablePlan; - -/* - * JsonTablePlan - - * untransformed representation of JSON_TABLE plan node - */ -struct JsonTablePlan -{ - NodeTag type; - JsonTablePlanType plan_type; /* plan type */ - JsonTablePlanJoinType join_type; /* join type (for joined plan only) */ - JsonTablePlan *plan1; /* first joined plan */ - JsonTablePlan *plan2; /* second joined plan */ - char *pathname; /* path name (for simple plan only) */ - int location; /* token location, or -1 if unknown */ -}; - -/* - * JsonTable - - * untransformed representation of JSON_TABLE - */ -typedef struct JsonTable -{ - NodeTag type; - JsonCommon *common; /* common JSON path syntax fields */ - List *columns; /* list of JsonTableColumn */ - JsonTablePlan *plan; /* join plan, if specified */ - JsonBehavior *on_error; /* ON ERROR behavior, if specified */ - Alias *alias; /* table alias in FROM clause */ - bool lateral; /* does it have LATERAL prefix? */ - int location; /* token location, or -1 if unknown */ -} JsonTable; - -/* - * JsonKeyValue - - * untransformed representation of JSON object key-value pair for - * JSON_OBJECT() and JSON_OBJECTAGG() - */ -typedef struct JsonKeyValue -{ - NodeTag type; - Expr *key; /* key expression */ - JsonValueExpr *value; /* JSON value expression */ -} JsonKeyValue; - -/* - * JsonParseExpr - - * untransformed representation of JSON() - */ -typedef struct JsonParseExpr -{ - NodeTag type; - JsonValueExpr *expr; /* string expression */ - JsonOutput *output; /* RETURNING clause, if specified */ - bool unique_keys; /* WITH UNIQUE KEYS? */ - int location; /* token location, or -1 if unknown */ -} JsonParseExpr; - -/* - * JsonScalarExpr - - * untransformed representation of JSON_SCALAR() - */ -typedef struct JsonScalarExpr -{ - NodeTag type; - Expr *expr; /* scalar expression */ - JsonOutput *output; /* RETURNING clause, if specified */ - int location; /* token location, or -1 if unknown */ -} JsonScalarExpr; - -/* - * JsonSerializeExpr - - * untransformed representation of JSON_SERIALIZE() function - */ -typedef struct JsonSerializeExpr -{ - NodeTag type; - JsonValueExpr *expr; /* json value expression */ - JsonOutput *output; /* RETURNING clause, if specified */ - int location; /* token location, or -1 if unknown */ -} JsonSerializeExpr; - -/* - * JsonObjectConstructor - - * untransformed representation of JSON_OBJECT() constructor - */ -typedef struct JsonObjectConstructor -{ - NodeTag type; - List *exprs; /* list of JsonKeyValue pairs */ - JsonOutput *output; /* RETURNING clause, if specified */ - bool absent_on_null; /* skip NULL values? */ - bool unique; /* check key uniqueness? */ - int location; /* token location, or -1 if unknown */ -} JsonObjectConstructor; - -/* - * JsonArrayConstructor - - * untransformed representation of JSON_ARRAY(element,...) constructor - */ -typedef struct JsonArrayConstructor -{ - NodeTag type; - List *exprs; /* list of JsonValueExpr elements */ - JsonOutput *output; /* RETURNING clause, if specified */ - bool absent_on_null; /* skip NULL elements? */ - int location; /* token location, or -1 if unknown */ -} JsonArrayConstructor; - -/* - * JsonArrayQueryConstructor - - * untransformed representation of JSON_ARRAY(subquery) constructor - */ -typedef struct JsonArrayQueryConstructor -{ - NodeTag type; - Node *query; /* subquery */ - JsonOutput *output; /* RETURNING clause, if specified */ - JsonFormat *format; /* FORMAT clause for subquery, if specified */ - bool absent_on_null; /* skip NULL elements? */ - int location; /* token location, or -1 if unknown */ -} JsonArrayQueryConstructor; - -/* - * JsonAggConstructor - - * common fields of untransformed representation of - * JSON_ARRAYAGG() and JSON_OBJECTAGG() - */ -typedef struct JsonAggConstructor -{ - NodeTag type; - JsonOutput *output; /* RETURNING clause, if any */ - Node *agg_filter; /* FILTER clause, if any */ - List *agg_order; /* ORDER BY clause, if any */ - struct WindowDef *over; /* OVER clause, if any */ - int location; /* token location, or -1 if unknown */ -} JsonAggConstructor; - -/* - * JsonObjectAgg - - * untransformed representation of JSON_OBJECTAGG() - */ -typedef struct JsonObjectAgg -{ - NodeTag type; - JsonAggConstructor *constructor; /* common fields */ - JsonKeyValue *arg; /* object key-value pair */ - bool absent_on_null; /* skip NULL values? */ - bool unique; /* check key uniqueness? */ -} JsonObjectAgg; - -/* - * JsonArrayAgg - - * untransformed representation of JSON_ARRRAYAGG() - */ -typedef struct JsonArrayAgg -{ - NodeTag type; - JsonAggConstructor *constructor; /* common fields */ - JsonValueExpr *arg; /* array element expression */ - bool absent_on_null; /* skip NULL elements? */ -} JsonArrayAgg; - - /***************************************************************************** * Raw Grammar Output Statements *****************************************************************************/ diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 3aa96bb6855..40661334bbe 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -89,14 +89,8 @@ typedef struct RangeVar int location; } RangeVar; -typedef enum TableFuncType -{ - TFT_XMLTABLE, - TFT_JSON_TABLE -} TableFuncType; - /* - * TableFunc - node for a table function, such as XMLTABLE or JSON_TABLE. + * TableFunc - node for a table function, such as XMLTABLE. * * Entries in the ns_names list are either String nodes containing * literal namespace names, or NULL pointers to represent DEFAULT. @@ -104,7 +98,6 @@ typedef enum TableFuncType typedef struct TableFunc { NodeTag type; - TableFuncType functype; /* XMLTABLE or JSON_TABLE */ List *ns_uris; /* list of namespace URI expressions */ List *ns_names; /* list of namespace names or NULL */ Node *docexpr; /* input document expression */ @@ -115,9 +108,7 @@ typedef struct TableFunc List *colcollations; /* OID list of column collation OIDs */ List *colexprs; /* list of column filter expressions */ List *coldefexprs; /* list of column default expressions */ - List *colvalexprs; /* list of column value expressions */ Bitmapset *notnulls; /* nullability flag for each output column */ - Node *plan; /* JSON_TABLE plan */ int ordinalitycol; /* counts from 0; -1 if none specified */ int location; /* token location, or -1 if unknown */ } TableFunc; @@ -1383,260 +1374,6 @@ typedef struct XmlExpr int location; /* token location, or -1 if unknown */ } XmlExpr; -/* - * JsonExprOp - - * enumeration of JSON functions using JSON path - */ -typedef enum JsonExprOp -{ - JSON_VALUE_OP, /* JSON_VALUE() */ - JSON_QUERY_OP, /* JSON_QUERY() */ - JSON_EXISTS_OP, /* JSON_EXISTS() */ - JSON_TABLE_OP /* JSON_TABLE() */ -} JsonExprOp; - -/* - * JsonEncoding - - * representation of JSON ENCODING clause - */ -typedef enum JsonEncoding -{ - JS_ENC_DEFAULT, /* unspecified */ - JS_ENC_UTF8, - JS_ENC_UTF16, - JS_ENC_UTF32, -} JsonEncoding; - -/* - * JsonFormatType - - * enumeration of JSON formats used in JSON FORMAT clause - */ -typedef enum JsonFormatType -{ - JS_FORMAT_DEFAULT, /* unspecified */ - JS_FORMAT_JSON, /* FORMAT JSON [ENCODING ...] */ - JS_FORMAT_JSONB /* implicit internal format for RETURNING - * jsonb */ -} JsonFormatType; - -/* - * JsonBehaviorType - - * enumeration of behavior types used in JSON ON ... BEHAVIOR clause - * - * If enum members are reordered, get_json_behavior() from ruleutils.c - * must be updated accordingly. - */ -typedef enum JsonBehaviorType -{ - JSON_BEHAVIOR_NULL = 0, - JSON_BEHAVIOR_ERROR, - JSON_BEHAVIOR_EMPTY, - JSON_BEHAVIOR_TRUE, - JSON_BEHAVIOR_FALSE, - JSON_BEHAVIOR_UNKNOWN, - JSON_BEHAVIOR_EMPTY_ARRAY, - JSON_BEHAVIOR_EMPTY_OBJECT, - JSON_BEHAVIOR_DEFAULT -} JsonBehaviorType; - -/* - * JsonWrapper - - * representation of WRAPPER clause for JSON_QUERY() - */ -typedef enum JsonWrapper -{ - JSW_NONE, - JSW_CONDITIONAL, - JSW_UNCONDITIONAL, -} JsonWrapper; - -/* - * JsonFormat - - * representation of JSON FORMAT clause - */ -typedef struct JsonFormat -{ - NodeTag type; - JsonFormatType format_type; /* format type */ - JsonEncoding encoding; /* JSON encoding */ - int location; /* token location, or -1 if unknown */ -} JsonFormat; - -/* - * JsonReturning - - * transformed representation of JSON RETURNING clause - */ -typedef struct JsonReturning -{ - NodeTag type; - JsonFormat *format; /* output JSON format */ - Oid typid; /* target type Oid */ - int32 typmod; /* target type modifier */ -} JsonReturning; - -/* - * JsonValueExpr - - * representation of JSON value expression (expr [FORMAT json_format]) - */ -typedef struct JsonValueExpr -{ - NodeTag type; - Expr *raw_expr; /* raw expression */ - Expr *formatted_expr; /* formatted expression or NULL */ - JsonFormat *format; /* FORMAT clause, if specified */ -} JsonValueExpr; - -typedef enum JsonConstructorType -{ - JSCTOR_JSON_OBJECT = 1, - JSCTOR_JSON_ARRAY = 2, - JSCTOR_JSON_OBJECTAGG = 3, - JSCTOR_JSON_ARRAYAGG = 4, - JSCTOR_JSON_SCALAR = 5, - JSCTOR_JSON_SERIALIZE = 6, - JSCTOR_JSON_PARSE = 7 -} JsonConstructorType; - -/* - * JsonConstructorExpr - - * wrapper over FuncExpr/Aggref/WindowFunc for SQL/JSON constructors - */ -typedef struct JsonConstructorExpr -{ - Expr xpr; - JsonConstructorType type; /* constructor type */ - List *args; - Expr *func; /* underlying json[b]_xxx() function call */ - Expr *coercion; /* coercion to RETURNING type */ - JsonReturning *returning; /* RETURNING clause */ - bool absent_on_null; /* ABSENT ON NULL? */ - bool unique; /* WITH UNIQUE KEYS? (JSON_OBJECT[AGG] only) */ - int location; -} JsonConstructorExpr; - -/* - * JsonValueType - - * representation of JSON item type in IS JSON predicate - */ -typedef enum JsonValueType -{ - JS_TYPE_ANY, /* IS JSON [VALUE] */ - JS_TYPE_OBJECT, /* IS JSON OBJECT */ - JS_TYPE_ARRAY, /* IS JSON ARRAY */ - JS_TYPE_SCALAR /* IS JSON SCALAR */ -} JsonValueType; - -/* - * JsonIsPredicate - - * representation of IS JSON predicate - */ -typedef struct JsonIsPredicate -{ - NodeTag type; - Node *expr; /* subject expression */ - JsonFormat *format; /* FORMAT clause, if specified */ - JsonValueType item_type; /* JSON item type */ - bool unique_keys; /* check key uniqueness? */ - int location; /* token location, or -1 if unknown */ -} JsonIsPredicate; - -/* - * JsonBehavior - - * representation of JSON ON ... BEHAVIOR clause - */ -typedef struct JsonBehavior -{ - NodeTag type; - JsonBehaviorType btype; /* behavior type */ - Node *default_expr; /* default expression, if any */ -} JsonBehavior; - -/* - * JsonCoercion - - * coercion from SQL/JSON item types to SQL types - */ -typedef struct JsonCoercion -{ - NodeTag type; - Node *expr; /* resulting expression coerced to target type */ - bool via_populate; /* coerce result using json_populate_type()? */ - bool via_io; /* coerce result using type input function? */ - Oid collation; /* collation for coercion via I/O or populate */ -} JsonCoercion; - -/* - * JsonItemCoercions - - * expressions for coercion from SQL/JSON item types directly to the - * output SQL type - */ -typedef struct JsonItemCoercions -{ - NodeTag type; - JsonCoercion *null; - JsonCoercion *string; - JsonCoercion *numeric; - JsonCoercion *boolean; - JsonCoercion *date; - JsonCoercion *time; - JsonCoercion *timetz; - JsonCoercion *timestamp; - JsonCoercion *timestamptz; - JsonCoercion *composite; /* arrays and objects */ -} JsonItemCoercions; - -/* - * JsonExpr - - * transformed representation of JSON_VALUE(), JSON_QUERY(), JSON_EXISTS() - */ -typedef struct JsonExpr -{ - Expr xpr; - JsonExprOp op; /* json function ID */ - Node *formatted_expr; /* formatted context item expression */ - JsonCoercion *result_coercion; /* resulting coercion to RETURNING type */ - JsonFormat *format; /* context item format (JSON/JSONB) */ - Node *path_spec; /* JSON path specification expression */ - List *passing_names; /* PASSING argument names */ - List *passing_values; /* PASSING argument values */ - JsonReturning *returning; /* RETURNING clause type/format info */ - JsonBehavior *on_empty; /* ON EMPTY behavior */ - JsonBehavior *on_error; /* ON ERROR behavior */ - JsonItemCoercions *coercions; /* coercions for JSON_VALUE */ - JsonWrapper wrapper; /* WRAPPER for JSON_QUERY */ - bool omit_quotes; /* KEEP/OMIT QUOTES for JSON_QUERY */ - int location; /* token location, or -1 if unknown */ -} JsonExpr; - -/* - * JsonTableParent - - * transformed representation of parent JSON_TABLE plan node - */ -typedef struct JsonTableParent -{ - NodeTag type; - Const *path; /* jsonpath constant */ - char *name; /* path name */ - Node *child; /* nested columns, if any */ - bool outerJoin; /* outer or inner join for nested columns? */ - int colMin; /* min column index in the resulting column - * list */ - int colMax; /* max column index in the resulting column - * list */ - bool errorOnError; /* ERROR/EMPTY ON ERROR behavior */ -} JsonTableParent; - -/* - * JsonTableSibling - - * transformed representation of joined sibling JSON_TABLE plan node - */ -typedef struct JsonTableSibling -{ - NodeTag type; - Node *larg; /* left join node */ - Node *rarg; /* right join node */ - bool cross; /* cross or union join? */ -} JsonTableSibling; - /* ---------------- * NullTest * diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h index ae35f032513..9a7cc0c6bd1 100644 --- a/src/include/parser/kwlist.h +++ b/src/include/parser/kwlist.h @@ -26,7 +26,6 @@ /* name, value, category, is-bare-label */ PG_KEYWORD("abort", ABORT_P, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("absent", ABSENT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("absolute", ABSOLUTE_P, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("access", ACCESS, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("action", ACTION, UNRESERVED_KEYWORD, BARE_LABEL) @@ -93,7 +92,6 @@ PG_KEYWORD("commit", COMMIT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("committed", COMMITTED, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("compression", COMPRESSION, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("concurrently", CONCURRENTLY, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("conditional", CONDITIONAL, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("configuration", CONFIGURATION, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("conflict", CONFLICT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("connection", CONNECTION, UNRESERVED_KEYWORD, BARE_LABEL) @@ -148,13 +146,11 @@ PG_KEYWORD("double", DOUBLE_P, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("drop", DROP, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("each", EACH, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("else", ELSE, RESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("empty", EMPTY_P, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("enable", ENABLE_P, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("encoding", ENCODING, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("encrypted", ENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("end", END_P, RESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("enum", ENUM_P, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("error", ERROR_P, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("escape", ESCAPE, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("event", EVENT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("except", EXCEPT, RESERVED_KEYWORD, AS_LABEL) @@ -179,7 +175,6 @@ PG_KEYWORD("following", FOLLOWING, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("for", FOR, RESERVED_KEYWORD, AS_LABEL) PG_KEYWORD("force", FORCE, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("foreign", FOREIGN, RESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("format", FORMAT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("forward", FORWARD, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("freeze", FREEZE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) PG_KEYWORD("from", FROM, RESERVED_KEYWORD, AS_LABEL) @@ -232,20 +227,7 @@ PG_KEYWORD("is", IS, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD, AS_LABEL) PG_KEYWORD("isolation", ISOLATION, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("join", JOIN, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json", JSON, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_array", JSON_ARRAY, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_arrayagg", JSON_ARRAYAGG, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_exists", JSON_EXISTS, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_object", JSON_OBJECT, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_objectagg", JSON_OBJECTAGG, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_query", JSON_QUERY, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_scalar", JSON_SCALAR, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_serialize", JSON_SERIALIZE, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_table", JSON_TABLE, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("json_value", JSON_VALUE, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("keep", KEEP, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("key", KEY, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("keys", KEYS, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("label", LABEL, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("language", LANGUAGE, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("large", LARGE_P, UNRESERVED_KEYWORD, BARE_LABEL) @@ -284,7 +266,6 @@ PG_KEYWORD("names", NAMES, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("national", NATIONAL, COL_NAME_KEYWORD, BARE_LABEL) PG_KEYWORD("natural", NATURAL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) PG_KEYWORD("nchar", NCHAR, COL_NAME_KEYWORD, BARE_LABEL) -PG_KEYWORD("nested", NESTED, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("new", NEW, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("nfc", NFC, UNRESERVED_KEYWORD, BARE_LABEL) @@ -310,7 +291,6 @@ PG_KEYWORD("off", OFF, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("offset", OFFSET, RESERVED_KEYWORD, AS_LABEL) PG_KEYWORD("oids", OIDS, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("old", OLD, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("omit", OMIT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("on", ON, RESERVED_KEYWORD, AS_LABEL) PG_KEYWORD("only", ONLY, RESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("operator", OPERATOR, UNRESERVED_KEYWORD, BARE_LABEL) @@ -335,9 +315,7 @@ PG_KEYWORD("partial", PARTIAL, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("partition", PARTITION, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("passing", PASSING, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("password", PASSWORD, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("path", PATH, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("placing", PLACING, RESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("plan", PLAN, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("plans", PLANS, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("policy", POLICY, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("position", POSITION, COL_NAME_KEYWORD, BARE_LABEL) @@ -355,7 +333,6 @@ PG_KEYWORD("procedures", PROCEDURES, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("program", PROGRAM, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("publication", PUBLICATION, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("quote", QUOTE, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("quotes", QUOTES, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("range", RANGE, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("read", READ, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("real", REAL, COL_NAME_KEYWORD, BARE_LABEL) @@ -390,7 +367,6 @@ PG_KEYWORD("row", ROW, COL_NAME_KEYWORD, BARE_LABEL) PG_KEYWORD("rows", ROWS, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("rule", RULE, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("savepoint", SAVEPOINT, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("scalar", SCALAR, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("schema", SCHEMA, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("schemas", SCHEMAS, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("scroll", SCROLL, UNRESERVED_KEYWORD, BARE_LABEL) @@ -426,7 +402,6 @@ PG_KEYWORD("stdout", STDOUT, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("storage", STORAGE, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("stored", STORED, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("strict", STRICT_P, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("string", STRING, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("strip", STRIP_P, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("subscription", SUBSCRIPTION, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("substring", SUBSTRING, COL_NAME_KEYWORD, BARE_LABEL) @@ -461,7 +436,6 @@ PG_KEYWORD("types", TYPES_P, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("uescape", UESCAPE, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("unbounded", UNBOUNDED, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("uncommitted", UNCOMMITTED, UNRESERVED_KEYWORD, BARE_LABEL) -PG_KEYWORD("unconditional", UNCONDITIONAL, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("unencrypted", UNENCRYPTED, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("union", UNION, RESERVED_KEYWORD, AS_LABEL) PG_KEYWORD("unique", UNIQUE, RESERVED_KEYWORD, BARE_LABEL) diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h index e86b0023922..2495c300348 100644 --- a/src/include/parser/parse_clause.h +++ b/src/include/parser/parse_clause.h @@ -51,7 +51,4 @@ extern List *addTargetToSortList(ParseState *pstate, TargetEntry *tle, extern Index assignSortGroupRef(TargetEntry *tle, List *tlist); extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList); -/* functions in parse_jsontable.c */ -extern ParseNamespaceItem *transformJsonTable(ParseState *pstate, JsonTable *jt); - #endif /* PARSE_CLAUSE_H */ diff --git a/src/include/utils/formatting.h b/src/include/utils/formatting.h index f048eb0869d..851e787bfdb 100644 --- a/src/include/utils/formatting.h +++ b/src/include/utils/formatting.h @@ -17,9 +17,6 @@ #ifndef _FORMATTING_H_ #define _FORMATTING_H_ -#define DCH_DATED 0x01 -#define DCH_TIMED 0x02 -#define DCH_ZONED 0x04 extern char *str_tolower(const char *buff, size_t nbytes, Oid collid); extern char *str_toupper(const char *buff, size_t nbytes, Oid collid); @@ -32,6 +29,5 @@ extern char *asc_initcap(const char *buff, size_t nbytes); extern Datum parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict, Oid *typid, int32 *typmod, int *tz, bool *have_error); -extern int datetime_format_flags(const char *fmt_str, bool *have_error); #endif diff --git a/src/include/utils/json.h b/src/include/utils/json.h index da4a9257b36..8a84a0cdb46 100644 --- a/src/include/utils/json.h +++ b/src/include/utils/json.h @@ -16,35 +16,9 @@ #include "lib/stringinfo.h" -typedef enum /* type categories for datum_to_json */ -{ - JSONTYPE_NULL, /* null, so we didn't bother to identify */ - JSONTYPE_BOOL, /* boolean (built-in types only) */ - JSONTYPE_NUMERIC, /* numeric (ditto) */ - JSONTYPE_DATE, /* we use special formatting for datetimes */ - JSONTYPE_TIMESTAMP, - JSONTYPE_TIMESTAMPTZ, - JSONTYPE_JSON, /* JSON itself (and JSONB) */ - JSONTYPE_ARRAY, /* array */ - JSONTYPE_COMPOSITE, /* composite */ - JSONTYPE_CAST, /* something with an explicit cast to JSON */ - JSONTYPE_OTHER /* all else */ -} JsonTypeCategory; - /* functions in json.c */ extern void escape_json(StringInfo buf, const char *str); extern char *JsonEncodeDateTime(char *buf, Datum value, Oid typid, const int *tzp); -extern bool to_json_is_immutable(Oid typoid); -extern void json_categorize_type(Oid typoid, JsonTypeCategory *tcategory, - Oid *outfuncoid); -extern Datum to_json_worker(Datum val, JsonTypeCategory tcategory, - Oid outfuncoid); -extern Datum json_build_object_worker(int nargs, Datum *args, bool *nulls, - Oid *types, bool absent_on_null, - bool unique_keys); -extern Datum json_build_array_worker(int nargs, Datum *args, bool *nulls, - Oid *types, bool absent_on_null); -extern bool json_validate(text *json, bool check_unique_keys, bool throw_error); #endif /* JSON_H */ diff --git a/src/include/utils/jsonb.h b/src/include/utils/jsonb.h index bae466b5234..4cbe6edf218 100644 --- a/src/include/utils/jsonb.h +++ b/src/include/utils/jsonb.h @@ -329,8 +329,6 @@ typedef struct JsonbParseState JsonbValue contVal; Size size; struct JsonbParseState *next; - bool unique_keys; /* Check object key uniqueness */ - bool skip_nulls; /* Skip null object fields */ } JsonbParseState; /* @@ -376,22 +374,6 @@ typedef struct JsonbIterator struct JsonbIterator *parent; } JsonbIterator; -/* unlike with json categories, we need to treat json and jsonb differently */ -typedef enum /* type categories for datum_to_jsonb */ -{ - JSONBTYPE_NULL, /* null, so we didn't bother to identify */ - JSONBTYPE_BOOL, /* boolean (built-in types only) */ - JSONBTYPE_NUMERIC, /* numeric (ditto) */ - JSONBTYPE_DATE, /* we use special formatting for datetimes */ - JSONBTYPE_TIMESTAMP, /* we use special formatting for timestamp */ - JSONBTYPE_TIMESTAMPTZ, /* ... and timestamptz */ - JSONBTYPE_JSON, /* JSON */ - JSONBTYPE_JSONB, /* JSONB */ - JSONBTYPE_ARRAY, /* array */ - JSONBTYPE_COMPOSITE, /* composite */ - JSONBTYPE_JSONCAST, /* something with an explicit cast to JSON */ - JSONBTYPE_OTHER /* all else */ -} JsonbTypeCategory; /* Support functions */ extern uint32 getJsonbOffset(const JsonbContainer *jc, int index); @@ -419,14 +401,10 @@ extern void JsonbHashScalarValueExtended(const JsonbValue *scalarVal, uint64 *hash, uint64 seed); /* jsonb.c support functions */ -extern Datum jsonb_from_text(text *js, bool unique_keys); extern char *JsonbToCString(StringInfo out, JsonbContainer *in, int estimated_len); extern char *JsonbToCStringIndent(StringInfo out, JsonbContainer *in, int estimated_len); -extern Jsonb *JsonbMakeEmptyArray(void); -extern Jsonb *JsonbMakeEmptyObject(void); -extern char *JsonbUnquote(Jsonb *jb); extern bool JsonbExtractScalar(JsonbContainer *jbc, JsonbValue *res); extern const char *JsonbTypeName(JsonbValue *jb); @@ -434,15 +412,4 @@ extern Datum jsonb_set_element(Jsonb *jb, Datum *path, int path_len, JsonbValue *newval); extern Datum jsonb_get_element(Jsonb *jb, Datum *path, int npath, bool *isnull, bool as_text); -extern bool to_jsonb_is_immutable(Oid typoid); -extern void jsonb_categorize_type(Oid typoid, JsonbTypeCategory *tcategory, - Oid *outfuncoid); -extern Datum to_jsonb_worker(Datum val, JsonbTypeCategory tcategory, - Oid outfuncoid); -extern Datum jsonb_build_object_worker(int nargs, Datum *args, bool *nulls, - Oid *types, bool absent_on_null, - bool unique_keys); -extern Datum jsonb_build_array_worker(int nargs, Datum *args, bool *nulls, - Oid *types, bool absent_on_null); - #endif /* __JSONB_H__ */ diff --git a/src/include/utils/jsonfuncs.h b/src/include/utils/jsonfuncs.h index 62dc3d88a42..865b2ff7c11 100644 --- a/src/include/utils/jsonfuncs.h +++ b/src/include/utils/jsonfuncs.h @@ -45,9 +45,6 @@ extern void pg_parse_json_or_ereport(JsonLexContext *lex, JsonSemAction *sem); /* report an error during json lexing or parsing */ extern void json_ereport_error(JsonParseErrorType error, JsonLexContext *lex); -/* get first JSON token */ -extern JsonTokenType json_get_first_token(text *json, bool throw_error); - extern uint32 parse_jsonb_index_flags(Jsonb *jb); extern void iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state, JsonIterateStringValuesAction action); @@ -58,8 +55,4 @@ extern Jsonb *transform_jsonb_string_values(Jsonb *jsonb, void *action_state, extern text *transform_json_string_values(text *json, void *action_state, JsonTransformStringValuesAction transform_action); -extern Datum json_populate_type(Datum json_val, Oid json_type, - Oid typid, int32 typmod, - void **cache, MemoryContext mcxt, bool *isnull); - #endif diff --git a/src/include/utils/jsonpath.h b/src/include/utils/jsonpath.h index 8e79b8dc9f0..cd0b5d5b61c 100644 --- a/src/include/utils/jsonpath.h +++ b/src/include/utils/jsonpath.h @@ -15,11 +15,8 @@ #define JSONPATH_H #include "fmgr.h" -#include "executor/tablefunc.h" #include "nodes/pg_list.h" -#include "nodes/primnodes.h" #include "utils/jsonb.h" -#include "utils/jsonfuncs.h" typedef struct { @@ -177,7 +174,6 @@ extern bool jspGetBool(JsonPathItem *v); extern char *jspGetString(JsonPathItem *v, int32 *len); extern bool jspGetArraySubscript(JsonPathItem *v, JsonPathItem *from, JsonPathItem *to, int i); -extern bool jspIsMutable(JsonPath *path, List *varnames, List *varexprs); extern const char *jspOperationName(JsonPathItemType type); @@ -252,37 +248,4 @@ extern JsonPathParseResult *parsejsonpath(const char *str, int len); extern int jspConvertRegexFlags(uint32 xflags); -/* - * Evaluation of jsonpath - */ - -/* External variable passed into jsonpath. */ -typedef struct JsonPathVariableEvalContext -{ - char *name; - Oid typid; - int32 typmod; - struct ExprContext *econtext; - struct ExprState *estate; - MemoryContext mcxt; /* memory context for cached value */ - Datum value; - bool isnull; - bool evaluated; -} JsonPathVariableEvalContext; - -/* SQL/JSON item */ -extern void JsonItemFromDatum(Datum val, Oid typid, int32 typmod, - JsonbValue *res); - -extern bool JsonPathExists(Datum jb, JsonPath *path, List *vars, bool *error); -extern Datum JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, - bool *empty, bool *error, List *vars); -extern JsonbValue *JsonPathValue(Datum jb, JsonPath *jp, bool *empty, - bool *error, List *vars); - -extern int EvalJsonPathVar(void *vars, char *varName, int varNameLen, - JsonbValue *val, JsonbValue *baseObject); - -extern PGDLLIMPORT const TableFuncRoutine JsonbTableRoutine; - #endif |