Problem with group by in conjuction with Views

From: Jeroen Eitjes <Eitjes(at)WalRas(dot)nl>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Problem with group by in conjuction with Views
Date: 2001-03-29 13:30:37
Message-ID: B1949C665239D4118BB300105AA566DE044314@WALRAS02
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi there,

I have found a small but annoying bug. I have created a view. The
SQL-statement in the view contains a GROUP BY statement. Then I compose a
SQL-statement using this view and another GROUP BY statement and a COUNT(*)
statement. The count(*) statement doesn't count the amount of grouped
record's of the view, but it count's the amount of grouped records of the
GROUP BY in the view and of the GROUP BY in the select statement. It counts
all the records grouped instead of only the records grouped from the view.
This is wrong (IMHO). When I use a temporary table instead of a view all
things work OK. IMHO views shouldn't differ from temporary tables.

To make things a bit more clear I have add an SQL-attachment. You can run
the attachment in an empty database form psql to have a look at the problem.

I sometimes get another <<database.sql>> error too while executing these
group statements: 'My bit's blew right of the end of the world'. (This is
when i am using an ODBC link to my db.)

Mighty thanks in advance,

Jeroen Eitjes
j.eitjes<nospam>@chem.leidenuniv.nl
eitjes<nospam>@walras.nl

Attachment Content-Type Size
database.sql application/octet-stream 4.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-03-29 13:32:36 Re: [ADMIN] Re: [HACKERS] Re: pgmonitor and Solaris
Previous Message Oliver Elphick 2001-03-29 13:29:38 Re: Re: Changing the default value of an inherited column