Views an non-present column

From: Fabien SK <fabsk(at)free(dot)fr>
To: pgsql-novice(at)postgresql(dot)org
Subject: Views an non-present column
Date: 2005-12-10 18:04:18
Message-ID: 1134237858.6696.15.camel@hobbes
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2005-12-10 18:52:39 Re: Views an non-present column
Previous Message Michael Fuhr 2005-12-10 03:12:24 Re: Sorting empty rows at the bottom of a recordset