Re: CREATE SCHEMA IF NOT EXISTS

Fabrízio de Royes Mello <fabriziomello@gmail.com>

From: Fabrízio de Royes Mello <fabriziomello@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Tom Lane <tgl@sss.pgh.pa.us>, "David E. Wheeler" <david@justatheory.com>, "Dickson S. Guedes" <listas@guedesoft.net>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2012-10-03T17:29:38Z
Lists: pgsql-hackers

Attachments

2012/10/3 Alvaro Herrera <alvherre@2ndquadrant.com>

> Excerpts from Fabrízio de Royes Mello's message of mié oct 03 10:11:03
> -0300 2012:
>
> > Maybe something like this?
> >
> >    ereport(ERROR,
> >            (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> >             errmsg("IF NOT EXISTS cannot be used with schema elements"),
> >             parser_errposition(@9)));
>
> Seems reasonable, but where?  Please submit a complete patch.
>
>
The attached patch implements the behavior we've discussed.

If we use "IF NOT EXISTS" with schema elements then occurs an error like
this:


[local]:5432 fabrizio@fabrizio=# CREATE SCHEMA IF NOT EXISTS test_schema_1
       CREATE TABLE abc (
              a serial,
              b int UNIQUE
       );
ERROR:  IF NOT EXISTS cannot be used with schema elements
LINE 1: CREATE SCHEMA IF NOT EXISTS test_schema_1
                      ^
Time: 0,773 ms



Regards,

-- 
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Document the lack of reading the PGDATABASE environment variable in