Re: [GENERAL] replacing a view: bug or feature? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [GENERAL] replacing a view: bug or feature?
Date
Msg-id 25431.1102832866@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
"Ed L." <pgsql@bluepolka.net> writes:
> CREATE TABLE foo ( "key" serial NOT NULL PRIMARY KEY, msg character(100));
> CREATE TABLE bar ( "key" serial NOT NULL PRIMARY KEY, msg character(100));
> CREATE VIEW baz AS SELECT * FROM foo UNION ALL SELECT * FROM bar;
> CREATE OR REPLACE VIEW baz AS SELECT * FROM foo;
> psql:foo.sql:6: ERROR:  cannot change data type of view column "msg"

The bottom-line issue here is that a UNION sets the typmod of its output
columns to -1, even when the inputs all share the same type OID and
typmod.  We changed that behavior some time ago for JOIN columns, and
probably ought to do the same for UNION columns.

I think this requires only a minor change in parser/analyze.c's
transformSetOperationStmt() ... any objections?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [Testperf-general] Re: 8.0beta5 results w/ dbt2
Next
From: Simon Riggs
Date:
Subject: Re: [Testperf-general] Re: 8.0beta5 results w/ dbt2