Re: Event trigger code comment duplication

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Event trigger code comment duplication
Дата
Msg-id CAKFQuwbJGzFUmMcHaiz4ZFKSFurw_5775pBa7hdVmBWb5gOttg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Event trigger code comment duplication  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: Event trigger code comment duplication  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Mon, May 11, 2020 at 11:30 PM Michael Paquier <michael@paquier.xyz> wrote:
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.

Went back and looked this over - the comment differences in the check for currentEventTriggerState boil down to:

the word "required" vs "important" - either works for both.

the fact that the DDLCommandEnd function probably wouldn't crash absent the check - which while I do not know whether DDLTriggerRewrite would crash for certain (hence the "required") as a practical matter it is required (and besides if keeping note of which of these would crash or not is deemed important that can be commented upon specifically in each - both DDLCommandStart (which lacks the check altogether...) and SQLDrop both choose not to elaborate on that point at all.

Whether its a style thing, or some requirement of the C-language, I found it odd that the four nearly identical checks were left inline in the functions instead of being pulled out into a function.  I've attached a conceptual patch that does just this and more clearly presents on my thoughts on the topic.  In particular I tried to cleanup the quadruple negative sentence (and worse for the whole paragraph) as part of the refactoring of the currentEventTriggerState comment.

David J.
Вложения

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

Предыдущее
От: Isaac Morland
Дата:
Сообщение: Re: Our naming of wait events is a disaster.
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: new heapcheck contrib module