diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/parser/gram.y | 6 | ||||
-rw-r--r-- | src/test/regress/expected/sqljson_jsontable.out | 5 | ||||
-rw-r--r-- | src/test/regress/sql/sqljson_jsontable.sql | 3 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 4a4b47ca501..a043fd4c669 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -14265,7 +14265,7 @@ json_table_column_definition: } | ColId Typename EXISTS json_table_column_path_clause_opt - json_behavior_clause_opt + json_on_error_clause_opt { JsonTableColumn *n = makeNode(JsonTableColumn); @@ -14276,8 +14276,8 @@ json_table_column_definition: n->wrapper = JSW_NONE; n->quotes = JS_QUOTES_UNSPEC; n->pathspec = (JsonTablePathSpec *) $4; - n->on_empty = (JsonBehavior *) linitial($5); - n->on_error = (JsonBehavior *) lsecond($5); + n->on_empty = NULL; + n->on_error = (JsonBehavior *) $5; n->location = @1; $$ = (Node *) n; } diff --git a/src/test/regress/expected/sqljson_jsontable.out b/src/test/regress/expected/sqljson_jsontable.out index cee90cead13..73039ea65eb 100644 --- a/src/test/regress/expected/sqljson_jsontable.out +++ b/src/test/regress/expected/sqljson_jsontable.out @@ -1067,3 +1067,8 @@ CREATE OR REPLACE VIEW public.jsonb_table_view7 AS ) sub DROP VIEW jsonb_table_view7; DROP TABLE s; +-- Prevent ON EMPTY specification on EXISTS columns +SELECT * FROM JSON_TABLE(jsonb '1', '$' COLUMNS (a int exists empty object on empty)); +ERROR: syntax error at or near "empty" +LINE 1: ...sonb '1', '$' COLUMNS (a int exists empty object on empty)); + ^ diff --git a/src/test/regress/sql/sqljson_jsontable.sql b/src/test/regress/sql/sqljson_jsontable.sql index a1f924146e0..bda57981481 100644 --- a/src/test/regress/sql/sqljson_jsontable.sql +++ b/src/test/regress/sql/sqljson_jsontable.sql @@ -518,3 +518,6 @@ SELECT sub.* FROM s, \sv jsonb_table_view7 DROP VIEW jsonb_table_view7; DROP TABLE s; + +-- Prevent ON EMPTY specification on EXISTS columns +SELECT * FROM JSON_TABLE(jsonb '1', '$' COLUMNS (a int exists empty object on empty)); |