Skip to content

Commit af3ee8a

Browse files
committed
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
1 parent c2ba3fd commit af3ee8a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/backend/parser/gram.y

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6412,6 +6412,33 @@ AlterEnumStmt:
64126412
n->skipIfNewValExists = false;
64136413
$$ = (Node *) n;
64146414
}
6415+
| ALTER TYPE_P any_name DROP VALUE_P Sconst
6416+
{
6417+
/*
6418+
* The following problems must be solved before this can be
6419+
* implemented:
6420+
*
6421+
* - There must be no instance of the target value in
6422+
* any table.
6423+
*
6424+
* - The value must not appear in any catalog metadata,
6425+
* such as stored view expressions or column defaults.
6426+
*
6427+
* - The value must not appear in any non-leaf page of a
6428+
* btree (and similar issues with other index types).
6429+
* This is problematic because a value could persist
6430+
* there long after it's gone from user-visible data.
6431+
*
6432+
* - Concurrent sessions must not be able to insert the
6433+
* value while the preceding conditions are being checked.
6434+
*
6435+
* - Possibly more...
6436+
*/
6437+
ereport(ERROR,
6438+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
6439+
errmsg("dropping an enum value is not implemented"),
6440+
parser_errposition(@4)));
6441+
}
64156442
;
64166443

64176444
opt_if_not_exists: IF_P NOT EXISTS { $$ = true; }

0 commit comments

Comments
 (0)