Earlier today in [1], a bug was reported regarding a problem with the code added in 66c0185a3 where I'd failed to handle the case correctly where the UNION's targetlist has columns which are not sortable. For pg_class, that's relfrozenxid, relminmxid and relacl.
The most minimal reproducer prior to the revert is: set enable_hashagg=0; explain (costs off) select '123'::xid union select '123'::xid; There is still some ongoing discussion about this on the release mailing list as per mentioned by Tom in the commit message in 7204f3591. At some point that discussion is going to need to circle back onto -hackers again, and since I've already written a patch to fix the issue and un-revert Tom's revert. I just wanted a place on -hackers to allow that code to be viewed and discussed. I did also post a patch on [2], but that no longer applies to master due to the revert. I'll allow the RMT to choose where the outcome of the RMT decision goes. Let this thread be for at least the coding portion of this or be my thread for this patch for the v18 cycle if the RMT rules in favour of keeping that code reverted for v17. I've attached 2 patches. 0001 is a simple revert of Tom's revert (7204f3591). 0002 fixes the issue reported by Hubert. If anyone wants to have a look, I'd be grateful for that. Tom did call for further review after this being the 4th issue reported for 66c0185a3. David [1] https://postgr.es/message-id/Zktzf926vslR35Fv%40depesz.com [2] https://www.postgresql.org/message-id/CAApHDvpDQh1NcL7nAsd3YAKj4vgORwesB3GYuNPnEXXRfA2g4w%40mail.gmail.com
v2-0001-Revert-Revert-commit-66c0185a3-and-follow-on-patc.patch
Description: Binary data
v2-0002-Fix-UNION-planner-bug-and-add-regression-test.patch
Description: Binary data