Re: Bug in comparison of empty jsonb arrays to scalars

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in comparison of empty jsonb arrays to scalars
Date: 2016-11-09 02:49:48
Message-ID: CAB7nPqR_fzBDgyjKB092O9L5F8aYzUn4hgrF_K9axD45NOdcXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 9, 2016 at 8:31 AM, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2016-11-09 02:52:48 Re: WIP: About CMake v2
Previous Message Hao Lee 2016-11-09 02:20:16 Re: Do we need use more meaningful variables to replace 0 in catalog head files?