Hello Tom and Richard,
23.06.2025 21:24, Tom Lane wrote:
Anyway, with one eye on the possibility that we'll need to back-patch
this in some form, I went for the localized fix of ensuring that
we use a copy of the PHV that's been through the normal processing.
I do want to look into restructuring the handling of these PHVs
to make this less messy, but that's not a job to undertake for v18
(much less if we have to back-patch).
I've managed to discover one more anomaly introduced by a16ef313f, that is
not fixed by fix-bug-18953-some-more:
CREATE TABLE t(i int PRIMARY KEY);
MERGE INTO t
USING
(SELECT 1 AS j FROM generate_series(1, 1))
RIGHT JOIN (SELECT 1) ON true
LEFT JOIN (SELECT 1 FROM (SELECT 1 FROM generate_series(1, 1))) ON false
ON i = j
WHEN NOT MATCHED THEN INSERT VALUES (1);
ERROR: XX000: wrong phnullingrels (b) (expected (b 4)) for PlaceHolderVar 1
LOCATION: search_indexed_tlist_for_phv, setrefs.c:2958
Thank you for spending your time on this!
Best regards,
Alexander