pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #12819: CREATE TYPE fails within CREATE SCHEMA
4+ messages / 4 participants
[nested] [flat]
* BUG #12819: CREATE TYPE fails within CREATE SCHEMA
@ 2015-03-02 16:55 postgresql.org@ciotog.net
2015-03-02 17:53 ` Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA Tom Lane <tgl@sss.pgh.pa.us>
2015-03-02 18:03 ` Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA John R Pierce <pierce@hogranch.com>
0 siblings, 2 replies; 4+ messages in thread
From: postgresql.org@ciotog.net @ 2015-03-02 16:55 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 12819
Logged by: Chris Craig
Email address: postgresql.org@ciotog.net
PostgreSQL version: 9.3.5
Operating system: Ubuntu 14.04.1 LTS
Description:
When creating objects within a CREATE SCHEMA definition, "CREATE TYPE" fails
with 'ERROR: syntax error at or near "TYPE"'.
Eg:
postgres=# CREATE SCHEMA foo
postgres-# CREATE TYPE foo.bar AS ENUM('ONE','TWO','THREE');
ERROR: syntax error at or near "TYPE"
LINE 2: CREATE TYPE foo.bar AS ENUM('ONE','TWO','THREE');
^
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA
2015-03-02 16:55 BUG #12819: CREATE TYPE fails within CREATE SCHEMA postgresql.org@ciotog.net
@ 2015-03-02 17:53 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-03-02 22:42 ` Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA Andrew Gierth <andrew@tao11.riddles.org.uk>
1 sibling, 1 reply; 4+ messages in thread
From: Tom Lane @ 2015-03-02 17:53 UTC (permalink / raw)
To: postgresql.org@ciotog.net; +Cc: 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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA
2015-03-02 16:55 BUG #12819: CREATE TYPE fails within CREATE SCHEMA postgresql.org@ciotog.net
2015-03-02 17:53 ` Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA Tom Lane <tgl@sss.pgh.pa.us>
@ 2015-03-02 22:42 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Gierth @ 2015-03-02 22:42 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> Currently, only CREATE TABLE, CREATE VIEW, CREATE INDEX, CREATE
Tom> SEQUENCE, CREATE TRIGGER and GRANT are accepted as clauses within
Tom> CREATE SCHEMA.
Tom> That's basically driven by what was required in SQL92. It's
Tom> unlikely that we're going to worry about extending that set much,
Tom> because the lack of separating semicolons means that we risk
Tom> syntax ambiguities anytime we add more options.
CREATE and GRANT are both fully reserved already; what potential
ambiguities are introduced by adding more CREATE statement variants to
that list? (all the spec's clauses for the body of CREATE SCHEMA begin
with either CREATE or GRANT)
--
Andrew (irc:RhodiumToad)
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA
2015-03-02 16:55 BUG #12819: CREATE TYPE fails within CREATE SCHEMA postgresql.org@ciotog.net
@ 2015-03-02 18:03 ` John R Pierce <pierce@hogranch.com>
1 sibling, 0 replies; 4+ messages in thread
From: John R Pierce @ 2015-03-02 18:03 UTC (permalink / raw)
To: postgresql.org@ciotog.net; pgsql-bugs
On 3/2/2015 8:55 AM, postgresql.org@ciotog.net wrote:
> When creating objects within a CREATE SCHEMA definition, "CREATE TYPE" fails
> with 'ERROR: syntax error at or near "TYPE"'.
>
> Eg:
> postgres=# CREATE SCHEMA foo
> postgres-# CREATE TYPE foo.bar AS ENUM('ONE','TWO','THREE');
> ERROR: syntax error at or near "TYPE"
> LINE 2: CREATE TYPE foo.bar AS ENUM('ONE','TWO','THREE');
> ^
>
no ; on the first command, so that got read as CREATE SCHEMA foo CREATE
TYPE .... which isn't a valid command.
--
john r pierce 37N 122W
somewhere on the middle of the left coast
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2015-03-02 22:42 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 16:55 BUG #12819: CREATE TYPE fails within CREATE SCHEMA postgresql.org@ciotog.net
2015-03-02 17:53 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-03-02 22:42 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2015-03-02 18:03 ` John R Pierce <pierce@hogranch.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox