pgsql: Add SupportRequestInlineInFrom planner support request.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add SupportRequestInlineInFrom planner support request.
Date: 2025-11-23 00:44:33
Message-ID: E1vMyDR-000tuL-0E@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add SupportRequestInlineInFrom planner support request.

This request allows a support function to replace a function call
appearing in FROM (typically a set-returning function) with an
equivalent SELECT subquery. The subquery will then be subject
to the planner's usual optimizations, potentially allowing a much
better plan to be generated. While the planner has long done this
automatically for simple SQL-language functions, it's now possible
for extensions to do it for functions outside that group.
Notably, this could be useful for functions that are presently
implemented in PL/pgSQL and work by generating and then EXECUTE'ing
a SQL query.

Author: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/09de6afa-c33d-4d94-a5cb-afc6cea0d2bb@illuminatedcomputing.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/xfunc.sgml | 25 +++
src/backend/optimizer/prep/prepjointree.c | 14 +-
src/backend/optimizer/util/clauses.c | 309 +++++++++++++++++----------
src/include/nodes/supportnodes.h | 30 +++
src/include/optimizer/clauses.h | 4 +-
src/test/regress/expected/misc_functions.out | 50 +++++
src/test/regress/regress.c | 121 +++++++++++
src/test/regress/sql/misc_functions.sql | 34 +++
src/tools/pgindent/typedefs.list | 3 +-
9 files changed, 465 insertions(+), 125 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-11-23 04:38:00 pgsql: pg_buffercache: Remove unused fields from BufferCacheNumaRec
Previous Message Nathan Bossart 2025-11-22 19:41:21 Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent