Обсуждение: Alter table alter column

Поиск
Список
Период
Сортировка

Alter table alter column

От
Marc Munro
Дата:
Am I right in thinking that altering a column from varchar(n) to
varchar(n+m) requires each tuple to be visited?

Recent experience suggests this is the case but my reading of the docs
has left me uncertain why this should be so.  We are not changing the
fundamental type of the column, nor are we attempting an operation that
will fail due to existing data being incompatible with the new
definition.

Is there some fundamental reason why placing a higher limit on the
length of existing data cannot be done solely by changing the system
catalogs?  Is this an optimisation that could be added to the TODO list?

__
Marc

Вложения

Re: Alter table alter column

От
Tom Lane
Дата:
Marc Munro <marc@bloodnok.com> writes:
> Am I right in thinking that altering a column from varchar(n) to
> varchar(n+m) requires each tuple to be visited?

Yes.  Doing otherwise would require an unreasonable amount of
data-type-specific knowledge hardwired into ALTER COLUMN TYPE.

            regards, tom lane