← Back to team overview

launchpad-dev team mailing list archive

Re: How hard is renaming tables?

 

On Fri, Nov 27, 2009 at 9:53 PM, Aaron Bentley <aaron@xxxxxxxxxxxxx> wrote:

> "I'm finding it is much better to drop and recreate tables than rename
> them - it causes problems with index names and constraints keeping old
> names and even triggered a Slony-I bug once where it was making naming
> assumptions that could be broken by renaming tables."
>
> https://code.edge.launchpad.net/~abentley/launchpad/messagejob/+merge/3610
>
> What did I misunderstand?

Nothing really. You rename the table, rebuild all the constraints so
they have the right names, rename the sequences - lots of ALTER TABLE
statements and it can be simpler and sometimes quicker to just
recreate the table from scratch. The Slony-I issue means you can't do
it half way (rename the table but not bother with renaming the primary
key sequence if I recall correctly).


-- 
Stuart Bishop <stuart@xxxxxxxxxxxxxxxx>
http://www.stuartbishop.net/



References