Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-10 Thread Tom Lane
Michael Paquier writes: > On Thu, Nov 10, 2016 at 7:37 AM, Tom Lane wrote: >> 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

Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-10 Thread Nikita Glukhov
On 10.11.2016 09:54, Michael Paquier wrote: 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

Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-09 Thread Ali Akbar
2016-11-10 13:54 GMT+07:00 Michael Paquier : > On Thu, Nov 10, 2016 at 7:37 AM, Tom Lane wrote: > > 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 documen

Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-09 Thread Michael Paquier
On Thu, Nov 10, 2016 at 7:37 AM, Tom Lane wrote: > Michael Paquier writes: >> On Thu, Nov 10, 2016 at 3:27 AM, Robert Haas 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 s

Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-09 Thread Tom Lane
Michael Paquier writes: > On Thu, Nov 10, 2016 at 3:27 AM, Robert Haas 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

Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-09 Thread Michael Paquier
On Thu, Nov 10, 2016 at 3:27 AM, Robert Haas wrote: > On Tue, Nov 8, 2016 at 9:49 PM, Michael Paquier > wrote: >> On Wed, Nov 9, 2016 at 8:31 AM, Nikita Glukhov >> wrote: >>> Hi hackers. >>> >>> While working on jsonbstatistics, I found the following bug: >>> an empty jsonb array is considered

Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-09 Thread Robert Haas
On Tue, Nov 8, 2016 at 9:49 PM, Michael Paquier wrote: > On Wed, Nov 9, 2016 at 8:31 AM, Nikita Glukhov > wrote: >> Hi hackers. >> >> While working on jsonbstatistics, I found the following bug: >> an empty jsonb array is considered to be lesser than any scalar, >> but it is expected that object

Re: [HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-08 Thread Michael Paquier
On Wed, Nov 9, 2016 at 8:31 AM, Nikita Glukhov wrote: > Hi hackers. > > While working on jsonbstatistics, I found the following bug: > an empty jsonb array is considered to be lesser than any scalar, > but it is expected that objects > arrays > scalars. Sources? Does the JSON spec contain any inf

[HACKERS] Bug in comparison of empty jsonb arrays to scalars

2016-11-08 Thread Nikita Glukhov
Hi hackers. While working on jsonbstatistics, I found the following bug: an empty jsonb array is considered to be lesser than any scalar, but it is expected that objects > arrays > scalars. # select '[]'::jsonb < 'null'::jsonb; ?column? -- t (1 row) Attached patch contains: 1. bug fi