Re: BUG #2100: CREATE TABLE AS - may not supply table specification

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2100: CREATE TABLE AS - may not supply table specification
Дата
Msg-id 13723.1134145702@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #2100: CREATE TABLE AS - may not supply table specification  ("Robert Bengtsson" <robert@fbt.se>)
Список pgsql-bugs
"Robert Bengtsson" <robert@fbt.se> writes:
> while the following generates an error:

> CREATE TABLE l_modeltext
> (
>   id serial NOT NULL,
>   text varchar(60),
>   make varchar(30),
>   model varchar(30),
>   make_id int4,
>   model_id int4
> ) WITHOUT OIDS AS (SELECT distinct modeltext as text, make, model, make_id,
> model_id from l_modelcode);

That is not the syntax for CREATE TABLE AS, and I don't see anything in
the reference page for CREATE TABLE AS that would suggest that it is.

I'd suggest creating the table with the columns you want and then doing
INSERT ... SELECT to fill it.

            regards, tom lane

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

Предыдущее
От: "Brent Reid"
Дата:
Сообщение: BUG #2102: Backend reports wrong number of affected rows for a table that uses rules
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2104: pg_xlog/ trace files not reclaimed by server