1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Redesign PlanForeignScan API to allow multiple paths for a foreign table.

The original API specification only allowed an FDW to create a single
access path, which doesn't seem like a terribly good idea in hindsight.
Instead, move the responsibility for building the Path node and calling
add_path() into the FDW's PlanForeignScan function.  Now, it can do that
more than once if appropriate.  There is no longer any need for the
transient FdwPlan struct, so get rid of that.

Etsuro Fujita, Shigeru Hanada, Tom Lane
This commit is contained in:
Tom Lane
2012-03-05 16:15:59 -05:00
parent 3f47e145f1
commit 6b289942bf
12 changed files with 103 additions and 125 deletions

View File

@@ -19,42 +19,13 @@
struct ExplainState;
/*
* FdwPlan is the information returned to the planner by PlanForeignScan.
*/
typedef struct FdwPlan
{
NodeTag type;
/*
* Cost estimation info. The startup_cost is time before retrieving the
* first row, so it should include costs of connecting to the remote host,
* sending over the query, etc. Note that PlanForeignScan also ought to
* set baserel->rows and baserel->width if it can produce any usable
* estimates of those values.
*/
Cost startup_cost; /* cost expended before fetching any tuples */
Cost total_cost; /* total cost (assuming all tuples fetched) */
/*
* FDW private data, which will be available at execution time.
*
* Note that everything in this list must be copiable by copyObject(). One
* way to store an arbitrary blob of bytes is to represent it as a bytea
* Const. Usually, though, you'll be better off choosing a representation
* that can be dumped usefully by nodeToString().
*/
List *fdw_private;
} FdwPlan;
/*
* Callback function signatures --- see fdwhandler.sgml for more info.
*/
typedef FdwPlan *(*PlanForeignScan_function) (Oid foreigntableid,
PlannerInfo *root,
RelOptInfo *baserel);
typedef void (*PlanForeignScan_function) (Oid foreigntableid,
PlannerInfo *root,
RelOptInfo *baserel);
typedef void (*ExplainForeignScan_function) (ForeignScanState *node,
struct ExplainState *es);