renaming sequences

From: Matthew Hixson <hixson(at)poindextrose(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: renaming sequences
Date: 2004-09-28 01:30:37
Message-ID: 0068D10E-10EE-11D9-BF0E-000A95D05926@poindextrose.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I had a bunch of tables that had v_ prepended to their names. I've
renamed all of the tables so that they don't have that prefix anymore
so that v_address is now addresses. The name of this table's sequence
is still v_addresses_address_id_seq. This is fine except for the fact
that I'm using JBoss and it assumes that the table's sequence is
addresses_address_id_seq. (Why it needs to read the sequence I have no
idea.) So now, every time I try to save an object JBoss is executing
sql that is trying to read from a non-existent sequence.
Can I rename my sequences and change the tables to point to the new
sequence names or do I have to do something like:

1) Rename addresses to addresses_temp
2) Create addresses from scratch so that Postgres creates a sequence
named addresses_address_id_seq
3) Select all of the data from addresses_temp into addresses.

Thanks,
-M@

Browse pgsql-general by date

  From Date Subject
Next Message Sean Shanny 2004-09-28 03:21:58 Getting an out of memory failure.... (long email)
Previous Message Marc G. Fournier 2004-09-27 23:54:05 Re: [GENERAL] PostgreSQL 8.0.0 Beta 3 Uploaded