Search Postgresql Archives

Re: is this a bug ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/16/05, Cedric BRINER <work@xxxxxxxxxxxxx> wrote:
> hi,
> 
> I'm facing this problem
> 
> DROP TABLE test;
> DROP TABLE new_test;
> CREATE TABLE test (id serial NOT NULL UNIQUE, nom varchar(32));
> INSERT INTO test ("nom") values ('cedric');
> INSERT INTO test ("nom") values ('felix');
> INSERT INTO test ("nom") values ('julien');
> 
> CREATE TABLE new_test (id serial NOT NULL UNIQUE, nom varchar(32));
> INSERT INTO new_test SELECT * FROM test;
> 
Why create the table with a serial field if you're going to drop the
seq anyway just making it integer and this way you avoid your problem?

> ALTER TABLE new_test ALTER COLUMN id SET DEFAULT nextval('public.test_id_seq');
> DROP TABLE test;
> 
> ALTER TABLE new_test RENAME TO test;
> ALTER TABLE new_test_id_key RENAME TO test_id_key;
> 
> DROP SEQUENCE new_test_id_seq ;
> -- this give an error... is this normal
> 
> is this the normal behaviour ?
> 


-- 
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux