X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66BA152899 for ; Wed, 22 Jun 2005 07:56:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86655-08 for ; Wed, 22 Jun 2005 10:56:34 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id A08575288B for ; Wed, 22 Jun 2005 07:56:33 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 5F9E03095A; Wed, 22 Jun 2005 12:57:45 +0200 (MET DST) From: "Sim Zacks" X-Newsgroups: pgsql.general Subject: Re: is this a bug ? Date: Wed, 22 Jun 2005 13:54:04 +0200 Organization: Hub.Org Networking Services Lines: 50 Message-ID: References: <20050616175239.GA23283@obs.unige.ch> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 To: pgsql-general@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.354 tagged_above=0 required=5 tests=AWL, PRIORITY_NO_NAME, UPPERCASE_25_50 X-Spam-Level: * X-Archive-Number: 200506/1015 X-Sequence-Number: 79723 This is a normal error. If you want to remove the sequence first you have to remove the default value from the sequenced field. remember serial means int4 with a default of get next serial number. ALTER TABLE test ALTER COLUMN test_id_key DROP DEFAULT; After that you could probably drop the sequence without a problem "Cedric BRINER" wrote in message news:20050616175239.GA23283@obs.unige.ch... > 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; > > 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 ? > > Ced. > -- > > Cedric BRINER > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq >