Re: Q: Escapes in jsonpath Idents

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: Q: Escapes in jsonpath Idents
Дата
Msg-id 6D3DD5E4-61B8-4E5D-8B29-50A1C0E6BBE5@justatheory.com
обсуждение исходный текст
Ответ на Re: Q: Escapes in jsonpath Idents  (Peter Eisentraut <peter@eisentraut.org>)
Ответы Re: Q: Escapes in jsonpath Idents  (Erik Wienhold <ewie@ewie.name>)
Список pgsql-hackers
On Apr 24, 2024, at 05:51, Peter Eisentraut <peter@eisentraut.org> wrote:

>    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.

Yes, it does, as it ties the special meaning of the dollar sign to the *beginning* of an expression. So it makes sense
thatthis would be an error: 

david=# select '$.$foo'::jsonpath;
ERROR: syntax error at or near "$foo" of jsonpath input
LINE 1: select '$.$foo'::jsonpath;
               ^

But I’m less sure when a dollar sign is used in the *middle* (or end) of a json path identifier:

david=# select '$.xx$foo'::jsonpath;
ERROR:  syntax error at or near "$foo" of jsonpath input
LINE 1: select '$.xx$foo'::jsonpath;
               ^

Perhaps that should be valid?

Best,

David




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Daniel Gustafsson
Дата:
Сообщение: Re: Cutting support for OpenSSL 1.0.1 and 1.0.2 in 17~?
Следующее
От: "David E. Wheeler"
Дата:
Сообщение: Re: Q: Escapes in jsonpath Idents