Re: alter table is taking a long time

From: Johan Nel <johan(dot)nel(at)xsinet(dot)co(dot)za>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: alter table is taking a long time
Date: 2009-11-09 13:21:12
Message-ID: 850c8977-4d10-4170-b0a7-d8685c473e67@w19g2000yqk.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Sam,

Typo in my haste on initial mail. attlen should actually be
atttypmod.

> > update pg_attribute set attlen = 4 + <newlength>
> > where attname = 'yourcolumnname'
update pg_attribute set ATTTYPMOD = 4 + <newlength>
where attname = 'yourcolumnname' and <additional where statements>

> 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 + <newlength>
>   where attrelid = regclass 'your table name'
>     and attname  = 'yourcolumnname';

Yes I agree, that was why I initially said to do a couple of selects
before doint the update to ensure only the applicable columns get
updated.
>> Just first do some select statements to ensure you only
>> update what you really want to.

Regards,

Johan Nel
Pretoria, South Africa.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2009-11-09 13:24:36 Re: PostgreSQL 8.3.8 on AIX5.3 : compilation failed
Previous Message Anders Moe 2009-11-09 12:47:55 Re: Not possible to create 64 bit windows clients ?