> On 2021.04.03. 14:01 Erik Rijkers <e...@xs4all.nl> wrote:
>  
> Hello,
> 
> Attached is a small but confusing mistake in the json documentation (a @@ 
> instead of @?) that has been there since version 12.  (It took me quite some 
> time to figure that out while testing with the recent SQL/JSON patches -- 
> which I initially blamed).
>  
> 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 was meant 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
--- doc/src/sgml/json.sgml.orig	2021-04-03 13:47:29.484510936 +0200
+++ doc/src/sgml/json.sgml	2021-04-03 13:47:53.028866752 +0200
@@ -489,7 +489,7 @@
 SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"';
 </programlisting>
 <programlisting>
-SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] ? (@ == "qui")';
+SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @? '$.tags[*] ? (@ == "qui")';
 </programlisting>
     GIN index extracts statements of following form out of
     <literal>jsonpath</literal>: <replaceable>accessors_chain</replaceable> = <replaceable>const</replaceable>.

Reply via email to