Add SupportRequestInlineInFrom planner support request.
Tom Lane <tgl@sss.pgh.pa.us>
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@illuminatedcomputing.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/09de6afa-c33d-4d94-a5cb-afc6cea0d2bb@illuminatedcomputing.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/xfunc.sgml | modified | +25 −0 |
| src/backend/optimizer/prep/prepjointree.c | modified | +8 −6 |
| src/backend/optimizer/util/clauses.c | modified | +193 −116 |
| src/include/nodes/supportnodes.h | modified | +30 −0 |
| src/include/optimizer/clauses.h | modified | +2 −2 |
| src/test/regress/expected/misc_functions.out | modified | +50 −0 |
| src/test/regress/regress.c | modified | +121 −0 |
| src/test/regress/sql/misc_functions.sql | modified | +34 −0 |
| src/tools/pgindent/typedefs.list | modified | +2 −1 |
Discussion
- Inline non-SQL SRFs using SupportRequestSimplify 19 messages · 2024-06-27 → 2025-12-21