When a trigger is present in both databases, dumpAlterTrigger is called so that it can correct internal differences between these triggers. This makes sense, as this pattern is used very consistently in the entire codebase
However dumpAlterTrigger from trigger.c emits ALTER command unconditionally:
Steps to reproduce:
I would expect empty output since a database is always identical to itself.
However,
pgquarrel
responds with:which is redundant, because the suggested rename does not change the name.
The reason for this behaviour is visible here in quarrel.c, extract below:
When a trigger is present in both databases,
dumpAlterTrigger
is called so that it can correct internal differences between these triggers. This makes sense, as this pattern is used very consistently in the entire codebaseHowever
dumpAlterTrigger
from trigger.c emitsALTER
command unconditionally:So, in fact, when an identical trigger is present in both databases, a no-op
ALTER TRIGGER ... RENAME
is still produced.Proposed solution:
I suggest wrapping the two
fprint
calls that emit theALTER TRIGGER ... RENAME
with a test whether the rename is actually required: