Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oMW7d-00082i-51 for pgsql-docs@arkaria.postgresql.org; Fri, 12 Aug 2022 14:58:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oMW7b-0000eA-S7 for pgsql-docs@arkaria.postgresql.org; Fri, 12 Aug 2022 14:58:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oMW7b-0000e1-KW for pgsql-docs@lists.postgresql.org; Fri, 12 Aug 2022 14:58:47 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oMW7U-000863-Vt for pgsql-docs@lists.postgresql.org; Fri, 12 Aug 2022 14:58:46 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1oMW7R-00EQuR-3b; Fri, 12 Aug 2022 10:58:37 -0400 Date: Fri, 12 Aug 2022 10:58:37 -0400 From: Bruce Momjian To: "David G. Johnston" Cc: frank_limpert@yahoo.com, Pg Docs Subject: Re: CREATE TABLE AS, section IF NOT EXISTS should clarify what happens to the data Message-ID: References: <164441177106.9677.5991676148704507229@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jul 18, 2022 at 03:43:03PM -0400, Bruce Momjian wrote: > fOn Thu, Jul 14, 2022 at 06:47:19PM -0700, David G. Johnston wrote: > > Not only is the existing table not modified, I think that the select query > > portion of the command is never even executed.  That would seem to be useful > > knowledge to have. > > > > Maybe something like: > > > > > >  Do not throw an error if a relation with the same name already exists. > >  A notice is issued in this case. > >  If WITH DATA is specified (the default) the execution of > > the parsed query does not happen, leaving the existing table with its existing > > contents. > > > > I tried to go in that direction, but couldn't clearly name the > SELECT/VALUES part of the CREATE TABLE AS query because CREATE TABLE > AS is also a query. I felt trying to say we ran the CREATE TABLE AS > query but not the SELECT/VALUES of the query was just too confusing. I > used "simply issue a notice" as implying that nothing else happens, > which I considered sufficient. > > > > I've removed the xref to create table as there is nothing additional there of > > material benefit - the sentence: > > Okay, removed. Updated patch attached. Patch applied back to PG 10. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson