Re: fix old confusing JSON example - Mailing list pgsql-hackers

From Erik Rijkers
Subject Re: fix old confusing JSON example
Date
Msg-id 1219476687.20432.1617452918468@webmailclassic.xs4all.nl
Whole thread Raw
Responses Re: fix old confusing JSON example  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
> On 2021.04.03. 14:01 Erik Rijkers <er@xs4all.nl> wrote:
>  
> Hello,
> 
> Attached is a small but confusing mistake in the json documentation (a @@ instead of @?) that has been there since
version12.  (It took me quite some time to figure that out while testing with the recent SQL/JSON patches -- which I
initiallyblamed).
 
>  
> To be applied from 12, 13, and master.

Oops, sent to wrong list.

Let me add some arguments for the change:

The original text is:
--------------------------
Also, GIN index supports @@ and @? operators, which perform jsonpath matching.

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

--------------------------
So, that gives information on two operators, and then gives one example query for each.  Clearly, the second example
wasmeant to illustrate a where-clause with the  @?  operator.
 

Small change to prevent great confusion (I'll admit it took me far too long to understand this).

thanks,

Erik Rijkers




















> 
> Thanks,
> 
> Erik Rijkers
Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Refactoring HMAC in the core code
Next
From: Michael Paquier
Date:
Subject: Re: Proposal: Save user's original authenticated identity for logging