Re: create table if not exists xx AS select ...

From: Daniel Caldeweyher <daniel(dot)caldeweyher(at)pricefinder(dot)com(dot)au>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: create table if not exists xx AS select ...
Date: 2015-03-23 01:45:14
Message-ID: CAN3G7dZUL3=tdDV=kmXpA1393h3YaJPJJ=2QspG6fU0mqJn3HQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Michael,

I suppose I should have checked the docs for CREATE TABLE AS and not
just CREATE
TABLE :)

Regards,
Daniel

On Mon, Mar 23, 2015 at 11:41 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com
> wrote:

> On Mon, Mar 23, 2015 at 10:28 AM, Daniel Caldeweyher
> <daniel(dot)caldeweyher(at)pricefinder(dot)com(dot)au> wrote:
> > I am not entirely sure if this is a bug (fails on 9.3 and 9.4) or
> working as
> > intended:
> > [...]
> > create table test2 as
> > select * from test where 1=0;
>
> This works as intended, CREATE TABLE AS does not support IF NOT EXISTS
> in 9.4 and 9.3:
> http://www.postgresql.org/docs/9.3/static/sql-createtableas.html
> http://www.postgresql.org/docs/9.4/static/sql-createtableas.html
> But it does in 9.5 and onwards:
> http://www.postgresql.org/docs/devel/static/sql-createtableas.html
> Regards,
> --
> Michael
>

Attachment Content-Type Size
image/png 7.0 KB
image/png 4.5 KB
image/png 1.3 KB
image/png 1.2 KB
image/png 1.3 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yuri Budilov 2015-03-23 03:18:24 pgadmin 3 on windows 7 install
Previous Message Michael Paquier 2015-03-23 01:41:42 Re: create table if not exists xx AS select ...