From: ogjunk-pgjedan@yahoo.com
To: pgsql-admin@postgresql.org
Subject: Renaming a sequence?
Date: Fri, 24 Mar 2006 19:22:59 -0800 (PST)
Message-ID: <20060325032259.66690.qmail@web50310.mail.yahoo.com> (raw)
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
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-admin@postgresql.org
Cc: ogjunk-pgjedan@yahoo.com
Subject: Re: Renaming a sequence?
In-Reply-To: <20060325032259.66690.qmail@web50310.mail.yahoo.com>
References: <20060325032259.66690.qmail@web50310.mail.yahoo.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