Remove buggy and dead code from CreateTriggerFiringOn Here we remove some dead code from CreateTriggerFiringOn() which was attempting to find the relevant child partition index corresponding to the given indexOid. As it turned out, thanks to -Wshadow=compatible-local, this code was buggy as the code which was finding the child indexes assigned those to a shadowed variable that directly went out of scope. The code which thought it was looking at the List of child indexes was always referencing an empty List.
On further investigation, this code is dead. We never call CreateTriggerFiringOn() passing a valid indexOid in a way that the function would actually ever execute the code in question. So, for lack of a way to test if a fix actually works, let's just remove the dead code instead. As a reminder, if there is ever a need to resurrect this code, an Assert() has been added to remind future feature developers that they might need to write some code to find the corresponding child index. Reported-by: Justin Pryzby Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/20220819211824.gx26...@telsasoft.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/16d69ec29b1199831c74504845f5d6117dbfc738 Modified Files -------------- src/backend/commands/trigger.c | 44 +++++------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-)