From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: agserm@gmail.com
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful
Date: Wed, 04 Jan 2012 08:48:57 -0600
Message-ID: <4F0412790200002500044333@gw.wicourts.gov> (raw)
In-Reply-To: <E1RiHB0-0003hL-8e@wrigleys.postgresql.org>
References: <E1RiHB0-0003hL-8e@wrigleys.postgresql.org>
<agserm@gmail.com> wrote:
> postgres=# prepare foo as create table bar (c integer);
> ERROR: syntax error at or near "create"
> LINE 1: prepare foo as create table bar (c integer);
> ^
>
> This error message does not in any way indicate that one cannot
> prepare a create table statement.
>
> It appears that PostgreSQL does not support this operation, but I
> cannot find any documentation that indicates why, or indeed if
> this is intentional.
http://www.postgresql.org/docs/9.1/interactive/sql-prepare.html
The synopsis is:
PREPARE name [ ( data_type [, ...] ) ] AS statement
and the Parameters section says:
statement
Any SELECT, INSERT, UPDATE, DELETE, or VALUES statement.
Thus, to put anything except a valid SELECT, INSERT, UPDATE, DELETE,
or VALUES statement at that position is a syntax error. What would
you expect to happen in general when you put some statement in the
middle of another statement where it is not supported? For example,
if you put a CREATE TABLE statement in the FROM clause of a SELECT
statement, what would you expect?
-Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Kevin.Grittner@wicourts.gov, agserm@gmail.com
Subject: Re: BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful
In-Reply-To: <4F0412790200002500044333@gw.wicourts.gov>
References: <E1RiHB0-0003hL-8e@wrigleys.postgresql.org> <4F0412790200002500044333@gw.wicourts.gov>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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