Re: alter table workaround

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: wsheldah(at)lexmark(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: alter table workaround
Date: 2001-11-01 03:37:42
Message-ID: 14886.1004585862@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

wsheldah(at)lexmark(dot)com writes:
> I just had to expand a column from varchar(10) to varchar(75).

If you want a quick hack, rather than a general-purpose solution,
it'd suffice to change the atttypmod value of the appropriate row
in pg_attribute. Something along the line of

update pg_attribute set atttypmod = 75 + 4
where attname = 'columnname' and
attrelid = (select oid from pg_class where relname = 'tablename');

Untested but I think it's right --- make a backup first (or else don't
blame me if you break your database ;-))

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-11-01 03:48:37 Re: Error in date_trunc function?
Previous Message Super Duty 2001-11-01 03:14:51 two processors or more memory?