On Thu, Nov 10, 2016 at 7:37 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Michael Paquier <michael.paqu...@gmail.com> writes:
>> On Thu, Nov 10, 2016 at 3:27 AM, Robert Haas <robertmh...@gmail.com> wrote:
>>> https://www.postgresql.org/docs/current/static/datatype-json.html
>
>> Indeed, I missed that. So that's broken...
>
> Given that nobody actually cares what that sort order is, I think that
> having to jump through hoops in pg_upgrade in order to fix it is not a
> great tradeoff.  I suggest changing the documentation to match the code.

Yes, definitely.
=# create table json_data (a jsonb);
CREATE TABLE
=# INSERT INTO json_data values ('{}'::jsonb), ('[]'::jsonb),
('null'::jsonb), ('true'::jsonb), ('1'::jsonb), ('""'::jsonb);
INSERT 0 6
=# SELECT * FROM json_data ORDER BY 1 DESC;
  a
------
 {}
 true
 1
 ""
 null
 []
(6 rows)
So that's object > boolean > integer > string > NULL > array.

And attached is a patch.
-- 
Michael
diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml
index 3cf78d6..b2688ff 100644
--- a/doc/src/sgml/json.sgml
+++ b/doc/src/sgml/json.sgml
@@ -542,7 +542,7 @@ SELECT jdoc-&gt;'guid', jdoc-&gt;'name' FROM api WHERE jdoc 
@&gt; '{"tags": ["qu
     The <literal>btree</> ordering for <type>jsonb</> datums is seldom
     of great interest, but for completeness it is:
 <synopsis>
-<replaceable>Object</replaceable> > <replaceable>Array</replaceable> > 
<replaceable>Boolean</replaceable> > <replaceable>Number</replaceable> > 
<replaceable>String</replaceable> > <replaceable>Null</replaceable>
+<replaceable>Object</replaceable> > <replaceable>Boolean</replaceable> > 
<replaceable>Number</replaceable> > <replaceable>String</replaceable> > 
<replaceable>Null</replaceable> > <replaceable>Array</replaceable>
 
 <replaceable>Object with n pairs</replaceable> > <replaceable>object with n - 
1 pairs</replaceable>
 
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to