JSON/SQL: jsonpath: incomprehensible error message
Erik Rijkers <er@xs4all.nl>
From: Erik Rijkers <er@xs4all.nl>
To: pgsql-hackers@lists.postgresql.org
Date: 2022-06-26T15:44:22Z
Lists: pgsql-hackers
JSON/SQL jsonpath
For example, a jsonpath string with deliberate typo 'like_regexp'
(instead of 'like_regex'):
select js
from (values (jsonb '{}')) as f(js)
where js @? '$ ? (@ like_regexp "^xxx")';
ERROR: syntax error, unexpected IDENT_P at or near " " of jsonpath input
LINE 1: ...s from (values (jsonb '{}')) as f(js) where js @? '$ ? (@ li...
^
Both 'IDENT_P' and 'at or near " "' seem pretty useless.
Perhaps some improvement can be thought of?
Similar messages in release 14 seem to use 'invalid token', which is better:
select js
from (values (jsonb '{"a":"b"}')) as f(js)
where js @? '$ ? (@.a .= "b")';
ERROR: syntax error, unexpected invalid token at or near "=" of
jsonpath input
thanks,
Erik Rijkers
Commits
-
Remove %error-verbose directive from jsonpath parser
- 7d9bf589ba84 15.0 landed
- 2cf875a4b58d 12.12 landed
- 03cefe81484d 13.8 landed
- 7fd43684fc9e 14.5 landed
- 89a39d4a4da0 16.0 landed
-
Partial implementation of SQL/JSON path language
- 72b6460336e8 12.0 cited