From: Jaime Casanova <systemguards@gmail.com>
To: Cedric BRINER <work@infomaniak.ch>
Cc: pgsql-general@postgresql.org
Subject: Re: is this a bug ?
Date: Thu, 16 Jun 2005 12:17:47 -0500
Message-ID: <c2d9e70e050616101772429a56@mail.gmail.com> (raw)
In-Reply-To: <20050616175239.GA23283@obs.unige.ch>
References: <20050616175239.GA23283@obs.unige.ch>
On 6/16/05, Cedric BRINER <work@infomaniak.ch> 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 ;)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: systemguards@gmail.com, work@infomaniak.ch
Subject: Re: is this a bug ?
In-Reply-To: <c2d9e70e050616101772429a56@mail.gmail.com>
References: <20050616175239.GA23283@obs.unige.ch> <c2d9e70e050616101772429a56@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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