On Mon, May 11, 2020 at 05:13:38PM -0700, David G. Johnston wrote:
> Skimming through the code in event_trigger.c and noticed that while most of
> the stanzas that reference IsUnderPostmaster refer back to the code comment
> beginning on line 675 the block for table rewrite copied it in
> verbatim starting at line 842. The currentEventTriggerState comment at
> lines 730 and 861 seem to be the same too.
An even more interesting part here is that EventTriggerDDLCommandEnd()
and Drop() have basically the same comments, but they tell to refer
back toEventTriggerDDLCommandStart(). So let's just do the same for
all the exact duplicate in EventTriggerTableRewrite().
The second point about the check with (!currentEventTriggerState) in
EventTriggerTableRewrite() and EventTriggerDDLCommandEnd() shows that
both comments share the same first sentence, but there is enough
different context to just keep them as separate IMO.
> I did also notice a difference with the test on line 861 compared to line
> 785 though I unable to evaluate whether the absence of a "rewriteList" is
> expected (there is a "dropList" at 785 ...).
An event table rewrite happens only for one relation at a time.
In short, something like the attached sounds enough to me. What do
you think?
--
Michael