Re: CREATE TABLE AS, section IF NOT EXISTS should clarify what happens to the data

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: frank_limpert(at)yahoo(dot)com, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: CREATE TABLE AS, section IF NOT EXISTS should clarify what happens to the data
Date: 2022-08-12 14:58:37
Message-ID: YvZqnezQgSqZqJnH@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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:
> >
> > <para>
> >  Do not throw an error if a relation with the same name already exists.
> >  A notice is issued in this case.
> >  If <literal>WITH DATA</literal> is specified (the default) the execution of
> > the parsed query does not happen, leaving the existing table with its existing
> > contents.
> > </para>
>
> 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 <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

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

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2022-08-12 15:26:05 Re: CREATE INDEX USING documentation
Previous Message PG Doc comments form 2022-08-09 20:33:11 "22.3. Template Databases" documentation is incomplete