From: gtakahashi@palantir.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14010: Multi-valued Index-only scans do not properly handle nulls in search
Date: Wed, 09 Mar 2016 16:51:36 +0000
Message-ID: <20160309165136.8903.83559@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14010
Logged by: Glen Takahashi
Email address: gtakahashi@palantir.com
PostgreSQL version: 9.3.6
Operating system: Red Hat Enterprise Linux Server release 6.7
Description:
Example table:
a | b
---+--------
a | b
a | [NULL]
a | [NULL]
(repeated 100's of times)
b | a
select a,b from test_table where (a,b) > ('a','a') order by a,b;
returns:
a | b
---+---
a | b
b | a
(2 rows)
create index on test_table (a,b);
The same query now returns:
a | b
---+---
a | b
(1 row)
However, the query without using `order by` returns the right values!
select a,b from test where (a,b) > ('a','a');
a | b
---+---
a | b
b | a
(2 rows)
If there are sufficiently small enough number of nulls in between (I got
differing numbers from 100-200 depending on the table), the query will
instead use a Quicksort for what I can only assume is optimization to avoid
reading random pages, and will actually return the right value. I was able
to get this to reproduce 100% of the time when using > 256 nulls in between
('a','b') and ('b','a');
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: gtakahashi@palantir.com
Subject: Re: BUG #14010: Multi-valued Index-only scans do not properly handle nulls in search
In-Reply-To: <20160309165136.8903.83559@wrigleys.postgresql.org>
References: <20160309165136.8903.83559@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox