Re: ALTER TABLE x ALTER COLUMN y TYPE z

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER TABLE x ALTER COLUMN y TYPE z
Дата
Msg-id 19259.1143058484@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ALTER TABLE x ALTER COLUMN y TYPE z  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Ответы Re: ALTER TABLE x ALTER COLUMN y TYPE z  (Robert Treat <xzilla@users.sourceforge.net>)
Список pgsql-docs
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> The user comment's recommended technique includes this line:
> ALTER TABLE tab DROP COLUMN temp_name;
> Would this cause a table rewrite?  (Not a rhetorical question.  I
> really don't know.)

No, it wouldn't.  The UPDATE is the only part that modifies the table
contents.

However, the arguments Robert pointed to had to do with concurrent
access to the table, and somehow I am not seeing the use-case for ALTER
COLUMN TYPE on a table that's being actively used by other clients.
It seems unlikely that you could do that without needing to also update
your client software.  I'd be a tad worried about stale-cached-plan
problems too, in current PG releases.  Finally, since the first ALTER
will take an exclusive lock that won't be released until COMMIT, this
approach doesn't avoid the problem of holding exclusive lock for a long
time.

            regards, tom lane

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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: ALTER TABLE x ALTER COLUMN y TYPE z
Следующее
От: Robert Treat
Дата:
Сообщение: Re: ALTER TABLE x ALTER COLUMN y TYPE z