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