Apparent anomaly with views and unions

Поиск
Список
Период
Сортировка
От Guy Rouillier
Тема Apparent anomaly with views and unions
Дата
Msg-id CC1CF380F4D70844B01D45982E671B2348E5EF@mtxexch01.add0.masergy.com
обсуждение исходный текст
Ответы Re: Apparent anomaly with views and unions  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
I using 8.0.1.  I create 3 tables with these definitions:

create table t1 (serv_id varchar(50) not null);
create table t2 (serv_id varchar(50) not null);
create table t3 (serv_id varchar(50) not null);

Now I create a view like this:

create or replace view v1 as select * from t1;

Next, I attempt to update this view like this:
create or replace view v1 as select * from t1 union select * from t2;

I receive: ERROR:  cannot change data type of view column "serv_id"

Next, I drop view v1 and recreate it using the union above.  I am now
able to do the following without error:

create or replace view v1 as select * from t1 union select * from t2
union select * from t3;

So it looks like changing a view from a non-union to a union is
producing an error, but changing a view that  already contains a 2-way
union to one that contains a 3-way union is allowed (and I'm assuming
any n to n+1 union transition is also allowed.)

Is this intentional?  It was certainly not predictable.

--
Guy Rouillier


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

Предыдущее
От: Sven Willenberger
Дата:
Сообщение: Re: databases/p5-postgresql-plperl links to wrong
Следующее
От: "David Parker"
Дата:
Сообщение: Re: file descriptors