Re: view does not show all records it should - Mailing list pgsql-sql

From Tom Lane
Subject Re: view does not show all records it should
Date
Msg-id 18640.981993701@sss.pgh.pa.us
Whole thread Raw
In response to view does not show all records it should  (Giovanni Biscuolo <giovanni.biscuolo@libero.it>)
List pgsql-sql
Giovanni Biscuolo <giovanni.biscuolo@libero.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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: parse error in create index
Next
From: Michael Ansley
Date:
Subject: RE: plpgsql grief