Partial index causing wrong results to be returned on 8.1.3

From: Greg Sabino Mullane <greg(at)turnstep(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Partial index causing wrong results to be returned on 8.1.3
Date: 2006-08-29 04:05:37
Message-ID: 1156824337.4526.12.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I could not duplicate this on any identical database, but thought I
would report it here, just for completeness. I've tried reindexing,
vacuuming, etc. Explain plans all look normal.

Version is 8.1.3
\d bigtable
...
"bigtable_status_partial" btree (status) WHERE status::text <>
'shipped'::text


greg=> select (select count(*) from bigtable where status = 'shipped')
+ (select count(*) from bigtable where status <> 'shipped')
UNION select count(*) from bigtable;
?column?
----------
1185213
1600569

greg=> drop index bigtable_status_partial;

greg=> select (select count(*) from bigtable where status = 'shipped')
+ (select count(*) from bigtable where status <> 'shipped')
UNION select count(*) from bigtable;
?column?
----------
1185213
(1 row)

--
Greg Sabino Mullane greg(at)turnstep(dot)com
End Point Corporation
PGP Key: 0x14964AC8 200608290003
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-08-29 04:20:14 Re: Partial index causing wrong results to be returned on 8.1.3
Previous Message Gin Indexes cause server to crash on Windows 2006-08-28 23:33:09 BUG #2595: Gin Indexes cause server to crash on Windows