Re: CREATE TABLE AS does not support IF NOT EXISTS?

From: David Waddy <david(at)littleriver(dot)ca>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: CREATE TABLE AS does not support IF NOT EXISTS?
Date: 2012-02-12 20:00:09
Message-ID: CAD3FPx83vj1hOWv49E-PMJZWtOsLBWqDqtV8sKvFn3e6DrN8BA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank-you, mystery solved! I was reading the "CREATE TABLE" docs and not
the "CREATE TABLE AS" docs. My mistake.

David Waddy

On Sun, Feb 12, 2012 at 3:50 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>wrote:

> On Sunday, February 12, 2012 11:42:37 am David Waddy wrote:
> > This works:
> > CREATE TEMP TABLE temp_medical_summary AS (SELECT * from
> > bov.medical_summary)
> >
> > This gives an error:
> > CREATE TEMP TABLE IF NOT EXISTS temp_medical_summary AS (SELECT * from
> > bov.medical_summary)
> >
> > It would seem that CREATE TABLE AS does not support IF NOT EXISTS. Is
> this
> > true?
>
> FYI the Postgres version would be helpful, as syntax support changes over
> versions:)
>
> In any case the most recent production version docs show IF NOT EXISTS is
> not
> supported:
> http://www.postgresql.org/docs/9.1/interactive/sql-createtableas.html
>
> >
> > David Waddy
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-02-13 08:56:55 Re: 9.1.1 crash
Previous Message Adrian Klaver 2012-02-12 19:50:25 Re: CREATE TABLE AS does not support IF NOT EXISTS?