Re: Views an non-present column

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Views an non-present column
Дата
Msg-id 20051210185239.GC25744@wolff.to
обсуждение исходный текст
Ответ на Views an non-present column  (Fabien SK <fabsk@free.fr>)
Ответы Re: Views an non-present column  (Fabien SK <fabsk@free.fr>)
Список pgsql-novice
On Sat, Dec 10, 2005 at 19:04:18 +0100,
  Fabien SK <fabsk@free.fr> wrote:
> 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.

It depends on which version of postgres you are using. In 8.1 its off by
default. My memory is that the option to turn it off was first put in 8.0.
You can use SET ADD_MISSING_FROM = OFF to disable this.

В списке pgsql-novice по дате отправления:

Предыдущее
От: Fabien SK
Дата:
Сообщение: Views an non-present column
Следующее
От: Fabien SK
Дата:
Сообщение: Re: Views an non-present column