Re: how to alter an enum type

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org, Henrique Pantarotto <henpa(at)terra(dot)com(dot)br>
Subject: Re: how to alter an enum type
Date: 2007-12-24 18:27:55
Message-ID: 887842.54507.qm@web31805.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--- On Mon, 12/24/07, Henrique Pantarotto <henpa(at)terra(dot)com(dot)br> wrote:

> I actually want to change the enum values after I have
> created and
> associated it to a table colum.

It looks like you will have to drop the type and re-create it.

You might have to try a couple of tests:

1) BEGIN TRANSACTION;
DROP the type
create the type
commit; --does your table have still reference this type?

2) BEGIN TRANSACTION;
CREATE a new type with a different name
alter the table column to refer to the new type
drop the old type
Commit;

I wonder if it is possible to create an enum type using a select statement. This way the contents of the type can be seen in a base table. and it would be easy to recreate the type when new elements are added or removed. I'll have to play around with this in the future to see what is possible.

Regards,
Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-12-24 18:34:50 Re: how to alter an enum type
Previous Message Henrique Pantarotto 2007-12-24 18:10:45 Re: how to alter an enum type