Re: Best practice for altering a table - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Best practice for altering a table
Date
Msg-id web-1821207@davinci.ethosmedia.com
Whole thread Raw
In response to Re: Best practice for altering a table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Tim,

> > Not surprisingly, I've discovered that some of my VARCHARs are not
> > long enough and I need to change them.
>
> > What is "best practice" for this sort of thing?
>
> Do you want something that will still work on Alpha Centauri in the
> 24th-and-a-half century, or do you just want to get the job done
> quickly?
>
> In the former case, creating a new table with the right schema
> and INSERT/SELECT'ing into it is pretty bulletproof.  (But it
> won't help if you'd like to preserve view and foreign-key references
> to the original table.)

Personally, I'm fond of dumping the who database to text files, editing
the text files, and re-loading.   This is partly because of the large
number of foriegn key constraints, triggers, and views in my databases.

-Josh


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Best practice for altering a table
Next
From: Josh Berkus
Date:
Subject: Re: Best practice for altering a table