Typo in DATATYPE-JSONPATH

Started by PG Bug reporting formalmost 5 years ago3 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/13/datatype-json.html
Description:

Hello,

On the DATATYPE-JSONPATH page:
https://www.postgresql.org/docs/13/datatype-json.html#DATATYPE-JSONPATH

There is a line that shows that GIN indexes support `@@` and `@?` operators
for json matching, then there are two examples trying to show both
operators. However both examples use the `@@` operator.

Examples from the doc:

SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] ==
"qui"';
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] ? (@ ==
"qui")';

I think the second example should be using the `@?` operator so that both
sample queries do the same thing but with the different operator types. So
the second example should read:

SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ ==
"qui")';

Thank you,
Ben

#2Erik Rijkers
er@xs4all.nl
In reply to: PG Bug reporting form (#1)
Re: Typo in DATATYPE-JSONPATH

On 2021.04.15. 22:04 PG Doc comments form <noreply@postgresql.org> wrote:

Page: https://www.postgresql.org/docs/13/datatype-json.html
Description:

Hello,

On the DATATYPE-JSONPATH page:
https://www.postgresql.org/docs/13/datatype-json.html#DATATYPE-JSONPATH

There is a line that shows that GIN indexes support `@@` and `@?` operators
for json matching, then there are two examples trying to show both
operators. However both examples use the `@@` operator.

Examples from the doc:

SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] ==
"qui"';
SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] ? (@ ==
"qui")';

I think the second example should be using the `@?` operator so that both
sample queries do the same thing but with the different operator types. So
the second example should read:

SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ ==
"qui")';

Thank you,
Ben

FWIW, I agree with this and already sent a doc-patch [1]/messages/by-id/1219476687.20432.1617452918468@webmailclassic.xs4all.nl, which is be applied from 12, 13, and master.

Erik

[1]: /messages/by-id/1219476687.20432.1617452918468@webmailclassic.xs4all.nl

#3Michael Paquier
michael@paquier.xyz
In reply to: Erik Rijkers (#2)
Re: Typo in DATATYPE-JSONPATH

On Fri, Apr 16, 2021 at 08:11:53AM +0200, Erik Rijkers wrote:

FWIW, I agree with this and already sent a doc-patch [1], which is
be applied from 12, 13, and master.

Arf. I completely forgot about this thread but I marked it as
something to look at. Will do so now.
--
Michael