public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: [email protected]
To: [email protected]
Subject: Re: CREATE TABLE AS, section  IF NOT EXISTS should clarify what happens to the data
Date: Thu, 14 Jul 2022 21:08:49 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

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  <[email protected]>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Indecision is a decision.  Inaction is an action.  Mark Batterson



Attachments:

  [text/x-diff] exists.diff (830B, 2-exists.diff)
  download | inline 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
     <term><literal>IF NOT EXISTS</literal></term>
     <listitem>
      <para>
-      Do not throw an error if a relation with the same name already exists.
-      A notice is issued in this case. Refer to <xref linkend="sql-createtable"/>
-      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 <xref linkend="sql-createtable"/> for details.
      </para>
     </listitem>
    </varlistentry>


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: CREATE TABLE AS, section  IF NOT EXISTS should clarify what happens to the data
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox