From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Bug in comparison of empty jsonb arrays to scalars |
Date: | 2016-11-10 06:54:58 |
Message-ID: | CAB7nPqSLmLi+VS7XHHRfs_2e=-viSVW4m=nZm1nMiz-qjOteoA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Nov 10, 2016 at 7:37 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>> On Thu, Nov 10, 2016 at 3:27 AM, Robert Haas <robertmhaas(at)gmail(dot)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
Attachment | Content-Type | Size |
---|---|---|
json-ordering.patch | text/plain | 917 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2016-11-10 07:17:18 | Re: Unlogged tables cleanup |
Previous Message | Haribabu Kommi | 2016-11-10 06:42:17 | Re: macaddr 64 bit (EUI-64) datatype support |