Re: COLUMN MODIFY

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COLUMN MODIFY
Date: 2003-01-07 22:01:03
Message-ID: 200301072201.h07M13O18613@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Sorry to be commenting so late.

We could do that CLUSTER way of making a new heap file, but we rejected
that for DROP COLUMN, so I am not sure why we would use that for ALTER
COLUMN. Can anyone think of a good reason?

Clearly if the new data type is binary compatible and it is just a
catalog change, we can do that in place.

---------------------------------------------------------------------------

Christopher Kings-Lynne wrote:
> Hey guys,
>
> I was just thinking about altering column type. Now, I'm not actually going
> to implement it any time soon, but I'm just thinking about it!!!
>
> One proposal was to introduce a new pg_attribute column called 'attlognum'
> so changing a column would involve adding a new column, dropping the old one
> and nudging the attlognum so that the columns are still select *'d in the
> same order.
>
> That involves catalog changes, etc.
>
> My idea is why not do what cluster does? Can we just simply write an entire
> new relation with the new type, update relfilenode and drop the old
> relation?
>
> ISTM that that would prevent catalog changes and would occupy identical disk
> space (2 x table size) during the ALTER, but would automatically 'free'
> itself back down to 1 x table size. Otherwise, the user has to do a vacuum
> full.
>
> Actually, if the type is binary compatible with the old type, all you need
> to update is the catalog.
>
> The existing DROP COLUMN implementation could even be changed to work like
> that, so long as we just leave the attisdropped column always false.
>
> What do you think?
>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

  • COLUMN MODIFY at 2002-12-19 04:54:30 from Christopher Kings-Lynne

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message mlw 2003-01-07 22:10:17 PostgreSQL site, put up or shut up?
Previous Message Jon Jensen 2003-01-07 21:37:44 Re: New Portal in Place, DNS switched ...