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 <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/[email protected] 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(-)
