Re: Q: Escapes in jsonpath Idents - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Q: Escapes in jsonpath Idents
Date
Msg-id 8112fb7a-ebb3-4acc-be6c-32092c25683d@eisentraut.org
Whole thread Raw
In response to Re: Q: Escapes in jsonpath Idents  (Erik Wienhold <ewie@ewie.name>)
Responses Re: Q: Escapes in jsonpath Idents
List pgsql-hackers
On 18.03.24 01:09, Erik Wienhold wrote:
>>> The error message 'syntax error at or near "$oo" of jsonpath input' for
>>> the second case ($.f$oo), however, looks as if the scanner identifies
>>> '$oo' as a variable instead of contiuing the scan of identifier (f$oo)
>>> for the member accessor.  Looks like a bug to me because a variable
>>> doesn't even make sense in that place.
>> Right. Maybe the docs should be updated to say that a literal dollar
>> sign isn’t supported in identifiers, unlike in JavaScript, except
>> through escapes like this:
> Unfortunately, I don't have access to that part of the SQL spec.  So I
> don't know how the jsonpath grammar is specified.

The SQL spec says that <JSON path identifier> corresponds to Identifier 
in ECMAScript.

But it also says,

     A <JSON path identifier> is classified as follows.

     Case:

     a) A <JSON path identifier> that is a <dollar sign> is a <JSON path
        context variable>.

     b) A <JSON path identifier> that begins with <dollar sign> is a
        <JSON path named variable>.

     c) Otherwise, a <JSON path identifier> is a <JSON path key name>.

Does this help?  I wasn't following all the discussion to see if there 
is anything wrong with the implementation.




pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: Cleanup: remove unused fields from nodes
Next
From: Alexander Korotkov
Date:
Subject: Re: [PATCH] Improve amcheck to also check UNIQUE constraint in btree index.