Re: JSON path decimal literal syntax

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Nikita Glukhov <n.gluhov@postgrespro.ru>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-03-16T18:48:51Z
Lists: pgsql-hackers

Attachments

On 06.03.22 02:43, Nikita Glukhov wrote:
> Obviously, there are compatibility issues with expressions like
> '1.type()', which will start to require parentheses around numbers,
> but they seem to be useful only for our regression tests.
> 
> The corresponding changes in jsonpath_out() related to parentheses
> are missing in the v2 patch:
> 
> =# select '(1).a'::jsonpath;
>   jsonpath
> ----------
>   1."a"
> (1 row)
> 
> =# select '(1).a'::jsonpath::text::jsonpath;
> ERROR:  syntax error, unexpected STRING_P, expecting $end at or near """ of jsonpath input
> 
> 
> I have added in v3 enclosing of numbers in parentheses if they have
> successive path items. (Changed results of several test cases, one test
> case added.)

Thank you for these insights.  I have integrated this into my patch and 
updated the commit message to point out the change.

Commits

  1. Make JSON path numeric literals more correct