From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | David E(dot) Wheeler <david(at)justatheory(dot)com> |
Cc: | Dickson S(dot) Guedes <listas(at)guedesoft(dot)net>, fabriziomello <fabriziomello(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: CREATE SCHEMA IF NOT EXISTS |
Date: | 2012-10-02 19:30:05 |
Message-ID: | 1349205863-sup-2245@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Excerpts from David E. Wheeler's message of mar oct 02 16:16:37 -0300 2012:
> On Oct 2, 2012, at 12:08 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
>
> > create schema if not exists foo create table first (a int);
> > create schema if not exists foo create table second (a int);
> >
> >
> > As far as I can see, with the patch as it currently stands, you would
> > end up with only table "first" in the schema, which seems very
> > surprising to me.
>
> Yeah, I think the second should die. CINE should only work if there are no other objects created as part of the statement, IMHO.
Well, if that's the rationale then you end up with no schema foo at all
(i.e. both die), which seems even more surprising (though I admit it has
the advantage of being a simple rule to document.)
How about call this for precedent:
mkdir -p /tmp/foo/bar
mkdir -p /tmp/foo/baz
In this case you end up with directory "foo" and at least two subdirs in
it, bar and baz. This works even if /tmp/foo existed previously and
even if there was some other stuff in it.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2012-10-02 19:37:30 | Re: CREATE SCHEMA IF NOT EXISTS |
Previous Message | David E. Wheeler | 2012-10-02 19:16:37 | Re: CREATE SCHEMA IF NOT EXISTS |