Re: [PATCH] Alter or rename enum value - Mailing list pgsql-hackers

From Emre Hasegeli
Subject Re: [PATCH] Alter or rename enum value
Date
Msg-id CAE2gYzy2U60yhj9fpSciO+cF8AVd2_V++d6GZUiC3NeG8sWwvA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Alter or rename enum value  (Matthias Kurz <m.kurz@irregular.at>)
Responses Re: [PATCH] Alter or rename enum value
List pgsql-hackers
> Given that you are now familiar with the internals of how enums are
> implemented would it be possible to continue the work and add the "ALTER
> TYPE <name> DROP VALUE <somevalue>" command?

I was thinking to try developing it, but I would be more than happy to
help by testing and reviewing, if someone else would do.  I don't
think I have enough experience to think of all details of this
feature.

The main problem that has been discussed before was the indexes.  One
way is to tackle with it is to reindex all the tables after the
operation.  Currently we are doing it when the datatype of indexed
columns change.  So it should be possible, but very expensive.

Another way, Thomas Munro suggested when we were talking about it,
would be to add another column to mark the deleted rows to the catalog
table.  We can check for this column before allowing the value to be
used.  Indexes can continue using the deleted values.  We can also
re-use those entries when someone wants to add new value to the
matching place.  It should be safe as long as we don't update the sort
order.



pgsql-hackers by date:

Previous
From: Pavan Deolasee
Date:
Subject: Re: Bug in two-phase transaction recovery
Next
From: Dilip Kumar
Date:
Subject: Re: [sqlsmith] Failed assertion in joinrels.c