Re: BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful
Дата
Msg-id 4F0412790200002500044333@gw.wicourts.gov
обсуждение исходный текст
Ответ на BUG #6376: Cannot prepare a "CREATE TABLE" statement, error message is unhelpful  (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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: bock@openit.de
Дата:
Сообщение: BUG #6378: exceeding memory usage while creating index in pg-9.1.2
Следующее
От: "anarazel@anarazel.de"
Дата:
Сообщение: Re: BUG #6378: exceeding memory usage while creating index in pg-9.1.2