diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-12 20:10:05 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-05-12 20:10:05 +0000 |
commit | f9e4f611a18f64fd9106a72ec9af9e2220075780 (patch) | |
tree | bfbc1d3d9fb5a008d8fe3405dce3366659c7e7cc /src/backend/optimizer/path/allpaths.c | |
parent | 71009354c848964e657e540e24dac6b4c9a81570 (diff) |
First pass at set-returning-functions in FROM, by Joe Conway with
some kibitzing from Tom Lane. Not everything works yet, and there's
no documentation or regression test, but let's commit this so Joe
doesn't need to cope with tracking changes in so many files ...
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r-- | src/backend/optimizer/path/allpaths.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 9368723188f..1e9074186c2 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.83 2001/12/10 22:54:12 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.84 2002/05/12 20:10:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -42,6 +42,8 @@ static void set_inherited_rel_pathlist(Query *root, RelOptInfo *rel, List *inheritlist); static void set_subquery_pathlist(Query *root, RelOptInfo *rel, Index rti, RangeTblEntry *rte); +static void set_function_pathlist(Query *root, RelOptInfo *rel, + RangeTblEntry *rte); static RelOptInfo *make_one_rel_by_joins(Query *root, int levels_needed, List *initial_rels); @@ -98,11 +100,16 @@ set_base_rel_pathlists(Query *root) rti = lfirsti(rel->relids); rte = rt_fetch(rti, root->rtable); - if (rel->issubquery) + if (rel->rtekind == RTE_SUBQUERY) { /* Subquery --- generate a separate plan for it */ set_subquery_pathlist(root, rel, rti, rte); } + else if (rel->rtekind == RTE_FUNCTION) + { + /* RangeFunction --- generate a separate plan for it */ + set_function_pathlist(root, rel, rte); + } else if ((inheritlist = expand_inherted_rtentry(root, rti, true)) != NIL) { @@ -386,6 +393,23 @@ set_subquery_pathlist(Query *root, RelOptInfo *rel, } /* + * set_function_pathlist + * Build the (single) access path for a function RTE + */ +static void +set_function_pathlist(Query *root, RelOptInfo *rel, RangeTblEntry *rte) +{ + /* Mark rel with estimated output rows, width, etc */ + set_function_size_estimates(root, rel); + + /* Generate appropriate path */ + add_path(rel, create_functionscan_path(root, rel)); + + /* Select cheapest path (pretty easy in this case...) */ + set_cheapest(rel); +} + +/* * make_fromexpr_rel * Build access paths for a FromExpr jointree node. */ |