Re: Best practice for altering a table

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, wilson(at)visi(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Best practice for altering a table
Date: 2002-11-11 18:16:34
Message-ID: web-1821207@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-11-11 19:24:37 Re: Best practice for altering a table
Previous Message Retzlaw Heinrich 2002-11-11 10:14:59 Re: creating table with an encrypted filed