Re: alter table workaround - Mailing list pgsql-general

From Tom Lane
Subject Re: alter table workaround
Date
Msg-id 14886.1004585862@sss.pgh.pa.us
Whole thread Raw
In response to alter table workaround  (wsheldah@lexmark.com)
List pgsql-general
wsheldah@lexmark.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error in date_trunc function?
Next
From: Thomas Lockhart
Date:
Subject: Re: Error in date_trunc function?