| From: | "Guy Rouillier" <guyr(at)masergy(dot)com> |
|---|---|
| To: | "PostgreSQL General" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Apparent anomaly with views and unions |
| Date: | 2005-02-12 00:19:49 |
| Message-ID: | CC1CF380F4D70844B01D45982E671B2348E5EF@mtxexch01.add0.masergy.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Parker | 2005-02-12 00:22:06 | Re: file descriptors |
| Previous Message | Palle Girgensohn | 2005-02-12 00:10:53 | Re: databases/p5-postgresql-plperl links to |