> > It would just be a standard "ALTER TABLE foo ALTER COLUMN bar TYPE
> > newtype USING expression" operation. You would write a function that
> > took a value of the old type and returned a value of the new type and
> > use a cll to that function in the expression. Since these would be named
> > types, unlike the case in mysql where they are anonymously defined
> > inline, this would present no difficulties at all.
>
> But why force a re-write of the entire table just to change the name of
> something?
>
> Or is ALTER COLUMN TYPE smart enough to not touch anything if the
> mapping function is equality?
Nearly all ALTER TABLE commands are processed in the same way. In fact,
in some cases they are combined (ADD column is broken down then
re-combined later for a single rewrite).
You could pretty easily add this type of logic to skip the rewrite stage
if not needed.
--