Re: Clarification of triggers with 'OF column_name' in 'Overview of Trigger Behavior'

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Josh Silver <josh(dot)ag(at)paladin(dot)insure>
Cc: Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Clarification of triggers with 'OF column_name' in 'Overview of Trigger Behavior'
Date: 2022-05-03 02:10:53
Message-ID: CAKFQuwbXC89bF+ZeoGGdWFamq3m_BHYqS2ZtALORfGHRZCmp3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Mon, May 2, 2022 at 6:55 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> On Mon, May 2, 2022 at 6:33 PM Josh Silver <josh(dot)ag(at)paladin(dot)insure> wrote:
>
>>
>> and the 'Overview of Trigger Behavior pages says of before triggers
>>
>>> In row-level triggers the WHEN condition can examine the old and/or new
>>> values of columns of the row. (Statement-level triggers can also have
>>> WHEN conditions, although the feature is not so useful for them.) In a
>>> BEFORE trigger, the WHEN condition is evaluated just before the
>>> function is or would be executed, so using WHEN is not materially
>>> different from testing the same condition at the beginning of the trigger
>>> function.
>>
>>
>> but does not even mention column specific triggers by name.
>>
>>
> The previous paragraph reads in part:
>
> "If more than one trigger is defined for the same event on the same
> relation, the triggers will be fired in alphabetical order by trigger name."
>
> I'll say that we don't provide a granular definition of what an "event" is
> here - namely the "INSERT/UPDATE/DELETE/SELECT + any column limitation".
>
> So, it is covered if you understand the column aspect is rolled into
> "trigger event".
>
>
And, given the existing length and depth of content of that page already
I'm doubtful that introducing the corner-case of UPDATE OF (col) into that
section, in the level of detail provided in CREATE TRIGGER, is a net
positive. I'd probably leave the detail where it is, note that "UPDATE OF
(col)" exists as a distinct event type that modifies a plain UPDATE
TRIGGER's event check, and direct the reader to the specifics in CREATE
TRIGGER should they feel the need to use the more specific form. Nothing
in the "Overview" page is negated just because a column is specified on the
UPDATE trigger.

David J.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Josh Silver 2022-05-03 03:33:48 Re: Clarification of triggers with 'OF column_name' in 'Overview of Trigger Behavior'
Previous Message David G. Johnston 2022-05-03 01:55:09 Re: Clarification of triggers with 'OF column_name' in 'Overview of Trigger Behavior'