Renaming a sequence?

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

 



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





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux