Re: CREATE SCHEMA IF NOT EXISTS - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: CREATE SCHEMA IF NOT EXISTS
Date
Msg-id CAB7nPqRoK_bsoV1Y3tgWQa2LmuKRnJtmWDXj_vT7xrbN0VzMMg@mail.gmail.com
Whole thread Raw
In response to Re: CREATE SCHEMA IF NOT EXISTS  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-hackers


On Sat, Sep 22, 2012 at 3:06 AM, David E. Wheeler <david@justatheory.com> wrote:
On Sep 21, 2012, at 10:59 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> I don't believe this has been thought through nearly carefully enough.
> If CREATE SCHEMA created a schema and nothing more, then the proposed
> implementation would probably be fine.  But per spec, CREATE SCHEMA
> can specify not only creating the schema but a whole bunch of objects
> within the schema.  As coded, if the schema exists then creation of
> the specified sub-objects is just skipped, regardless of whether they
> exist or not.  I doubt that this is really sane behavior.  Would the
> principle of least astonishment dictate that the IF NOT EXISTS option
> apply implicitly to each sub-object as well?  (If so, we'd have to
> extend everything that can appear in OptSchemaEltList; most of those
> commands don't have IF NOT EXISTS options today.)

I had no idea about that functionality. Seems very strange.
Isn't it this SQL?
CREATE SCHEMA foo CREATE TABLE aa (a int) CREATE TABLE bb (b int);
--
Michael Paquier
http://michael.otacoo.com

pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: 64-bit API for large object
Next
From: sakamoto
Date:
Subject: Re: pg_reorg in core?