From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | Misa Simic <misa(dot)simic(at)gmail(dot)com> |
Cc: | PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Altering Views |
Date: | 2013-02-20 16:33:41 |
Message-ID: | 20130220163341.GA9625@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2013-02-20 17:25:41 +0100, Misa Simic wrote:
> Hi,
>
> If we want to "add new column" to the view - the only one way (we have
> found) is:
>
> -drop view
> -create it again ( with new column )
Since 8.4 you can add new columns to the end of a view definition using
CREATE OR REPLACE VIEW.
http://www.postgresql.org/docs/current/interactive/sql-createview.html :
> CREATE OR REPLACE VIEW is similar, but if a view of the same name
> already exists, it is replaced. 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), but
> it may add additional columns to the end of the list. The calculations
> giving rise to the output columns may be completely different.
Btw, this is more of a pgsql-general type of question...
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2013-02-20 16:47:03 | Re: PATCH: Split stats file per database WAS: autovacuum stress-testing our system |
Previous Message | Kevin Grittner | 2013-02-20 16:26:10 | Re: Materialized views WIP patch |