Re: Q: Escapes in jsonpath Idents
От | David E. Wheeler |
---|---|
Тема | Re: Q: Escapes in jsonpath Idents |
Дата | |
Msg-id | 9F84036F-007A-432D-8DCD-1D5C3F51F76E@justatheory.com обсуждение исходный текст |
Ответ на | Q: Escapes in jsonpath Idents ("David E. Wheeler" <david@justatheory.com>) |
Список | pgsql-hackers |
On Mar 16, 2024, at 14:39, David E. Wheeler <david@justatheory.com> wrote: > I went looking for the JavaScript rules for an identifier and found this in the MDN docs[2]: > >> In JavaScript, identifiers can contain Unicode letters, $, _, and digits (0-9), but may not start with a digit. An identifierdiffers from a string in that a string is data, while an identifier is part of the code. In JavaScript, there isno way to convert identifiers to strings, but sometimes it is possible to parse strings into identifiers. Coda: Dollar signs don’t work at all outside double-quoted string identifiers: david=# select '$.$foo'::jsonpath; ERROR: syntax error at or near "$foo" of jsonpath input LINE 1: select '$.$foo'::jsonpath; ^ david=# select '$.f$oo'::jsonpath; ERROR: syntax error at or near "$oo" of jsonpath input LINE 1: select '$.f$oo'::jsonpath; ^ david=# select '$."$foo"'::jsonpath; jsonpath ---------- $."$foo" This, too, contradicts the MDM definition an identifier (and some quick browser tests). Best, David
В списке pgsql-hackers по дате отправления: