Hi all -

I have an existing table that looks like this:

CREATE TABLE orders
(
  --Bunch of stuff you don't care about
  orderstate integer NOT NULL,
  --Etc
)

with a bunch of data in it.  I've now created this new data type:

CREATE TYPE OrderStateEnum AS ENUM ('Preview', 'InQueue', 'Ordered',
'Error', 'Cancelled');

I want to change the type of "orderstate" from integer to
OrderStateEnum, and cast 0 to Preview, 1 to InQueue, 2 to Ordered,
etc.

I could create a new column, copy all the data over, then delete the
old column, but I suspect there's some cool way to go about doing
this.  Thanks!

Mike

PS - This is totally shameless, but if you cook or your spouse does,
I'd totally appreciate it if you could take a short survey to help us
develop this website we're working on.  We're hoping to get about a
thousand responses so I have to plug it everywhere :)  This URL is
http://survey.kitchenpc.com/

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to