pgsql: Prevent bogus pullup of constant-valued functions returning comp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Prevent bogus pullup of constant-valued functions returning comp
Date: 2019-09-24 16:11:39
Message-ID: E1iCnPf-0004wo-Lm@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a9ae99d0190960ce2d3dd3e5f10e7f4adc3cf203

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 18 +++++++++++++++
src/test/regress/expected/join.out | 37 +++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql | 19 ++++++++++++++++
3 files changed, 74 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2019-09-24 19:46:52 pgsql: Rework WAL-reading supporting structs
Previous Message Fujii Masao 2019-09-24 08:32:32 pgsql: Speedup truncations of relation forks.