Re: Allow deleting enum value
От | Maksim Kita |
---|---|
Тема | Re: Allow deleting enum value |
Дата | |
Msg-id | 20201007204707.GA210713@yetti обсуждение исходный текст |
Ответ на | Re: Allow deleting enum value (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Allow deleting enum value
|
Список | pgsql-hackers |
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
Вложения
В списке pgsql-hackers по дате отправления: