SQL/JSON: Validate values in ON ERROR/EMPTY clauses
Amit Langote <amitlan@postgresql.org>
SQL/JSON: Validate values in ON ERROR/EMPTY clauses Currently, the grammar allows any supported values in the ON ERROR and ON EMPTY clauses for SQL/JSON functions, regardless of whether the values are appropriate for the function. This commit ensures that during parse analysis, the provided value is checked for validity for the given function and throws a syntax error if it is not. While at it, this fixes some omissions in the documentation of the ON ERROR/EMPTY clauses for JSON_TABLE(). Reported-by: Jian He <jian.universality@gmail.com> Reviewed-by: Jian He <jian.universality@gmail.com> Discussion: https://postgr.es/m/CACJufxFgWGqpESSYzyJ6tSurr3vFYBSNEmCfkGyB_dMdptFnZQ%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +3 −3 |
| src/backend/parser/parse_expr.c | modified | +118 −8 |
| src/backend/parser/parse_jsontable.c | modified | +1 −1 |
| src/test/regress/expected/sqljson_jsontable.out | modified | +24 −2 |
| src/test/regress/expected/sqljson_queryfuncs.out | modified | +16 −0 |
| src/test/regress/sql/sqljson_jsontable.sql | modified | +7 −0 |
| src/test/regress/sql/sqljson_queryfuncs.sql | modified | +5 −0 |
Documentation touched
Discussion
- SQL/JSON query functions context_item doc entry and type requirement 15 messages · 2024-06-03 → 2024-06-28