Re: Alter or rename enum value

Jim Nasby <jim.nasby@bluetreble.com>

From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Gavin Flower <GavinFlower@archidevsys.co.nz>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: Matthias Kurz <m.kurz@irregular.at>, <pgsql-hackers@postgresql.org>
Date: 2016-03-25T19:31:36Z
Lists: pgsql-hackers
On 3/25/16 2:22 PM, Gavin Flower wrote:
>>
>> I've certainly heard people avoiding ENUMs because of their
>> limitations, so it'd be nice if there was a way to lift them.
> Well, I use Enums extensively in Java.
>
> However, I totally avoid using ENUMs in pg, due to their inflexibility!

Possibly related to this, for a long time I've also wanted a way to 
better integrate FKs, probably via some kind of a pseudotype or maybe a 
special operator. The idea being that instead of manually specifying 
joins, you could treat a FK field in a table as a pointer and do things 
like:

CREATE TABLE invoice(customer int NOT NULL REFERENCES(customer));

SELECT invoice.*, customer->first_name, customer->last_name, ...
   FROM invoice;

If we had that capability, there would be less need for ENUMs.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com


Commits

  1. Relax transactional restrictions on ALTER TYPE ... ADD VALUE (redux).

  2. Partially restore comments discussing enum renumbering hazards.

  3. Allow adding values to an enum type created in the current transaction.