Prevent bogus pullup of constant-valued functions returning composite.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 24 Sep 2019 16:11:32 +0000 (12:11 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 24 Sep 2019 16:11:32 +0000 (12:11 -0400)
commita9ae99d0190960ce2d3dd3e5f10e7f4adc3cf203
tree39d15b08493f95a414acab4d3282275e5364c368
parent6d05086c0a79e50d8e91ed953626ec7280cd2481
Prevent bogus pullup of constant-valued functions returning composite.

Fix an oversight in commit 7266d0997: as it stood, the code failed
when a function-in-FROM returns composite and can be simplified
to a composite constant.

For the moment, just test for composite result and abandon pullup
if we see one.  To make it actually work, we'd have to decompose
the composite constant into per-column constants; which is surely
do-able, but I'm not convinced it's worth the code space.

Per report from Raúl Marín Rodríguez.

Discussion: https://postgr.es/m/CAM6_UM4isP+buRA5sWodO_MUEgutms-KDfnkwGmryc5DGj9XuQ@mail.gmail.com
src/backend/optimizer/prep/prepjointree.c
src/test/regress/expected/join.out
src/test/regress/sql/join.sql