Re: Event trigger code comment duplication

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Event trigger code comment duplication
Дата
Msg-id 20200512063009.GJ88791@paquier.xyz
обсуждение исходный текст
Ответ на Event trigger code comment duplication  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Event trigger code comment duplication  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: tablespace_map code cleanup
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: Transactions involving multiple postgres foreign servers, take 2