Bug in renaming view columns - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Bug in renaming view columns
Date
Msg-id 409F9658.7040806@familyhealth.com.au
Whole thread Raw
Responses Re: Bug in renaming view columns  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

Are we supposed to be able to rename view columns or not?  You can't if 
you replace the view, but you can if you rename the column.

test=# create view test as select 1 as a;
CREATE VIEW
test=# \d test      View "public.test" Column |  Type   | Modifiers
--------+---------+----------- a      | integer |
View definition: SELECT 1 AS a;

test=# create or replace view test as select 1 as b;
ERROR:  cannot change name of view column "a"
test=# alter table test rename a to b;
ALTER TABLE
test=# \d test      View "public.test" Column |  Type   | Modifiers
--------+---------+----------- b      | integer |
View definition: SELECT 1 AS b;

Chris



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: CLUSTER locking
Next
From: Gregory Stark
Date:
Subject: Linux 2.6.6 changes