Re: [GENERAL] replacing a view: bug or feature?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ed L(dot)" <pgsql(at)bluepolka(dot)net>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [GENERAL] replacing a view: bug or feature?
Date: 2004-12-12 06:27:46
Message-ID: 25431.1102832866@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

"Ed L." <pgsql(at)bluepolka(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-12-12 06:33:39 Re: Problems with information_schema
Previous Message Guy Rouillier 2004-12-12 04:40:42 Re: Best practice in postgres

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2004-12-12 08:37:48 Re: [Testperf-general] Re: 8.0beta5 results w/ dbt2
Previous Message Tom Lane 2004-12-12 06:13:13 Re: [Testperf-general] Re: 8.0beta5 results w/ dbt2