diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2023-10-03 11:41:42 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2023-10-03 11:41:42 -0400 |
commit | af3ee8a086ca210d9461f813538d0169dbf07c2c (patch) | |
tree | 89e5492a1dbce4e2bcb387e64ce30e4a3138c642 | |
parent | c2ba3fdea5938dff96ca32ed7a4a83c8ff5f188d (diff) | |
download | postgresql-af3ee8a086ca210d9461f813538d0169dbf07c2c.tar.gz postgresql-af3ee8a086ca210d9461f813538d0169dbf07c2c.zip |
Add some notes about why "ALTER TYPE enum DROP VALUE" is hard.
In hopes of putting these where any would-be implementer is sure to
find them, make a placeholder grammar production for ALTER DROP VALUE
and put them there. This is really just a docs patch, though.
Vik Fearing, with a bit more wordsmithing by me
Discussion: https://postgr.es/m/9fffd149-da0f-0c9c-6745-731fb688642a@postgresfriends.org
-rw-r--r-- | src/backend/parser/gram.y | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index fec9b2604fe..e56cbe77cb7 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -6412,6 +6412,33 @@ AlterEnumStmt: n->skipIfNewValExists = false; $$ = (Node *) n; } + | ALTER TYPE_P any_name DROP VALUE_P Sconst + { + /* + * The following problems must be solved before this can be + * implemented: + * + * - There must be no instance of the target value in + * any table. + * + * - The value must not appear in any catalog metadata, + * such as stored view expressions or column defaults. + * + * - The value must not appear in any non-leaf page of a + * btree (and similar issues with other index types). + * This is problematic because a value could persist + * there long after it's gone from user-visible data. + * + * - Concurrent sessions must not be able to insert the + * value while the preceding conditions are being checked. + * + * - Possibly more... + */ + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("dropping an enum value is not implemented"), + parser_errposition(@4))); + } ; opt_if_not_exists: IF_P NOT EXISTS { $$ = true; } |