mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-20 21:37:11 +08:00
SQL/JSON: Improve some error messages
This improves some error messages emitted by SQL/JSON query functions by mentioning column name when available, such as when they are invoked as part of evaluating JSON_TABLE() columns. To do so, a new field column_name is added to both JsonFuncExpr and JsonExpr that is only populated when creating those nodes for transformed JSON_TABLE() columns. While at it, relevant error messages are reworded for clarity. Reported-by: Jian He <jian.universality@gmail.com> Suggested-by: Jian He <jian.universality@gmail.com> Discussion: https://postgr.es/m/CACJufxG_e0QLCgaELrr2ZNz7AxPeGCNKAORe3fHtFCQLsH4J4Q@mail.gmail.com
This commit is contained in:
@ -290,6 +290,9 @@ FROM JSON_TABLE(
|
||||
-- Should fail (not supported)
|
||||
SELECT * FROM JSON_TABLE(jsonb '{"a": 123}', '$' || '.' || 'a' COLUMNS (foo int));
|
||||
|
||||
-- JsonPathQuery() error message mentioning column name
|
||||
SELECT * FROM JSON_TABLE('{"a": [{"b": "1"}, {"b": "2"}]}', '$' COLUMNS (b json path '$.a[*].b' ERROR ON ERROR));
|
||||
|
||||
-- JSON_TABLE: nested paths
|
||||
|
||||
-- Duplicate path names
|
||||
|
||||
Reference in New Issue
Block a user