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


---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings

Reply via email to