Re: ALTER TABLE MODIFY COLUMN - Mailing list pgsql-hackers

From Hiroshi Inoue
Subject Re: ALTER TABLE MODIFY COLUMN
Date
Msg-id 3AD69425.13CA75A4@tpf.co.jp
Whole thread Raw
In response to ALTER TABLE MODIFY COLUMN  (Mark Butler <butlerm@middle.net>)
List pgsql-hackers
Mark Butler wrote:
> 
> I was looking at how hard it would be to support altering column types and it
> seems to me that it would be trivial to support changing nullability,

Yes. The problem is how to formulate 'DROP CONSTRAINT' feature. 

> increasing the maximum length of the VARCHAR data type and increasing the
> precision or scale of the DECIMAL / NUMERIC data type.
> 

Yes. The problem is how PostgreSQL could recognize the fact.

[snip]

> I understand that with the current heap tuple format described in
> backend/access/common.c that changing the type of any fixed length attribute
> requires updating every row.
> 
> Surely if we have an write exclusive table lock we can rewrite tuples in place
> rather than creating new versions with its corresponding 2x space requirement.
> 

PostgreSQL has a no overwrite storage manager, so this
seems to have little advantage. We now have a mechanism
to replace existent relation files safely. We could 
avoid running VACUUM, multiple version of tuples in
a file etc ...

regards,
Hiroshi Inoue


pgsql-hackers by date:

Previous
From: Mark Butler
Date:
Subject: NUMERIC type efficiency problem
Next
From: Tom Lane
Date:
Subject: Re: Yacc / Bison difficulties