Re: Fwd: Re: [GENERAL] Howto change column leng

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Jean-Michel POURE'" <jm(dot)poure(at)freesurf(dot)fr>, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Fwd: Re: [GENERAL] Howto change column leng
Date: 2001-11-07 14:46:40
Message-ID: AA30E7BCCA5C1D4E88A231900F8325C00C4C@dogbert.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

> -----Original Message-----
> From: Jean-Michel POURE [mailto:jm(dot)poure(at)freesurf(dot)fr]
> Sent: 07 November 2001 14:30
> To: pgadmin-hackers(at)postgresql(dot)org
> Subject: [pgadmin-hackers] Fwd: Re: [GENERAL] Howto change
> column length
>
>
> Hello all,
>
> This is a copy from Admin explaining how to change variable lenght:
>
> >If you're willing to do a little magic to the system tables (and you
> >have a recent backup :) ). You can change the atttypmod of
> the column
> >in question from 14 to 24. This really only works on
> variable length
> >items and only to expand them, but...
> >
> >You pretty much need to do a sequence like:
> >select oid, relname from pg_class where
> relname='<tablename>'; update
> >pg_attribute set atttypmod=24 where attrelid=<oid from previous>
> > and attname='<attributename>'
> >in a superuser account.

Though technically correct, that sounds like a recipe for disaster! Of
course, the atttypmod doesn't always relate directly to the length of the
column, and even when it does, it's usually length+4

Regards, Dave.

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2001-11-08 15:49:01 Changelog
Previous Message Jean-Michel POURE 2001-11-07 14:30:00 Fwd: Re: [GENERAL] Howto change column length