ERROR: cannot change name of view column - Mailing list pgsql-bugs

From Réal A. Carbonneau
Subject ERROR: cannot change name of view column
Date
Msg-id CAJ-S0v57o6Ltgij0zBRnHLK2ustVsM7XinJJF8geJpamq-ortA@mail.gmail.com
Whole thread Raw
Responses Re: ERROR: cannot change name of view column  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Changing the name of any column in a view gives the error "ERROR: cannot change name of view column".  

The documentation is clear: "The new query must generate the same columns that were generated by the existing view query (that is, the same column names in the same order and with the same data types)" 

However, ALTER TABLE ... RENAME COLUMN will change the view column name (see Reference 2 above).

Thus, the original error message is not completely correct.  Ideally, the CREATE OR REPLACE VIEW would automatically apply the ALTER TABLE ... RENAME COLUMN (or underlying procedure) since it is available and fulfills the original DDL request, thus making the error message unnecessary.

Or at the very least, the error message could be changed to suggest using the ALTER TABLE ... RENAME COLUMN until the feature is included in the CREATE OR REPLACE VIEW.

PostgreSQL version 11.1

pgsql-bugs by date:

Previous
From: Phil Hildebrand
Date:
Subject: Re: BUG #15570: Vacuum analyze ERROR: MultiXactId XXXX has not beencreated yet -- apparent wraparound
Next
From: Tom Lane
Date:
Subject: Re: ERROR: cannot change name of view column