Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA
Date
Msg-id 6455.1425318835@sss.pgh.pa.us
Whole thread Raw
In response to BUG #12819: CREATE TYPE fails within CREATE SCHEMA  (postgresql.org@ciotog.net)
Responses Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
postgresql.org@ciotog.net writes:
> When creating objects within a CREATE SCHEMA definition, "CREATE TYPE" fails
> with 'ERROR:  syntax error at or near "TYPE"'.

That's not supported; per the manual, we only allow these things within a
run-on CREATE SCHEMA:

    Currently, only CREATE TABLE, CREATE VIEW, CREATE INDEX, CREATE
    SEQUENCE, CREATE TRIGGER and GRANT are accepted as clauses within
    CREATE SCHEMA.

That's basically driven by what was required in SQL92.  It's unlikely
that we're going to worry about extending that set much, because the
lack of separating semicolons means that we risk syntax ambiguities
anytime we add more options.  We could only resolve such problems by
making more keywords fully reserved, which is a disadvantage that greatly
outweighs any value anyone might see in this syntax for CREATE SCHEMA.

My advice: use a simple CREATE SCHEMA and separate commands for the
contained objects.  You can wrap the whole thing in a transaction
if you're concerned about making it atomic.

            regards, tom lane

pgsql-bugs by date:

Previous
From: postgresql.org@ciotog.net
Date:
Subject: BUG #12819: CREATE TYPE fails within CREATE SCHEMA
Next
From: John R Pierce
Date:
Subject: Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA