I like the idea, during prototype I added additional column and modified
enum_in method. But enum_in is called in contexts that can be important
for user (like comparisons).
Example:
postgres=# CREATE TYPE test_enum AS enum ('1', '2', '3');
CREATE TYPE
postgres=# CREATE TABLE test_table ( value test_enum );
postgres=# INSERT INTO test_table VALUES ('1'), ('2'), ('3');
INSERT 0 3
postgres=# ALTER TYPE test_enum DELETE VALUE '2';
ALTER TYPE
postgres=# INSERT INTO test_table VALUES ('2');
ERROR: enum value is dropped test_enum: "2"
LINE 1: INSERT INTO test_table VALUES ('2');
postgres=# SELECT * FROM test_table WHERE value = '2';
ERROR: enum value is dropped test_enum: "2"
LINE 1: SELECT * FROM test_table WHERE value = '2';
postgres=# UPDATE test_table SET value = '3' WHERE value = '2';
ERROR: enum value is dropped test_enum: "2"
LINE 1: UPDATE test_table SET value = '3' WHERE value = '2';
Probably we need to make more specific change for enum type to prevent
using of dropped column in context of insert or update (where we
creating dropped enum value), but not in others.
Is that possible ? What places should I look into ? Thanks.
Best regards,
Maksim Kita