1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

SQL/JSON: Prevent ON EMPTY for EXISTS columns in JSON_TABLE()

Due to an oversight in de3600452b, the ON EMPTY clause was
incorrectly allowed in the EXISTS column. Fix the grammar to prevent
this.

Discussion: https://postgr.es/m/CA%2BHiwqHh3YDXTpccgAo4CdfV9Mhy%2Bmg%3Doh6t8rfM5uLW1BJN4g%40mail.gmail.com
This commit is contained in:
Amit Langote
2024-06-28 13:59:13 +09:00
parent 0ad8153c1f
commit e3c1393efc
3 changed files with 11 additions and 3 deletions

View File

@@ -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;
}