mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Unify drop-by-OID functions
There are a number of Remove${Something}ById() functions that are essentially identical in structure and only different in which catalog they are working on. Refactor this to be one generic function. The information about which oid column, index, etc. to use was already available in ObjectProperty for most catalogs, in a few cases it was easily added. Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/331d9661-1743-857f-1cbb-d5728bcd62cb%402ndquadrant.com
This commit is contained in:
@ -355,28 +355,6 @@ filter_list_to_array(List *filterlist)
|
||||
-1, false, TYPALIGN_INT));
|
||||
}
|
||||
|
||||
/*
|
||||
* Guts of event trigger deletion.
|
||||
*/
|
||||
void
|
||||
RemoveEventTriggerById(Oid trigOid)
|
||||
{
|
||||
Relation tgrel;
|
||||
HeapTuple tup;
|
||||
|
||||
tgrel = table_open(EventTriggerRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCache1(EVENTTRIGGEROID, ObjectIdGetDatum(trigOid));
|
||||
if (!HeapTupleIsValid(tup))
|
||||
elog(ERROR, "cache lookup failed for event trigger %u", trigOid);
|
||||
|
||||
CatalogTupleDelete(tgrel, &tup->t_self);
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
table_close(tgrel, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
* ALTER EVENT TRIGGER foo ENABLE|DISABLE|ENABLE ALWAYS|REPLICA
|
||||
*/
|
||||
|
Reference in New Issue
Block a user