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

Initial code review for CustomScan patch.

Get rid of the pernicious entanglement between planner and executor headers
introduced by commit 0b03e5951b.

Also, rearrange the CustomFoo struct/typedef definitions so that all the
typedef names are seen as used by the compiler.  Without this pgindent
will mess things up a bit, which is not so important perhaps, but it also
removes a bizarre discrepancy between the declaration arrangement used for
CustomExecMethods and that used for CustomScanMethods and
CustomPathMethods.

Clean up the commentary around ExecSupportsMarkRestore to reflect the
rather large change in its API.

Const-ify register_custom_path_provider's argument.  This necessitates
casting away const in the function, but that seems better than forcing
callers of the function to do so (or else not const-ify their method
pointer structs, which was sort of the whole point).

De-export fix_expr_common.  I don't like the exporting of fix_scan_expr
or replace_nestloop_params either, but this one surely has got little
excuse.
This commit is contained in:
Tom Lane
2014-11-20 18:36:07 -05:00
parent 081a6048cf
commit a34fa8ee7c
11 changed files with 167 additions and 159 deletions

View File

@ -1929,10 +1929,10 @@ reparameterize_path(PlannerInfo *root, Path *path,
}
/*****************************************************************************
* creation of custom-plan paths
* creation of custom-plan paths
*****************************************************************************/
static List *custom_path_providers = NIL;
static List *custom_path_providers = NIL;
/*
* register_custom_path_provider
@ -1942,12 +1942,13 @@ static List *custom_path_providers = NIL;
* methods of scanning a relation.
*/
void
register_custom_path_provider(CustomPathMethods *cpp_methods)
register_custom_path_provider(const CustomPathMethods *cpp_methods)
{
MemoryContext oldcxt;
MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(TopMemoryContext);
custom_path_providers = lappend(custom_path_providers, cpp_methods);
custom_path_providers = lappend(custom_path_providers,
(void *) cpp_methods);
MemoryContextSwitchTo(oldcxt);
}
@ -1963,9 +1964,9 @@ create_customscan_paths(PlannerInfo *root,
RelOptInfo *baserel,
RangeTblEntry *rte)
{
ListCell *cell;
ListCell *cell;
foreach (cell, custom_path_providers)
foreach(cell, custom_path_providers)
{
const CustomPathMethods *cpp_methods = lfirst(cell);