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 1oTcny-00029A-0E for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 05:31:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oTcnw-00078S-SZ for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 05:31:52 +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 1oTcnw-00078G-JZ for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 05:31:52 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oTcnu-00049E-GN for pgsql-hackers@postgresql.org; Thu, 01 Sep 2022 05:31:52 +0000 Received: by mail-io1-xd34.google.com with SMTP id h78so13693598iof.13 for ; Wed, 31 Aug 2022 22:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date; bh=C8Tk9QqFI+iSIWKZtq0dQQWQirx2K4UX6in951OoPm4=; b=C9u78euWWtz2xD8PbJ/uMw5HmKEhqbHQjEsRiR0FjJ5iZ4wp51l1aJNZ7PYjsCN+vg kIneva7y08gIgxvNtcIHsu5g/al+NRale+GLUpjmq8ZA/bJz8zXxCKSnWzvWlL7p5bAo FVRJ6cImd6s4RtxI0+PsISTMAEmtrsK7t1RJBkBbPj7EfaR+cq0wqHHnw5AJsyF86kgf dEXNmIl0CHP1SPEIWvrQ0jKivRKDXH69j08d2U2odV1lkxFLCdygdMtWWUIKCbb8Q9rk UWwBE3VRNIsfZOH7wOgTKfg5TYZU4mTaOGb1v/Jd0/aeDIUsC3w2ddm5a7Dr3PwkQcIK 3V7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date; bh=C8Tk9QqFI+iSIWKZtq0dQQWQirx2K4UX6in951OoPm4=; b=xqCpfb1yN/qouZyDSKEwtFBghy5mhkv3bcBZ/09ph2YGA/aiZuZgbKO+/SrDV4KLZ2 w8RzPoUNC0H+q1mGe4LON7Zr5X14apxK/J/NdF3qprfgMh5PDssxqXvwiUSDFC6WqE2k 8t+gPA9xu/QWG62R8eWnlVpa0FUBYfqMEZG3X/OYEhnXSGjzLLkRRbWe/YF2/WFo/acM 0KPsuIkAUMRDSkYVxA2v+up2rXMEz8L9uo4qHfcemgbfRHzEGnrsVuBiB68Fq9CxFBnx 2q3hw79mD651xsGxgfFT54HG3wSCF1q1H8wGoAuU2Y6sZsF2h77CfBA9MT8Ae10xAvkO F4bQ== X-Gm-Message-State: ACgBeo0qoQbomw4vgkpnpxyopuDU895xhh4Mn1VwNnOsMfuWkTpNxDJj eGNDHew2WQohdbLzLA9w71knOg== X-Google-Smtp-Source: AA6agR4UfGIitG5eqmyzv/pOStvcER+Z7hTDil7JQdE0L1hm6XeV3swxw5QY8LWIFgOt/FpLmQx2Xg== X-Received: by 2002:a05:6638:130f:b0:346:b950:cef4 with SMTP id r15-20020a056638130f00b00346b950cef4mr16923996jad.59.1662010308426; Wed, 31 Aug 2022 22:31:48 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id a25-20020a02ac19000000b00349d85eaa89sm1815089jao.20.2022.08.31.22.31.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Aug 2022 22:31:47 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id DC565801058; Thu, 1 Sep 2022 00:31:46 -0500 (CDT) Date: Thu, 1 Sep 2022 00:31:46 -0500 From: Justin Pryzby To: David Rowley Cc: pgsql-hackers@postgresql.org, Tomas Vondra , Peter Smith , Alvaro Herrera Subject: Re: FOR EACH ROW triggers, on partitioend tables, with indexes? Message-ID: <20220901053146.GI31833@telsasoft.com> References: <20220819211824.GX26426@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Sep 01, 2022 at 04:19:37PM +1200, David Rowley wrote: > On Sat, 20 Aug 2022 at 09:18, Justin Pryzby wrote: > > Is it somwhow possible to call CreateTrigger() to create a FOR EACH ROW > > trigger, with an index, and not internally ? > > I've been looking over this and I very much agree that the code looks > very broken. As for whether this is dead code or not, I've been > looking at that too... > > At trigger.c:1147 we have: if (partition_recurse). partition_recurse > can only ever be true if isInternal == false per trigger.c:367's > "partition_recurse = !isInternal && stmt->row &&". isInternal is a > parameter to the function. Also, the code in question only triggers > when the indexOid parameter is a valid oid. So it should just be a > matter of looking for usages of CreateTriggerFiringOn() which pass > isInternal as false and pass a valid indexOid. > > There seems to be no direct calls doing this, but we do also call this > function via CreateTrigger() and I can see only 1 call to > CreateTrigger() that passes isInternal as false, but that explicitly > passes indexOid as InvalidOid, so this code looks very much dead to > me. > > Alvaro, any objections to just ripping this out? aka, the attached. It's possible that extensions or 3rd party code or forks use this, no ? In that case, it might be "not dead" .. > + * that ever changes then we'll need to quite code here to find the quite? write? quire? acquire? quine? -- Justin