JSON: @@-operator

Started by PG Bug reporting formover 6 years ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/12/functions-json.html
Description:

'{"a":[1,2,3,4,5]}'::jsonb @@ '$.a[*] > 2' does not work;
'{"a":[1,2,3,4,5]}'::jsonb @@ '$.a[*] > 2'::jsonpath works as expected

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: JSON: @@-operator

PG Doc comments form <noreply@postgresql.org> writes:

The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/12/functions-json.html
Description:

'{"a":[1,2,3,4,5]}'::jsonb @@ '$.a[*] > 2' does not work;
'{"a":[1,2,3,4,5]}'::jsonb @@ '$.a[*] > 2'::jsonpath works as expected

They both work for me:

regression=# select '{"a":[1,2,3,4,5]}'::jsonb @@ '$.a[*] > 2';
?column?
----------
t
(1 row)

regression=# select '{"a":[1,2,3,4,5]}'::jsonb @@ '$.a[*] > 2'::jsonpath;
?column?
----------
t
(1 row)

The most likely explanation is that you have some non-built-in
"jsonb @@ something" operator in your installation. But you
did not say what "does not work" means, so I'm just guessing.

regards, tom lane