Re: view does not show all records it should

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Giovanni Biscuolo <giovanni(dot)biscuolo(at)libero(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: view does not show all records it should
Date: 2001-02-12 16:01:41
Message-ID: 18640.981993701@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Giovanni Biscuolo <giovanni(dot)biscuolo(at)libero(dot)it> writes:
> CREATE VIEW mag_scaricati_view AS
> SELECT s.id_carico, SUM(s.qta_scaricata) AS Scaricati
> FROM mag_scarico_tbl s
> GROUP BY s.id_carico;

Grouped views don't work very well in versions before 7.1, though I'm
not sure if that is the issue here or not. (What PG version are you
using, anyway?)

> Now, when I issue the following command:
> SELECT * FROM mag_giacenza1_view
> it shows me the records that was in the database the day
> I created the view, _not all the records in the database_.
> If I select "by hand" with the following statament (please
> note it is the very same with which I created the view):
> it shows me all the records.

That's fairly hard to believe, unless you ran the query using the view
inside a transaction that had been open the whole time. I suspect that
you have misinterpreted the behavior, and that the real problem is not
related to when the records were inserted. Can you show us exactly what
you're getting from each query?

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fork 2001-02-12 16:05:35 Re: Wierd postgres Problem
Previous Message Michael Ansley 2001-02-12 15:57:03 RE: plpgsql grief