adding a primary key column to a temporary table fails (v7.4.3)

Поиск
Список
Период
Сортировка
От Frank van Vugt
Тема adding a primary key column to a temporary table fails (v7.4.3)
Дата
Msg-id 200407221550.46826.ftm.van.vugt@foxi.nl
обсуждение исходный текст
Ответы Re: adding a primary key column to a temporary table fails  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-bugs
Hi,

I guess this might not be the appropriate thing to be happening:

# select version();
                               version
---------------------------------------------------------------------
 PostgreSQL 7.4.3 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
(1 row)


(verify whether temporary tables do support primary keys)
# create temp table f_test (id int primary key, value varchar(20));
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "f_test_pkey"
for table "f_test"
CREATE TABLE

# drop table f_test;
DROP TABLE

(now create it without the primary key)
# create temp table f_test (value varchar(20));
CREATE TABLE

(and add the column afterwards)
# alter table f_test add column id int primary key;
NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create implicit index
"f_test_pkey" for table "f_test"
ERROR:  adding NOT NULL columns is not implemented
HINT:  Add the column, then use ALTER TABLE SET NOT NULL.



By the way, I noticed that the todo-list does not mention 'alter table alter
column set/drop primary key'. I'm wondering whether it should?

Ratio:
I was trying to avoid repeating complex create temp table statements by doing
stuff like 'create temp table <foo> as select * from <bar> where false'
instead. But since the resulting table doesn't have any indexes on it and one
of the libraries I use actually expects a 'real' primary key to be available,
I was looking for ways to get to a temporary table with a copied structure
AND a primary key.




--
Best,




Frank.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bug in concat operator for Char? -- More Info
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: adding a primary key column to a temporary table fails