Re: BUG #19099: Conditional DELETE from partitioned table with non-updatable partition raises internal error
Kirill Reshke <reshkekirill@gmail.com>
From: Kirill Reshke <reshkekirill@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tender Wang <tndrwang@gmail.com>, jian he <jian.universality@gmail.com>,
exclusion@gmail.com, pgsql-bugs@lists.postgresql.org, Amit Langote <amitlangote09@gmail.com>
Date: 2025-10-30T05:31:38Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix bogus ctid requirement for dummy-root partitioned targets
- f9a468c664a4 19 (unreleased) landed
- 9f4b7bfc5eb6 18.2 landed
- 933f67fb6a79 17.8 landed
- fab386f74888 16.12 landed
- 687533b39ecf 15.16 landed
- 6d2fa44d2a61 14.21 landed
On Thu, 30 Oct 2025 at 10:08, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > It's surely pretty accidental (and arguably not desirable) > if "DELETE FROM pt WHERE false" doesn't fail the same way. > > Now, I agree that it's not great if you instead get an > internal error like "could not find junk ctid column". > But that smells to me like error checks being applied in > the wrong order rather than something fundamentally wrong. > > I didn't look at the proposed patch yet. > > regards, tom lane I wrote: > But I also wonder if Jian's fix fixed the right thing. Should we > instead fail in the planning phase with a more user-friendly error > message? This will be a regression though, because 'DELETE FROM > file_fdw_table WHERE false' will no longer work... On the second thought, I doubt anyone will get unhappy with 'DELETE FROM file_fdw_table WHERE false' stop working Alexander wrote: > On 86dc9005~1 or with enable_partition_pruning = 'on', EXPLAIN outputs the > query plan and "DELETE FROM pt WHERE false;" completes with no error. So, behaviour was wrong both before and after 86dc9005, just in different ways. On head, we get an error about junk columns, because without partition pruning, we derive the result relation as 'pt', not its partition 'p1', which is correct I believe. But with 'p1' as result relation, we (correctly) error out in ExecInitModifyTable while with 'pt' we don't. So, error checks are applied, order is not wrong, but rather checks are not full enough? I mean, we I believe we need to execute CheckValidResultRel against all partitions in ExecInitModifyTable, at least when no partition pruning has been performed -- Best regards, Kirill Reshke