Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVHxO-0000Kz-7s for pgsql-general@arkaria.postgresql.org; Thu, 14 Nov 2019 16:26:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVHxN-0005P3-12 for pgsql-general@arkaria.postgresql.org; Thu, 14 Nov 2019 16:26:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVHxM-0005Li-Ma for pgsql-general@lists.postgresql.org; Thu, 14 Nov 2019 16:26:52 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVHxJ-0004Jt-0d for pgsql-general@lists.postgresql.org; Thu, 14 Nov 2019 16:26:52 +0000 Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 47DRh64H9yz1R9R; Thu, 14 Nov 2019 11:26:46 -0500 (EST) Received: by panix2.panix.com (Postfix, from userid 17622) id 47DRh63HQ2z1ZVj; Thu, 14 Nov 2019 11:26:46 -0500 (EST) Date: Thu, 14 Nov 2019 11:26:46 -0500 From: stan To: Adrian Klaver Cc: pgsql-general@lists.postgresql.org Subject: Re: Problems modifyiong view Message-ID: <20191114162646.GB20312@panix.com> References: <20191114135356.GA14970@panix.com> <6bf84c77-0587-889a-2022-afd9ca9a2b4d@aklaver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6bf84c77-0587-889a-2022-afd9ca9a2b4d@aklaver.com> X-Editor: gVim User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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