Skip to content

Commit

Permalink
EXPLAIN now supported
Browse files Browse the repository at this point in the history
The estimate part is still very rough and won't provide
any interesting information.
  • Loading branch information
franckverrot committed Sep 14, 2014
1 parent 5d32376 commit 9c01e45
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions git_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static void gitGetForeignPaths(PlannerInfo *root, RelOptInfo *baserel, Oid forei
static ForeignScan *gitGetForeignPlan(PlannerInfo *root, RelOptInfo *baserel, Oid foreigntableid,
ForeignPath *best_path, List *tlist, List *scan_clauses);
static void gitBeginForeignScan(ForeignScanState *node, int eflags);
static void gitExplainForeignScan(ForeignScanState *node, ExplainState *es);
static TupleTableSlot *gitIterateForeignScan(ForeignScanState *node);
static void fileReScanForeignScan(ForeignScanState *node);
static void gitEndForeignScan(ForeignScanState *node);
Expand All @@ -60,6 +61,7 @@ Datum git_fdw_handler(PG_FUNCTION_ARGS) {
fdwroutine->BeginForeignScan = gitBeginForeignScan;
fdwroutine->IterateForeignScan = gitIterateForeignScan;
fdwroutine->EndForeignScan = gitEndForeignScan;
fdwroutine->ExplainForeignScan = gitExplainForeignScan;

fdwroutine->ReScanForeignScan = fileReScanForeignScan;

Expand Down Expand Up @@ -219,16 +221,15 @@ static ForeignScan * gitGetForeignPlan(PlannerInfo *root, RelOptInfo *baserel, O
return scan;
}

static void gitExplainForeignScan(ForeignScanState *node, ExplainState *es) {
}

static void gitBeginForeignScan(ForeignScanState *node, int eflags) {
ForeignScan *plan = (ForeignScan *) node->ss.ps.plan;
GitFdwExecutionState *festate;
FILE * file;
git_oid oid;

// Do nothing in EXPLAIN (no ANALYZE) case. node->fdw_state stays NULL.
if (eflags & EXEC_FLAG_EXPLAIN_ONLY)
return;

festate = (GitFdwExecutionState *) palloc(sizeof(GitFdwExecutionState));
festate->path = repository_path;
festate->repo = festate->walker = NULL;
Expand Down

0 comments on commit 9c01e45

Please sign in to comment.