Re: Wrong rows selected with view

From: Andreas Seltenreich <uwi7(at)rz(dot)uni-karlsruhe(dot)de>
To: Bill Moseley <moseley(at)hank(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Wrong rows selected with view
Date: 2005-11-16 14:42:19
Message-ID: 87irushcxg.fsf@gate450.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bill Moseley writes:

> PostgreSQL 7.4.8 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.0.2 20050816 (prerelease) (Debian 4.0.1-5)
>
> Hopefully this is something simple -- I assume it's a problem with my
> SQL. But it looks really weird to me at this late hour.
>
> I have some tables for managing workshops, and I have a view (below).
> I noticed for a given select it was returning the wrong number of
> rows. I expected seven rows back, but only got six.
>
> I rewrote the view with just the joins and it returned the correct number
> of rows. So I started the brute force method of removing one thing at
> a time in the view to see what would make it start returning the
> correct number of rows. That just confused me more.

How does the query plan change when you make those changes? If it only
occurs if a certain index is used, it might be corrupt (=> REINDEX).

regards,
Andreas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-11-16 14:47:54 Re: shouldn't postgres know the numer of rows in a (sorted) result-set before returning the first row?
Previous Message Thies C. Arntzen 2005-11-16 14:33:10 Re: shouldn't postgres know the numer of rows in a (sorted) result-set before returning the first row?