X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 6341D9DC9DF for ; Sat, 25 Mar 2006 13:50:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 86939-04 for ; Sat, 25 Mar 2006 13:49:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sydney.mailnetwork.co.uk (server88-208-192-113.live-servers.net [88.208.192.113]) by postgresql.org (Postfix) with ESMTP id ADB2E9DC98B for ; Sat, 25 Mar 2006 13:49:57 -0400 (AST) Received: from andyshellam-gw.adsl.newnet.co.uk ([80.175.198.137]:1578 helo=acsdesk1) by sydney.mailnetwork.co.uk with esmtpa (Exim 4.60) (envelope-from ) id 1FNCtg-00082W-TT; Sat, 25 Mar 2006 17:49:57 +0000 Reply-To: From: "Andy Shellam" To: , Cc: Subject: Re: Renaming a sequence? Date: Sat, 25 Mar 2006 17:49:45 -0000 Organization: the mail network MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <20060325032259.66690.qmail@web50310.mail.yahoo.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcZPu4EYhFnXIXSxTeuCwGK0MmhXYgAeMzaA Message-Id: <20060325174957.ADB2E9DC98B@postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.831 required=5 tests=[AWL=-0.096, MSGID_FROM_MTA_ID=0.927] X-Spam-Score: 0.831 X-Spam-Level: X-Archive-Number: 200603/258 X-Sequence-Number: 21015 You also need to alter your column's default value to point to your new sequence (nextval('public.watchlist_id_seq'::text)). I'm not certain of the SQL to do this but must be along the order of "ALTER COLUMN . DEFAULT nextval('public.watchlist_id_seq'::text)" or something similar. Andy -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of ogjunk-pgjedan@yahoo.com Sent: Saturday, 25 March, 2006 3:23 am To: pgsql-admin@postgresql.org Subject: [ADMIN] Renaming a sequence? Hi, I just renamed some of my tables, but I now have sequences with older names. I followed info from http://www.postgresql.org/docs/current/static/sql-altersequence.html : "Some variants of ALTER TABLE can be used with sequences as well; for example, to rename a sequence use ALTER TABLE RENAME" So this is what I did: ALTER TABLE topic_id_seq RENAME TO watchlist_id_seq; That *appeared* to work, but I still see the old sequence name: mydb => \d watchlist Table "public.watchlist" Column | Type | Modifiers --------------+-------------------------------+----------------------------- -------------------------- id | integer | not null default nextval('public.topic_id_seq'::text) ... Indexes: "pk_topic_id" PRIMARY KEY, btree (id) It looks like my sequence WAS renamed, but my table's PK points to the old sequence name, which is not supposed to exist any more. Is there any way to change this without killing the sequence? Thanks, Otis ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly !DSPAM:14,4424b7b935047329715045!