Re: Problems modifyiong view - Mailing list pgsql-general

From stan
Subject Re: Problems modifyiong view
Date
Msg-id 20191114162646.GB20312@panix.com
Whole thread Raw
In response to Re: Problems modifyiong view  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Thu, Nov 14, 2019 at 06:31:48AM -0800, Adrian Klaver wrote:
> On 11/14/19 5:53 AM, stan wrote:
> > I am trying to add columns to a view using CREATE OR REPLACE VIEW, and I am
> > getting the following error:
> > 
> > ERROR:  cannot change name of view column "descrip" to "contact_person_1"
> > 
> > I suppose  I can drop the view, and recreate it, but that seems to indicate
> > that the create or replace functionality is not functioning the way I would
> > expect.
> > 
> > Am I missing something here?
> > 
> 
> https://www.postgresql.org/docs/11/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."


OK, so I see this is documented behavior. This makes it a "feature", not a
"bug" correct :-)

Thanks.
-- 
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
                        -- Benjamin Franklin



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Problems modifyiong view
Next
From: stan
Date:
Subject: Re: Problems modifyiong view