pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14010: Multi-valued Index-only scans do not properly handle nulls in search
4+ messages / 3 participants
[nested] [flat]
* BUG #14010: Multi-valued Index-only scans do not properly handle nulls in search
@ 2016-03-09 16:51 gtakahashi@palantir.com
0 siblings, 1 reply; 4+ messages in thread
From: gtakahashi@palantir.com @ 2016-03-09 16:51 UTC (permalink / raw)
To: pgsql-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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14010: Multi-valued Index-only scans do not properly handle nulls in search
@ 2016-03-09 19:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: gtakahashi@palantir.com
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2016-03-09 19:00 UTC (permalink / raw)
To: gtakahashi@palantir.com; +Cc: pgsql-bugs
gtakahashi@palantir.com writes:
> 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)
Ugh. This bug just passed its tenth birthday ... kind of astonishing
that nobody found it before. Will fix, thanks for the report!
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14010: Multi-valued Index-only scans do not properly handle nulls in search
@ 2016-03-09 19:51 Glen Takahashi <gtakahashi@palantir.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Glen Takahashi @ 2016-03-09 19:51 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
Is the fix for this one easy to apply? Would it be feasible for me to
backport and bring into PostgreSQL 9.3.6?
__________________________________________
Glen Takahashi | Palantir Technologies | gtakahashi@palantir.com |
1.408.338.5065
On 3/9/16, 2:00 PM, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:
>gtakahashi@palantir.com writes:
>> 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)
>
>Ugh. This bug just passed its tenth birthday ... kind of astonishing
>that nobody found it before. Will fix, thanks for the report!
>
> regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #14010: Multi-valued Index-only scans do not properly handle nulls in search
@ 2016-03-09 19:58 Tom Lane <tgl@sss.pgh.pa.us>
parent: Glen Takahashi <gtakahashi@palantir.com>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2016-03-09 19:58 UTC (permalink / raw)
To: Glen Takahashi <gtakahashi@palantir.com>; +Cc: pgsql-bugs
Glen Takahashi <gtakahashi@palantir.com> writes:
> Is the fix for this one easy to apply? Would it be feasible for me to
> backport and bring into PostgreSQL 9.3.6?
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=1ab7a160f9d983ba738022c0b4dc62a678...
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2016-03-09 19:58 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 16:51 BUG #14010: Multi-valued Index-only scans do not properly handle nulls in search gtakahashi@palantir.com
2016-03-09 19:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-03-09 19:51 ` Glen Takahashi <gtakahashi@palantir.com>
2016-03-09 19:58 ` Tom Lane <tgl@sss.pgh.pa.us>
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