mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Add OAT hook calls for more subcommands of ALTER TABLE
The OAT hooks are added in ALTER TABLE for the following subcommands: - { ENABLE | DISABLE | [NO] FORCE } ROW LEVEL SECURITY - { ENABLE | DISABLE } TRIGGER - { ENABLE | DISABLE } RULE. Note that there was hook for pg_rewrite, but not for relation ALTER'ed in pg_class. Tests are added to test_oat_hook for all the subcommand patterns gaining hooks here. Based on an ask from Legs Mansion. Discussion: https://postgr.es/m/tencent_083B3850655AC6EE04FA0A400766D3FE8309@qq.com
This commit is contained in:
@ -14843,6 +14843,9 @@ ATExecEnableDisableTrigger(Relation rel, const char *trigname,
|
||||
EnableDisableTrigger(rel, trigname, InvalidOid,
|
||||
fires_when, skip_system, recurse,
|
||||
lockmode);
|
||||
|
||||
InvokeObjectPostAlterHook(RelationRelationId,
|
||||
RelationGetRelid(rel), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -14855,6 +14858,9 @@ ATExecEnableDisableRule(Relation rel, const char *rulename,
|
||||
char fires_when, LOCKMODE lockmode)
|
||||
{
|
||||
EnableDisableRule(rel, rulename, fires_when);
|
||||
|
||||
InvokeObjectPostAlterHook(RelationRelationId,
|
||||
RelationGetRelid(rel), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -16134,6 +16140,9 @@ ATExecSetRowSecurity(Relation rel, bool rls)
|
||||
((Form_pg_class) GETSTRUCT(tuple))->relrowsecurity = rls;
|
||||
CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
|
||||
|
||||
InvokeObjectPostAlterHook(RelationRelationId,
|
||||
RelationGetRelid(rel), 0);
|
||||
|
||||
table_close(pg_class, RowExclusiveLock);
|
||||
heap_freetuple(tuple);
|
||||
}
|
||||
@ -16160,6 +16169,9 @@ ATExecForceNoForceRowSecurity(Relation rel, bool force_rls)
|
||||
((Form_pg_class) GETSTRUCT(tuple))->relforcerowsecurity = force_rls;
|
||||
CatalogTupleUpdate(pg_class, &tuple->t_self, tuple);
|
||||
|
||||
InvokeObjectPostAlterHook(RelationRelationId,
|
||||
RelationGetRelid(rel), 0);
|
||||
|
||||
table_close(pg_class, RowExclusiveLock);
|
||||
heap_freetuple(tuple);
|
||||
}
|
||||
|
Reference in New Issue
Block a user