Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i991H-0001EQ-Ie for pgsql-general@arkaria.postgresql.org; Sat, 14 Sep 2019 14:27:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i991E-0001kf-W4 for pgsql-general@arkaria.postgresql.org; Sat, 14 Sep 2019 14:27:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i991D-0001kM-3s for pgsql-general@lists.postgresql.org; Sat, 14 Sep 2019 14:27:20 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i9919-0005L0-IC for pgsql-general@lists.postgresql.org; Sat, 14 Sep 2019 14:27:17 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0317720D89; Sat, 14 Sep 2019 10:27:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 14 Sep 2019 10:27:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=C 9EmYwGn2nUrD9gl99lzVN5Kj+dt+IT0CoPCwugD5/s=; b=ZYpbkM9/SlKyGQOqf ks+aIijAVkEK2nt6xL2YRQGFQLjUj1ZD+c/iEqs6eTczWRSOHpb6pfofYs+td6tP lD2fQXb9qQDTrSQ6LAKHdqnYPMcofnLvJPpJ475Yuyf5G4JmitVtibXeIckfMyQH augP7WuYNRlh2M0wokRgOOPSP6i2WNQCwkCZDXbhY2nLU9pr/hsdIuEeYmFLTwTM Zi7ezaXM9j2GO31KDjgVFagi8qhd4u+pS3bAteUNv0Uj83u93iVFx3samErU5Ry4 /AiAIxpDu2uvz0ROptaTP3R1ilWRdg+3K0aDdQW94gQfEDzZIRNnxN4H+gEiyvD0 6BS5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=C9EmYwGn2nUrD9gl99lzVN5Kj+dt+IT0CoPCwugD5 /s=; b=YWP2Rf+flJHA61xdsJDph5e9K3/otVdZpduocZrTy8pbqml9BaBqGUoMc Tgx8oJtgObAqWcku+HJ+2OEwS2B9h6ky/VMG2GEU7XVNaOAxnVOe+1Tusd5bfVSL 3Db3eJD+hBbrBuW658G+wUqLi///x1mZ3sEzufB3Sw6T6IOILkeFFLububo3KPqj 7XWunxeEjgv5uuy5sgCgbdDVqmcmfWhzF+aSad7EhOPAAaYMTZwXJBQLTza3SuHM MMOJzkGg85tz0m/Uq1rsxCa88rnMSOHKXl3VzUVv0Lwixb6xoiYykWcbzcf6MWDK Hzc4P5k0NTE3yCjT2lEyafj6Z/CoQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrtdelgdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgnecukfhppedujeegrddvuddruddvledrudejheenucfrrghrrghmpehmrghi lhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.3] (174-21-129-175.tukw.qwest.net [174.21.129.175]) by mail.messagingengine.com (Postfix) with ESMTPA id 1EAFC8005B; Sat, 14 Sep 2019 10:27:13 -0400 (EDT) Subject: Re: Cascade Trigger Not Firing To: Judy Loomis , Tom Lane Cc: pgsql-general@lists.postgresql.org References: <21219.1568401729@sss.pgh.pa.us> <20933.1568408581@sss.pgh.pa.us> From: Adrian Klaver Message-ID: <583b352c-f22a-e5b6-3ddc-40e298267b4d@aklaver.com> Date: Sat, 14 Sep 2019 07:27:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/13/19 8:07 PM, Judy Loomis wrote: > At the very least that note about this behavior should be highlighted, > probably on the Trigger Behavior page and not buried in a bunch of notes > on the Create Trigger page. I know this after the fact. Still, as a general rule the best place to start when learning about a command is on it's respective page under here: https://www.postgresql.org/docs/11/sql-commands.html Further I usually go to the Notes after reading the synopsis, as Notes is where the exceptions to the rules and gotchas are called out. > > > > On Fri, Sep 13, 2019 at 4:03 PM Tom Lane > wrote: > > Judy Loomis > > writes: > > I'm going to have to really look at all my BEFORE UPDATE triggers > and make > > sure we're not missing any more. > > And I have to stop telling management that a trigger means we > always know > > when a value changes. > > Well, you can rely on that, just not like this.  Use an AFTER trigger > (else, you can't be sure it fires after all the BEFORE triggers) > and instead of triggering it with a column parameter, have it do > something like "if old.col is distinct from new.col". > > Yeah, it's a bit slower that way, but there's no free lunch, > especially if you don't trust your other triggers.  (Although, > if you have so many triggers that that's a problem, I think you > might have some other design issues.) > >                         regards, tom lane > > > > -- > > ---------------------------------------------------------- > *Judy Loomis* > 469.235.5839 -- Adrian Klaver adrian.klaver@aklaver.com