JSON/SQL: jsonpath: incomprehensible error message

From: Erik Rijkers <er(at)xs4all(dot)nl>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: JSON/SQL: jsonpath: incomprehensible error message
Date: 2022-06-26 15:44:22
Message-ID: ba069ce2-a98f-dc70-dc17-2ccf2a9bf7c7@xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-06-26 15:55:32 Re: Add LZ4 compression in pg_dump
Previous Message Tom Lane 2022-06-26 13:06:11 Re: Core dump in range_table_mutator()