Re: enums

From: Rod Taylor <pg(at)rbt(dot)ca>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, ted(at)php(dot)net, Michael Fuhr <mike(at)fuhr(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: enums
Date: 2005-10-28 02:23:27
Message-ID: 1130466207.846.40.camel@home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > 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.

--

In response to

  • Re: enums at 2005-10-28 02:14:15 from Jim C. Nasby

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2005-10-28 02:28:01 Re: TODO Item - Add system view to show free space map
Previous Message Andrew Dunstan 2005-10-28 02:20:51 Re: enums