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

From Giovanni Biscuolo
Subject view does not show all records it should
Date
Msg-id 3A87F92F.49345962@libero.it
Whole thread Raw
Responses Re: view does not show all records it should  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: view does not show all records it should  ("Ross J. Reedstrom" <reedstrm@rice.edu>)
List pgsql-sql
I set up a simple database in wich all works well, exept
one *very* strange (to me) result.

Some time ago I created this views:

CREATE VIEW mag_scaricati_view ASSELECT s.id_carico, SUM(s.qta_scaricata) AS ScaricatiFROM   mag_scarico_tbl sGROUP BY
s.id_carico; 
 
CREATE VIEW mag_giacenza1_view ASSELECT c.ref AS "Ref.",       p.descrizione_breve AS Descrizione,       c.id_carico AS
"Schedadi carico",       c.qta_caricata AS "Caricati",       s.Scaricati,       (c.qta_caricata-s.Scaricati) AS
"Giacenza"FROM  mag_carico_tbl c, mag_scaricati_view s , prd_ref_tbl pWHERE  (c.id_carico = s.id_carico) AND
(c.ref= p.ref);
 

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):

SELECT c.ref AS "Ref.",      p.descrizione_breve AS Descrizione,      c.id_carico AS "Scheda di carico",
c.qta_caricataAS "Caricati",      s.Scaricati,      (c.qta_caricata-s.Scaricati) AS "Giacenza"
 
FROM   mag_carico_tbl c, mag_scaricati_view s , prd_ref_tbl p
WHERE  (c.id_carico = s.id_carico) AND      (c.ref = p.ref);
it shows me all the records.

Please, is there anybody who can help me, I can't even imagine what's
happening. :-(((

Ciao.
-- 
____________________________________
Giovanni Biscuolo
mailto:giovanni.biscuolo@libero.it



pgsql-sql by date:

Previous
From: "Kim Yunhan"
Date:
Subject: Index problem...
Next
From: palme@uni-wuppertal.de (Hubert Palme)
Date:
Subject: Re: parse error in create index