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 1wS97l-002zHx-1e for pgsql-hackers@arkaria.postgresql.org; Wed, 27 May 2026 07:56:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wS97i-007UOl-0j for pgsql-hackers@arkaria.postgresql.org; Wed, 27 May 2026 07:56:19 +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 1wS97h-007UOc-2j for pgsql-hackers@lists.postgresql.org; Wed, 27 May 2026 07:56:18 +0000 Received: from mail-dl1-x1236.google.com ([2607:f8b0:4864:20::1236]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wS97g-00000000z1t-0kAC for pgsql-hackers@lists.postgresql.org; Wed, 27 May 2026 07:56:17 +0000 Received: by mail-dl1-x1236.google.com with SMTP id a92af1059eb24-135e7f4a295so4535792c88.0 for ; Wed, 27 May 2026 00:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779868574; x=1780473374; 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=nDgjS7/2lDKbeeCp/kxBDDJEgGMNHi79173qmdDpe0A=; b=X3nqa5E3qx3LaJt/BFk/iSnKjJ9lgKKns7bsZ3mBV3MihaPU8hq+I7Cb8VBy7l8bKN gkAgz9gEgGfFUY6dVxk85L/AY6hrpojnFB+37tw7Q4s3rPfILC3Wdr+8GAoMj9fLC0t2 Cl4urMJJrcXwUvI5YUZhz5wY6tsSMnjLKDoRjtN1sSYcvgvikyBgF2RF3Je9hVDDGbIn Rr87BZNyiFhDAzHZunbP3YRKxcbxX1gIZOdrHfab67V/78JrY2j9htBXhTVJTnhfzPhd sKF75WQBqmbReyVFYEX/GihkuBhrS0rO0jya0PsnrXy3WF1pW2x5iXU0QmnM1UZHtR7N yfVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779868574; x=1780473374; 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=nDgjS7/2lDKbeeCp/kxBDDJEgGMNHi79173qmdDpe0A=; b=XMufz9cf8R1JMyIIqkfXWHtvdZFAof7BpkpZ4WDzS2TTf1sct2SbZkrgWU/rbumiA9 lSEztpDp3XGox4gjLMRK22TY7Kh5s+1QbMkmVLWTLPPmjQlrlO3U/hfglCU3CRPec5fU GyHbXm8BOWD50bY817cbHLPcUwuuowyCoCsJhht9yOk03imKt21kQYKNvJPqtNbnHJGb +IC1RmqdTJPJyQpzEnU3glLJn6mkmlc9yxwmCUD49DZj+mI021+sh4qayK9UwTRJ7YZr LCNaowuco0L9V2Vv9ySravW+2IRwd4AvALJPSIkIrqD0f+Y3bEKdw3k6N9aMxNq5XN3a J5ag== X-Gm-Message-State: AOJu0YxJGl7oG8fZ4RmGSBNprpZeMKLdk+mtON6gQeTcKqK3jqjjZJPE JwEyln8usdPtXBHH7gToSQIW9uIam4L22urn5ZRPpbocj75r2UCWINVm X-Gm-Gg: Acq92OGF90Rsh3rYZGrxVRR4H6A93rhf82BuGQfthlaueW9Pv2y+MfQo/XAwsc+XTRm nVqXNyu1pVfZKJjagoJayotO1kWlDc2mXAU4PF68cc9qpUHM3dyux+0rN1KgpJjbSK/3sVGE7wi wj2GkmMzV/ltmKqc80eGsgIIJ36AUM+t7NyMMYeHuUH3XOgfTks+CVTxsMGygnndqz3mwqUhqM7 lcpbPzesInmsDLkNiSLk0jzlK/nFbKQ+9RpZbaJroplVnEy6NAyiMLj9LfKJgVnpdcRtjcLpvuA 3s5ry7H14RVQJk6gvSZgKdevIcACblm2Y44sbpyLsCwccVS6J6kqkbztmQIOdSpcyNaYY6LI8/q QLsGeBMx6tCTdfYQcm+yVEbnrufbVzc8bFnnO2Xq6mP/8Ym1EJQO7jEEFyrN4HkXliKEgoqE3L3 ceBAO/73SvAZh1J+L+t0DoOx5Q5HxfZw== X-Received: by 2002:a05:7022:e09:b0:133:54fb:6848 with SMTP id a92af1059eb24-13633a68293mr8373862c88.5.1779868574320; Wed, 27 May 2026 00:56:14 -0700 (PDT) Received: from smtpclient.apple ([64.32.14.230]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-136b3706ad6sm8178606c88.13.2026.05.27.00.56.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 May 2026 00:56:13 -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: Wed, 27 May 2026 15:55:38 +0800 Cc: PostgreSQL Hackers , jian he , Peter Eisentraut Content-Transfer-Encoding: quoted-printable Message-Id: <5E0A0FF4-3E57-415E-A1C7-F1184F1EDC32@gmail.com> 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 27, 2026, at 09:28, Paul A Jungwirth = wrote: >=20 > On Tue, May 26, 2026 at 9:14=E2=80=AFAM Paul A Jungwirth > wrote: >>=20 >> I thought the ExecInitForPortionOf refactoring was still nice to = keep, >> and it seemed to fit better here. (I should have updated the commit >> message not to mention UPDATE OF though.) >=20 > I looked at the original v1 patch again. I thought the commit message > was excellent, so I pulled that into the latest patch, also some > comment changes and the partitionRouting boolean and some test > double-checks. I still like how ExecInitForPortionOf cuts down on the > branchiness and the variables used to track attnums, and also how it > gathers a lot of the child table setup in one place. The v1 seemed > hard to trace all the cases from top to bottom. For instance it > initialized map for all child tables, but then only used it for > partitions. >=20 >> But thinking about it this morning, I realized: the planner already >> prunes partitions before we get here. Lazily initializing the structs >> is trying too hard. Is there some scenario where that actually saves >> work? >=20 > Never mind, of course you can filter rows (and whole tables) besides > just by partition pruning/constraint exclusion. >=20 > I'm not sure whom to list as author/co-author/reviewer for this patch, > but I took a stab at it. I think most of the current code is from jian > he's version, but all three of us have contributed a lot by this > point. >=20 > Yours, >=20 > --=20 > Paul ~{:-) > pj@illuminatedcomputing.com Hi Paul, I just tested v3 with my original repro, and it has resolved the bug I = reported. ``` evantest=3D# create table p (id int, valid_at daterange, name text); CREATE TABLE evantest=3D# create table c (extra text) inherits (p); CREATE TABLE evantest=3D# insert into c values (1, daterange('2000-01-01', = '2010-01-01'), 'old', 'x'); INSERT 0 1 evantest=3D# update p for portion of valid_at from '2001-01-01' to = '2002-01-01' set name =3D 'new' where id =3D 1; UPDATE 1 evantest=3D# select * from only p; id | valid_at | name ----+----------+------ (0 rows) evantest=3D# select * from c; id | valid_at | name | extra ----+-------------------------+------+------- 1 | [2001-01-01,2002-01-01) | new | x 1 | [2000-01-01,2001-01-01) | old | x 1 | [2002-01-01,2010-01-01) | old | x (3 rows) ``` I also noticed that the =E2=80=9CUPDATE OF=E2=80=9D related information = has been removed from the commit message. I can still reproduce the = UPDATE OF issue with v3, but I think that is expected, and that issue = will be resolved by the other patch. So v3 looks clean and good to me. Thanks for updating the patch and = making the two patches decoupled. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/