Re: Incorrect Sort Using Index Scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "McGehee, Robert" <Robert(dot)McGehee(at)geodecapital(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Incorrect Sort Using Index Scan
Date: 2012-09-18 05:17:52
Message-ID: 4924.1347945472@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"McGehee, Robert" <Robert(dot)McGehee(at)geodecapital(dot)com> writes:
> I have recently upgraded to PostgreSQL 9.2.0 and one of my queries is now giving incorrectly sorted results due, I believe, to the new index-only scan in 9.2.0. The below table is a table of currency FX rates by date.

Hmm, no it's not about index-only scans (your query isn't even using
one). I think this got broken in my commit
9e8da0f75731aaa7605cf4656c21ea09e84d2eb1, which turned =ANY into a
native index qualification type for btree. I thought that the output
could still be considered sorted by the index's sort order, but this
example proves that that's not so. Need to think a bit more carefully
about that --- maybe we can only assume sorted output when the =ANY qual
is for the first index column. Or maybe we can't assume it at all.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message lalbin 2012-09-18 06:16:03 BUG #7553: Un-executable view definitions in pg_catalog.pg_views in versions 8.3.x-9.2.0
Previous Message Andrei Tchijov 2012-09-18 04:51:08 Re: BUG #7552: where clause gets ignored on one of view fields