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 1oC9pA-0000cg-HR for pgsql-docs@arkaria.postgresql.org; Fri, 15 Jul 2022 01:08:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oC9p8-0005zK-Ey for pgsql-docs@arkaria.postgresql.org; Fri, 15 Jul 2022 01:08:54 +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 1oC9p7-0005zB-Vc for pgsql-docs@lists.postgresql.org; Fri, 15 Jul 2022 01:08:53 +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 1oC9p5-0006tI-Dn for pgsql-docs@lists.postgresql.org; Fri, 15 Jul 2022 01:08:52 +0000 Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1oC9p3-00Gdp4-V7; Thu, 14 Jul 2022 21:08:49 -0400 Date: Thu, 14 Jul 2022 21:08:49 -0400 From: Bruce Momjian To: frank_limpert@yahoo.com, pgsql-docs@lists.postgresql.org 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: multipart/mixed; boundary="jZ4RkoxPe8gfxy+x" Content-Disposition: inline In-Reply-To: <164441177106.9677.5991676148704507229@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --jZ4RkoxPe8gfxy+x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Feb 9, 2022 at 01:02:51PM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/14/sql-createtableas.html > Description: > > If I create a table with CREATE TABLE IF NOT EXISTS table_name AS, and the > table exists already, I get a NOTICE instead of an ERROR. > > I wanted to have it clarified explicitly that the data from the SELECT > statement is ignored in this case. Good point. Attached is a documentation patch to clarify this. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Indecision is a decision. Inaction is an action. Mark Batterson --jZ4RkoxPe8gfxy+x Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="exists.diff" diff --git a/doc/src/sgml/ref/create_table_as.sgml b/doc/src/sgml/ref/create_table_as.sgml index 07558ab56c..4d6a1e72d5 100644 --- a/doc/src/sgml/ref/create_table_as.sgml +++ b/doc/src/sgml/ref/create_table_as.sgml @@ -100,9 +100,9 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI IF NOT EXISTS - Do not throw an error if a relation with the same name already exists. - A notice is issued in this case. Refer to - for details. + Do not throw an error if a relation with the same name already + exists; simply issue a notice and leave the table unmodified. Refer + to for details. --jZ4RkoxPe8gfxy+x--