Re: BUG #17976: Inconsistent results of SELECT using CASE WHEN clause
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org
Date: 2023-06-15T07:12:01Z
Lists: pgsql-bugs
Attachments
- v1-0001-Remove-references-to-the-removed-rel-from-EquivalenceClasses.patch (application/octet-stream) patch v1-0001
On Thu, Jun 15, 2023 at 7:34 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > I'd always kind of wondered how we got away with not updating > EquivalenceClasses during join removal, and the answer evidently > is that we can't anymore. I've not tried to write a patch yet. I wondered about that too, and I thought that the target rel could not be mentioned in any EC, otherwise join_is_removable should have noticed that this rel is used above the join and thus decided that the join is not removable. Hence there is no need to update ECs during join removal. Apparently this is not right, as shown by this issue. I went ahead and drafted a patch as attached. But I'm not sure if it suffices to only update ec_relids, em_relids and ec_sources as the patch does. Also I'm wondering if any of them would become empty after the update. Thanks Richard
Commits
-
When removing a left join, clean out references in EquivalenceClasses.
- f4c00d138f6d 16.0 landed
-
doc: PG 16 relnotes, fix PREPARE/EXECUTE wording
- 3f1aaaa18068 16.0 cited