pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful
2+ messages / 2 participants
[nested] [flat]
* BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful
@ 2012-01-04 03:06 agserm@gmail.com
2012-01-04 14:48 ` Re: BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful Kevin Grittner <Kevin.Grittner@wicourts.gov>
0 siblings, 1 reply; 2+ messages in thread
From: agserm@gmail.com @ 2012-01-04 03:06 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 6376
Logged by: Ansel Sermersheim
Email address: agserm@gmail.com
PostgreSQL version: 9.1.2
Operating system: Linux & Win32
Description:
Attempting to prepare a CREATE TABLE statement fails with a syntax error:
postgres=# select version();
version
-------------------------------------------------------------------------------------------------------
PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc-4.6.real
(Debian 4.6.2-5) 4.6.2, 64-bit
(1 row)
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.
At the very least an error message indicating that CREATE TABLE is not
eligible for preparation would have been nice.
This behavior seems to be identical both on Linux and Win32.
Thanks for reading,
Ansel Sermersheim
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful
2012-01-04 03:06 BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful agserm@gmail.com
@ 2012-01-04 14:48 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Grittner @ 2012-01-04 14:48 UTC (permalink / raw)
To: agserm@gmail.com; pgsql-bugs
<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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2012-01-04 14:48 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-01-04 03:06 BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful agserm@gmail.com
2012-01-04 14:48 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
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