Re: Best practice for altering a table

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Best practice for altering a table
Дата
Msg-id web-1821207@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Re: Best practice for altering a table  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Best practice for altering a table
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Best practice for altering a table