Views an non-present column - Mailing list pgsql-novice

From Fabien SK
Subject Views an non-present column
Date
Msg-id 1134237858.6696.15.camel@hobbes
Whole thread Raw
Responses Re: Views an non-present column
List pgsql-novice
Hi everyone,

I am playing with Postgresql 8.0 (Mandriva 2006) and there is something
I don't understand. Let's assume that I have a table with some columns.
I create the following view:

CREATE VIEW vista as select name from mytable;

Then I check that everything is fine:

EXPLAIN select name from vista;

OK, I get a "Seq Scan on...".

but if I do:

EXPLAIN select mytable.name from vista;

I get an horrible:

 Nested Loop  (cost=17.70..9834.70 rows=490000 width=82)
   ->  Seq Scan on mytable  (cost=0.00..17.00 rows=700 width=0)
   ->  Materialize  (cost=17.70..24.70 rows=700 width=82)
         ->  Seq Scan on mytable  (cost=0.00..17.00 rows=700 width=82)


I also get the following notice:
NOTICE:  Ajout d'une entrée manquante dans FROM (table «mytable»)

Bad translation:
 adding an entry missing in the clause FROM (table «mytable»)

My question is: is there a way to prevent such a behaviour ? I would
like to get an error instead.

Cheers,
Fabien SK


pgsql-novice by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Sorting empty rows at the bottom of a recordset
Next
From: Bruno Wolff III
Date:
Subject: Re: Views an non-present column