alter table workaround

Поиск
Список
Период
Сортировка
От wsheldah@lexmark.com
Тема alter table workaround
Дата
Msg-id 200110311516.KAA03579@interlock2.lexmark.com
обсуждение исходный текст
Ответы Re: alter table workaround  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: alter table workaround  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

I just had to expand a column from varchar(10) to varchar(75). The affected
table had a sequence and almost a dozen referential integrity triggers, so a
straight 'drop table; create table' solution wouldn't be enough.  Joel Burton's
techdoc on the subject
(http://techdocs.postgresql.org/techdocs/updatingcolumns.php) suggests usging
pg_dump to dump the entire database, then change the create table statement for
the table, then drop and restore the entire database.

What I'm wondering is whether it would be safe to just dump the affected table
with `pg_dump -t mytable mydb >mytable.sql`, and then in psql do:
drop table mytable;
drop sequence mysequence;
\i mytable.sql

...after editing mytable.sql of course.  My goal here is to only drop and
restore what I really need to.  Will this restore all affected triggers, etc.
that are affected by the drop table command?  Any other caveats?

Thanks,

Wes Sheldahl



В списке pgsql-general по дате отправления:

Предыдущее
От: Meenatchi Anbuchelvan
Дата:
Сообщение: Re: DOes PostgreSQL support UInt64?
Следующее
От: Randall Perry
Дата:
Сообщение: serial sequence problem with existing keys