1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +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

@ -587,12 +587,13 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
fix_scan_list(root, cscan->scan.plan.targetlist, rtoffset);
cscan->scan.plan.qual =
fix_scan_list(root, cscan->scan.plan.qual, rtoffset);
/*
* The core implementation applies the routine to fixup
* varno on the target-list and scan qualifier.
* If custom-scan has additional expression nodes on its
* private fields, it has to apply same fixup on them.
* Otherwise, the custom-plan provider can skip this callback.
* The core implementation applies the routine to fixup varno
* on the target-list and scan qualifier. If custom-scan has
* additional expression nodes on its private fields, it has
* to apply same fixup on them. Otherwise, the custom-plan
* provider can skip this callback.
*/
if (cscan->methods->SetCustomScanRef)
cscan->methods->SetCustomScanRef(root, cscan, rtoffset);
@ -1083,7 +1084,7 @@ copyVar(Var *var)
* We assume it's okay to update opcode info in-place. So this could possibly
* scribble on the planner's input data structures, but it's OK.
*/
void
static void
fix_expr_common(PlannerInfo *root, Node *node)
{
/* We assume callers won't call us on a NULL pointer */