Re: Resize numeric column without changing data?

From: Lukas Eklund <lukas(at)eklund(dot)io>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Resize numeric column without changing data?
Date: 2012-04-09 20:06:32
Message-ID: CAKLATOXh5ajxH0XY=v07jm2GaVQs5+fMuhrgs4_CFcBKsuQC0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 9, 2012 at 2:51 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Mon, Apr 9, 2012 at 9:57 AM, Lukas Eklund <lukas(at)eklund(dot)io> wrote:
>> Is it safe to resize a numeric column using in pg_attribute without
>> altering the table?
>>
>
> One thing that's pretty weird is that dependent view columns keep the
> old typmod.  That might cause some issues with things that depend on
> that value, for example client side tools.  But you can always change
> those as well.
>
> I think this might work because the numeric storage doesn't change for
> this case.  But it's still quite dangerous and avoiding view
> re-recreation is a pretty weak justification to go be updating system
> catalogs.  You'd be better off spending some time developing a script
> to recreate views. The only reason why I would personally be
> considering this would be to avoid issues stemming from having to take
> out a lock on the table and I would be testing very, very carefully if
> I did so.
>
> merlin

Ah. I must have not noticed that the typmod for views is not inherited
automatically. I'm okay with developing a script to recreate the 15 or
so views the depend on that table. What I'm trying to avoid is locking
that table for a substantial amount of time. Thanks for the advice!

Lukas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2012-04-09 22:13:41 Re: Resize numeric column without changing data?
Previous Message John R Pierce 2012-04-09 19:56:41 Re: Help needed to mount a dmp file