Arrange to "inline" SQL functions that appear in a query's FROM clause,
Tom Lane <tgl@sss.pgh.pa.us>
Arrange to "inline" SQL functions that appear in a query's FROM clause, are declared to return set, and consist of just a single SELECT. We can replace the FROM-item with a sub-SELECT and then optimize much as if we were dealing with a view. Patch from Richard Rowell, cleaned up by me.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/pg_proc.c | modified | +3 −2 |
| src/backend/executor/functions.c | modified | +44 −17 |
| src/backend/optimizer/plan/planner.c | modified | +10 −3 |
| src/backend/optimizer/prep/prepjointree.c | modified | +54 −1 |
| src/backend/optimizer/util/clauses.c | modified | +306 −22 |
| src/include/executor/functions.h | modified | +2 −1 |
| src/include/optimizer/clauses.h | modified | +3 −1 |
| src/include/optimizer/prep.h | modified | +2 −1 |