On Apr 24, 2024, at 05:51, Peter Eisentraut <[email protected]> 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 that this 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