On Mar 16, 2024, at 14:39, David E. Wheeler <[email protected]> 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 identifier differs from a string
>> in that a string is data, while an identifier is part of the code. In
>> JavaScript, there is no 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