Re: Bug in comparison of empty jsonb arrays to scalars - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Bug in comparison of empty jsonb arrays to scalars
Date
Msg-id CAB7nPqR_fzBDgyjKB092O9L5F8aYzUn4hgrF_K9axD45NOdcXA@mail.gmail.com
Whole thread Raw
In response to Bug in comparison of empty jsonb arrays to scalars  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
Responses Re: Bug in comparison of empty jsonb arrays to scalars  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, Nov 9, 2016 at 8:31 AM, Nikita Glukhov <n.gluhov@postgrespro.ru> 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 information regarding
comparison operators? I don't think so, so that would be up to the
implementation to decide that, no?

Btw I would agree with you that's quite unintuitive, but that's not
wrong either to keep the current comparison algorithm because that's
harmless for btree. We could have more regression tests to make the
current behavior clear though. Thoughts from others are welcome.
-- 
Michael



pgsql-hackers by date:

Previous
From: Hao Lee
Date:
Subject: Re: Do we need use more meaningful variables to replace 0 in catalog head files?
Next
From: Craig Ringer
Date:
Subject: Re: WIP: About CMake v2