On Mon, Aug 11, 2008 at 10:35:26PM -0500, Matthew Dennis wrote: > In reference to the script below (I know it can be rewritten, that's > not the point), I get 3 rows if the referenced index exists but only > two rows if it does not. This is observable and repeatable just by > dropping/creating the index. Drop the index and two rows are > returned. Create the index, three rows are returned. Drop the > index, two rows again. In addition, in no case does the selected > column t2.c2 actually contain a value (it's always null). Since in > the 3 row case, it returns a row with t1.c1=2, I would have expected > a value from t2 (if you add t2.c1 to select clause you can see that > is null as well). > > It's probably worth mentioning (since it actually took me a while to > notice) that the plans are subtlety different. Neither plan (with > or without index existing) actually uses the index, but in one case > there is an extra filter node. > > version string is PostgreSQL 8.3.1 on i686-redhat-linux-gnu, > compiled by GCC gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33) I have reproduced it on 8.3.3. Just FYI, a bug isn't a bug unless you can reproduce it on the latest minor version, in this case 8.3.3, of the major version, in this case 8.3, that the bug appears in. Cheers, David. -- David Fetter <david@xxxxxxxxxx> http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@xxxxxxxxx Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate