Bug in comparison of empty jsonb arrays to scalars

From: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Bug in comparison of empty jsonb arrays to scalars
Date: 2016-11-08 23:31:46
Message-ID: 6ca2551e-95af-928a-a3d9-33f6e06d6b6f@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 fix (added the missing "else" in compareJsonbContainers())
2. regression test
3. pg_upgrade: invalidation of btree indexes on jsonb columns and
REINDEX-script generation

--
Nikita Glukhov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
fix_empty_jsonb_array_comparison_v01.patch text/x-patch 8.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2016-11-08 23:34:18 Re: SERIALIZABLE with parallel query
Previous Message Tom Lane 2016-11-08 23:18:01 Re: pg_dump, pg_dumpall and data durability