Re: alter table is taking a long time

Поиск
Список
Период
Сортировка
Искать
От
Sam Mason
Тема
Re: alter table is taking a long time
Дата
Msg-id
20091107143307.GY5407@samason.me.uk
Ответ на
Список
Дерево обсуждения
Re: alter table is taking a long time "stanciutheone@gmail.com" <stanciutheone@gmail.com>
Re: alter table is taking a long time Thom Brown <thombrown@gmail.com>
Re: alter table is taking a long time "Michael Harris" <michael.harris@ericsson.com>
On Sat, Nov 07, 2009 at 10:48:14AM +0200, Johan Nel wrote:
> update pg_attribute set attlen = 4 + 
> where attname = 'yourcolumnname'
> 
> That will take only a couple of milliseconds to do.

It will also update *every* column with that name.  Something involving
the "attrelid" would be much safer.  I'd use something like:

  update pg_attribute set attlen = 4 + 
  where attrelid = regclass 'your table name'
    and attname  = 'yourcolumnname';

-- 
  Sam  http://samason.me.uk/
В списке pgsql-general по дате отправления
От: Geoffrey
Дата:
От: Sam Mason
Дата:
FAQ