mirror of https://github.com/citusdata/citus.git
Merge pull request #3719 from citusdata/stricter-trigger-checks
Verify trigger relation before reading old/new tuplespull/3738/head
commit
76a8a3c7c9
|
@ -2558,6 +2558,12 @@ master_dist_partition_cache_invalidate(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
CheckCitusVersion(ERROR);
|
CheckCitusVersion(ERROR);
|
||||||
|
|
||||||
|
if (RelationGetRelid(triggerData->tg_relation) != DistPartitionRelationId())
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
|
||||||
|
errmsg("triggered on incorrect relation")));
|
||||||
|
}
|
||||||
|
|
||||||
HeapTuple newTuple = triggerData->tg_newtuple;
|
HeapTuple newTuple = triggerData->tg_newtuple;
|
||||||
HeapTuple oldTuple = triggerData->tg_trigtuple;
|
HeapTuple oldTuple = triggerData->tg_trigtuple;
|
||||||
|
|
||||||
|
@ -2619,6 +2625,12 @@ master_dist_shard_cache_invalidate(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
CheckCitusVersion(ERROR);
|
CheckCitusVersion(ERROR);
|
||||||
|
|
||||||
|
if (RelationGetRelid(triggerData->tg_relation) != DistShardRelationId())
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
|
||||||
|
errmsg("triggered on incorrect relation")));
|
||||||
|
}
|
||||||
|
|
||||||
HeapTuple newTuple = triggerData->tg_newtuple;
|
HeapTuple newTuple = triggerData->tg_newtuple;
|
||||||
HeapTuple oldTuple = triggerData->tg_trigtuple;
|
HeapTuple oldTuple = triggerData->tg_trigtuple;
|
||||||
|
|
||||||
|
@ -2680,6 +2692,23 @@ master_dist_placement_cache_invalidate(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
CheckCitusVersion(ERROR);
|
CheckCitusVersion(ERROR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Before 7.0-2 this trigger is on pg_dist_shard_placement,
|
||||||
|
* ignore trigger in this scenario.
|
||||||
|
*/
|
||||||
|
Oid pgDistShardPlacementId = get_relname_relid("pg_dist_shard_placement",
|
||||||
|
PG_CATALOG_NAMESPACE);
|
||||||
|
if (RelationGetRelid(triggerData->tg_relation) == pgDistShardPlacementId)
|
||||||
|
{
|
||||||
|
PG_RETURN_DATUM(PointerGetDatum(NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RelationGetRelid(triggerData->tg_relation) != DistPlacementRelationId())
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
|
||||||
|
errmsg("triggered on incorrect relation")));
|
||||||
|
}
|
||||||
|
|
||||||
HeapTuple newTuple = triggerData->tg_newtuple;
|
HeapTuple newTuple = triggerData->tg_newtuple;
|
||||||
HeapTuple oldTuple = triggerData->tg_trigtuple;
|
HeapTuple oldTuple = triggerData->tg_trigtuple;
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ task_tracker_cleanup_job(PG_FUNCTION_ARGS)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* task_tracker_conninfo_cache_invalidate is a trigger function that signals to
|
* task_tracker_conninfo_cache_invalidate is a trigger function that signals to
|
||||||
* the task tracker to refresh its conn params cache after a authinfo change.
|
* the task tracker to refresh its conn params cache after an authinfo change.
|
||||||
*
|
*
|
||||||
* NB: We decided there is little point in checking permissions here, there
|
* NB: We decided there is little point in checking permissions here, there
|
||||||
* are much easier ways to waste CPU than causing cache invalidations.
|
* are much easier ways to waste CPU than causing cache invalidations.
|
||||||
|
|
Loading…
Reference in New Issue