Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] different results based solely on existence of index(no, seriously)

From: David Fetter <david(at)fetter(dot)org>
To: Matthew Dennis <mdennis(at)merfer(dot)net>
Cc: PGSQL <pgsql-general(at)postgresql(dot)org>,PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: [GENERAL] different results based solely on existence of index(no, seriously)
Date: 2008-08-12 13:34:57
Message-ID: 20080812133457.GC15171@fetter.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-general
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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2008-08-12 14:56:38
Subject: Re: BUG #4350: 'select' acess given to views containing "union all" even though user has no grants
Previous:From: Lawrence CohanDate: 2008-08-12 13:25:25
Subject: Re: BUG #4351: Full text search performance

pgsql-general by date

Next:From: MuraliPD@GMailDate: 2008-08-12 13:56:31
Subject: Re: Need help returning record set from a dynamic sql query
Previous:From: MuraliPD@GMailDate: 2008-08-12 13:22:56
Subject: Re: Need help returning record set from a dynamic sql query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group