Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRlhX-002g19-1D for pgsql-hackers@arkaria.postgresql.org; Tue, 26 May 2026 06:55:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wRlhV-003WgL-0m for pgsql-hackers@arkaria.postgresql.org; Tue, 26 May 2026 06:55:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wRlhU-003WgD-36 for pgsql-hackers@lists.postgresql.org; Tue, 26 May 2026 06:55:41 +0000 Received: from mail-dy1-x1335.google.com ([2607:f8b0:4864:20::1335]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wRlhT-00000000ofv-2kv9 for pgsql-hackers@lists.postgresql.org; Tue, 26 May 2026 06:55:40 +0000 Received: by mail-dy1-x1335.google.com with SMTP id 5a478bee46e88-2f33ae12f97so830444eec.1 for ; Mon, 25 May 2026 23:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779778538; x=1780383338; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QjCKidi5OvjFWXfn3AJOUKmN8/ZTNHLf8z/YdT14uNk=; b=RqL4cJ/A8TtlPAx5OEqtr+n/5OIYkGluix+IiWsbHrhbv30HvdO97DFSwKohwKlJRD uyX2qKrDVVq65X2hSxexdt0WAXDvgEocsXELAYXheK6U2DTYSU8IPIvI2LMgDB69Ooup v9hivIoeePEPNeYKnkmN2fA9gf0PqXKFhrcqJ2jTi+l9ghl+wAXwMLKmn8zAQmbz3Mzl O0XCytgvHBvuoLiNmyYNfLzUS994QxOa2IAGlxj3NlITThLSTts+njWCzwll95umg2KL Fql1HwQtwDElwc2dIztL4mncLhoXfh3RgsjDVEplWZlnPJB9Ar4NqAdiGitnfej+Zyel bC+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779778538; x=1780383338; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=QjCKidi5OvjFWXfn3AJOUKmN8/ZTNHLf8z/YdT14uNk=; b=SPC476SSu/KQnvJHZKBsIZnDcTnS5qRQJ1VKRHCUPAkC9Jx3YmXFFDMTC9fRCjZCvB U+IWzGv+OA5L+viKKfUhE7L8xnIDqgtGwTnoK7DGVBoitfrMayVLh8A6r1RmZiVCZpa7 NfwDjeGAcYXyu03ZqvbOKGjm3Sm70/45on1T25KP40OLSV+VRVzo91kkuwHZ2wnl3PIB WYyDKXORtwl2BSfCujRhzIGE+Z+0pUW+XZv9jJRSO9IalxR/fZR645+N/5pbWQudgHbw hjIfc3kBkPpChAcuUxuUbAunDJ1hw5JljUKgCrub2E74lnqJU62R5Nt1MUd3Ojtr/Fai ZdVA== X-Gm-Message-State: AOJu0Yzn3HR2mR7kl/A2GtAzC4pmznt3WSPbuRv6O0E5Q5JV8HCq/wky IP8CiaVX9D6P8EUdCa347wuwkoN5nG2AJXA5J3Hd7KVjP6sJ+1CkqbQU X-Gm-Gg: Acq92OFUHBXq1hRh4XSpCjYVBaWgqd7useH9Jsaaucw/yWzjmOm65YTc3T/tUt/oWFE s2LXbD3126WUpS24+d/dDph8W5I+eo3og0CnueVHcielLdZdgD7YyGwVdrKeOFREUfylv+jzHfj GMTgPdhwpcE6hD9OPptHzOYla7FOMDI+3HgX7yxvMd81p3bVQUeG05vBCifB3O5KBjXrntlWok7 jJoar7JxMngt/hi5aJhsmtDaKlumSMjNLkob8wKJHOXXeHdItYWeM+g64wB5//4x1FeyZayf94s vGdR/PSaPqyZPinYcPOb8afvqDEwWMLMea0BMzjDrY8f0pEY5SY2blSElELp4h230d64kdxgPU/ 5Sx2GqeFkvLW9MOnyPetqK0XwPQAzVoGOxrRvbI+iymceTV6sL+PRFP/kdCxhEh0JJhfG3y5elg nzMtfAs0StvbZj9R7nBAeAHstsTlDnwOD0vdwDYsi7 X-Received: by 2002:a05:7301:9bc8:b0:2c5:b972:b436 with SMTP id 5a478bee46e88-304491848abmr8386038eec.23.1779778537847; Mon, 25 May 2026 23:55:37 -0700 (PDT) Received: from smtpclient.apple ([64.32.14.230]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30451ef4af0sm9644535eec.3.2026.05.25.23.55.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 May 2026 23:55:35 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: Fix bug of UPDATE/DELETE FOR PORTION OF with inheritance tables From: Chao Li In-Reply-To: Date: Tue, 26 May 2026 14:55:01 +0800 Cc: PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: References: <4245F94D-84F1-4E05-BF81-C458A6CF9901@gmail.com> <260A544F-FBD6-40CC-9449-5987049DD2D4@gmail.com> To: Paul A Jungwirth X-Mailer: Apple Mail (2.3864.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On May 26, 2026, at 07:01, Paul A Jungwirth = wrote: >=20 > On Fri, May 8, 2026 at 10:48=E2=80=AFPM Chao Li = wrote: >>=20 >>> On May 7, 2026, at 11:40, Chao Li wrote: >>> After looking into the code, I found that leftover row insertion = only considers the partitioned-table case, where leftovers need to be = inserted through the root relation for partition routing. Plain = inheritance is different, leftover rows should be inserted back into the = actual child relation. >>>=20 >>> While debugging this, I also noticed another issue around mapping = the range column=E2=80=99s attnum. In multiple-inheritance cases, the = range column=E2=80=99s attnum in a child table may be different from the = one in its parent, so we need to use the child=E2=80=99s actual attnum. >>>=20 >>> Please see the attached patch for the fix details and the new tests. = Since I believe this bug was introduced in 19, I=E2=80=99m going to add = it to the open items. >>>=20 >>> Best regards, >>> -- >>> Chao Li (Evan) >>> HighGo Software Co., Ltd. >>> https://www.highgo.com/ >>>=20 >>>=20 >>>=20 >>>=20 >>> >>=20 >> Merged into [1]. >>=20 >> [1] = https://postgr.es/m/CAHg+QDcd=3Dt69gLf9yQexO07EJ2mx0Z70NFHo6h94X1EDA=3DhM0= g@mail.gmail.com >=20 > Here is a new patch for this. I don't think it makes sense to combine > it with the other fix anymore. >=20 > Per [1], we are now checking for UPDATE permission on the FOR PORTION > OF column, so most of that other patch went away, and the fix here can > be done independently. That's what v2 here does. I didn't really > change anything from the v12-0002 patch on that other thread, except > for moving some tests into the other patch (since they had nothing to > do with traditional inheritance). The patch here now passes, whether > applied to master directly or applied on top of v13 from the > updatedCols fix. (Combining them will give a rebase conflict in the > test files, but it's pretty trivial to fix.) >=20 > [1] = https://www.postgresql.org/message-id/CA%2BrenyXyLfvtvVv--hGWGTgzFP%3D-%2B= dPLy4RWvEmioAPyJMM%2Buw%40mail.gmail.com >=20 > Yours, >=20 > --=20 > Paul ~{:-) > pj@illuminatedcomputing.com > Now v2 mixes two separate changes: 1) Adding ExecInitForPortionOf() to address the UPDATE OF trigger issue 2) Fixing the inheritance/leftover bug originally reported in this = thread I=E2=80=99d prefer not to combine these in a single patch. Could you = please split out the refactoring that adds ExecInitForPortionOf() into a = separate patch, with tests showing that the UPDATE OF trigger issue is = fixed? Then I can rework my inheritance/leftover fix on top of that. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/