Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YSUXe-00081F-MI for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Mar 2015 17:54:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YSUXe-00052k-0v for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Mar 2015 17:54:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YSUXd-00052W-CX for pgsql-bugs@postgresql.org; Mon, 02 Mar 2015 17:54:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YSUXW-0002yr-FI for pgsql-bugs@postgresql.org; Mon, 02 Mar 2015 17:54:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t22HrtcE006456; Mon, 2 Mar 2015 12:53:55 -0500 From: Tom Lane To: postgresql.org@ciotog.net cc: pgsql-bugs@postgresql.org Subject: Re: BUG #12819: CREATE TYPE fails within CREATE SCHEMA In-reply-to: <20150302165554.2546.2997@wrigleys.postgresql.org> References: <20150302165554.2546.2997@wrigleys.postgresql.org> Comments: In-reply-to postgresql.org@ciotog.net message dated "Mon, 02 Mar 2015 16:55:54 +0000" Date: Mon, 02 Mar 2015 12:53:55 -0500 Message-ID: <6455.1425318835@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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