Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nli0W-0003Sd-0C for pgsql-docs@arkaria.postgresql.org; Tue, 03 May 2022 02:11:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nli0U-0004rM-U8 for pgsql-docs@arkaria.postgresql.org; Tue, 03 May 2022 02:11:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nli0U-0004rD-Jb for pgsql-docs@lists.postgresql.org; Tue, 03 May 2022 02:11:18 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nli0Q-0008L7-8x for pgsql-docs@lists.postgresql.org; Tue, 03 May 2022 02:11:18 +0000 Received: by mail-ej1-x62a.google.com with SMTP id k23so30956112ejd.3 for ; Mon, 02 May 2022 19:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+cj5Oqnh6DTKMOmZMpaSApolbz0hgU557TeQpAEdsC0=; b=X5OBI7JECpEjIDcz71oiej78YUHXe1drWrPrCFs8oCvEH+lez+fmtwmwM0/Fqrr3mH cMNL0GF97CgOouO2FSfNOIm19zm2rl1+ZZYSuFZJQFkQb8uNSWkcs6pytUKbIoA0nCR9 Hxp5kKXP3pVTzOWJ8YXGFPFErWunABjGrkjnpI21c1EPAOC0Zq89OGIp2DAh8wUqisoW 3JVKrmezyhYH/QmK9kTZ8xljKHsxcliqdoZOgH1zOzVcolKnMBgu6mmZHTuio6hF7e1B qjyhZs0MBQgyJ5WX3REE7K0wMgjjoGMdU8sinqScPiXCnkJGHVSxWr1Vo5PGyepTcRMx w3TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+cj5Oqnh6DTKMOmZMpaSApolbz0hgU557TeQpAEdsC0=; b=mtpkK3ZVQHt/IxuvyQ2J4x2kh+TBBoO/wv8QDJ9Xg61a1t7WM3H8fJiXkall5sj7YS kNdez1zB4ih9foiDrnLCuhMCpLyjgnvG6yWajLNWbRZQ0O65A85eL4XYQGQx5B1qVivf b7fVD4V36g/Zztl2XC4zCZxICE0OMeLLkQq86aSYFfjXvm2x+2ovvICWHatGHR/jZu3l i0mm4Wt4SHZzVfM7KOXFiciBrLHi9msWjTHLpOqNguBRvXiMaC+uXOmKmTSU4++ak7G5 dp2B54z6tGd+Qccp/K+8W+yAKZ3w6xTJmruschG2RYEzk0Wg6Rd5hmrOcAc4rQxkoFEB foLA== X-Gm-Message-State: AOAM531rF8p7umc8jNBT3SN07n3LYuYXbwjsPhXVXV4wlRHPVqMjCI9l umO1IANZYSgnpE3WFSsWx3TO+3K3oDFJSDxbO+hydTI9 X-Google-Smtp-Source: ABdhPJy4Sj4VRhHexNMgSxIJtE784jmfsyVyHTNkhQYQ2FjqGrNhW0/Iz8+KkEDgLZln9UL4seHfSyv8G9amZqfk80M= X-Received: by 2002:a17:906:8301:b0:6e4:896d:59b1 with SMTP id j1-20020a170906830100b006e4896d59b1mr13251100ejx.396.1651543872291; Mon, 02 May 2022 19:11:12 -0700 (PDT) MIME-Version: 1.0 References: <165151321896.685.16545084197561479198@wrigleys.postgresql.org> In-Reply-To: From: "David G. Johnston" Date: Mon, 2 May 2022 19:10:53 -0700 Message-ID: Subject: Re: Clarification of triggers with 'OF column_name' in 'Overview of Trigger Behavior' To: Josh Silver Cc: Pg Docs Content-Type: multipart/alternative; boundary="000000000000d6c5f105de120552" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d6c5f105de120552 Content-Type: text/plain; charset="UTF-8" On Mon, May 2, 2022 at 6:55 PM David G. Johnston wrote: > On Mon, May 2, 2022 at 6:33 PM Josh Silver 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. --000000000000d6c5f105de120552 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, May 2, 2022 at 6:55 PM David G. Johnston <david.g.johnston@gmail.com>= wrote:
On Mon, May 2, 2022 at 6:33 PM Josh Silver <jo= sh.ag@paladin.insure> wrote:

and th= e=C2=A0 'Overview of Trigger Behavior pages says of before triggers
= In row-level triggers the=C2=A0WHEN=C2=A0condition can examine the old and/or new = values of columns of the row. (Statement-level triggers can also have=C2=A0= WHEN=C2= =A0conditions, although the feature is not so useful for them.) In a=C2=A0<= /span>BEFORE= =C2=A0trigger, the=C2=A0WHEN=C2=A0condition is evaluated just before the function = is or would be executed, so using=C2=A0=C2=A0is not materially different from = testing the same condition at the beginning of the trigger function.=
=C2=A0
but does not even mention=C2=A0column sp= ecific triggers by name.

=
The previou= s paragraph reads in part:

= "If more than one trigger is defined for the same event on the same re= lation, the triggers will be fired in alphabetical order by trigger name.&q= uot;

<= div style=3D"font-family:arial,helvetica,sans-serif">I'll say that we d= on't provide a granular definition of what an "event" is here= - namely the "INSERT/UPDATE/DELETE/SELECT=C2=A0+ any column limitatio= n".

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 p= rovided in CREATE TRIGGER, is a net positive.=C2=A0 I'd probably leave = the detail where it is, note that=C2=A0 "UPDATE OF (col)" exists = as a distinct event type that modifies a plain UPDATE TRIGGER's event c= heck, and direct the reader to the specifics in CREATE TRIGGER should they = feel the need to use the more specific form.=C2=A0 Nothing in the "Ove= rview" page is negated just because a column is specified on the UPDAT= E trigger.

David J.

--000000000000d6c5f105de120552--