2011-02-20 06:17:18 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* fdwapi.h
|
|
|
|
* API for foreign-data wrappers
|
|
|
|
*
|
2017-01-03 19:48:53 +01:00
|
|
|
* Copyright (c) 2010-2017, PostgreSQL Global Development Group
|
2011-02-20 06:17:18 +01:00
|
|
|
*
|
|
|
|
* src/include/foreign/fdwapi.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef FDWAPI_H
|
|
|
|
#define FDWAPI_H
|
|
|
|
|
2016-02-03 18:46:18 +01:00
|
|
|
#include "access/parallel.h"
|
2011-02-20 06:17:18 +01:00
|
|
|
#include "nodes/execnodes.h"
|
|
|
|
#include "nodes/relation.h"
|
|
|
|
|
|
|
|
/* To avoid including explain.h here, reference ExplainState thus: */
|
|
|
|
struct ExplainState;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Callback function signatures --- see fdwhandler.sgml for more info.
|
|
|
|
*/
|
|
|
|
|
Revise FDW planning API, again.
Further reflection shows that a single callback isn't very workable if we
desire to let FDWs generate multiple Paths, because that forces the FDW to
do all work necessary to generate a valid Plan node for each Path. Instead
split the former PlanForeignScan API into three steps: GetForeignRelSize,
GetForeignPaths, GetForeignPlan. We had already bit the bullet of breaking
the 9.1 FDW API for 9.2, so this shouldn't cause very much additional pain,
and it's substantially more flexible for complex FDWs.
Add an fdw_private field to RelOptInfo so that the new functions can save
state there rather than possibly having to recalculate information two or
three times.
In addition, we'd not thought through what would be needed to allow an FDW
to set up subexpressions of its choice for runtime execution. We could
treat ForeignScan.fdw_private as an executable expression but that seems
likely to break existing FDWs unnecessarily (in particular, it would
restrict the set of node types allowable in fdw_private to those supported
by expression_tree_walker). Instead, invent a separate field fdw_exprs
which will receive the postprocessing appropriate for expression trees.
(One field is enough since it can be a list of expressions; also, we assume
the corresponding expression state tree(s) will be held within fdw_state,
so we don't need to add anything to ForeignScanState.)
Per review of Hanada Shigeru's pgsql_fdw patch. We may need to tweak this
further as we continue to work on that patch, but to me it feels a lot
closer to being right now.
2012-03-09 18:48:48 +01:00
|
|
|
typedef void (*GetForeignRelSize_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
RelOptInfo *baserel,
|
|
|
|
Oid foreigntableid);
|
Revise FDW planning API, again.
Further reflection shows that a single callback isn't very workable if we
desire to let FDWs generate multiple Paths, because that forces the FDW to
do all work necessary to generate a valid Plan node for each Path. Instead
split the former PlanForeignScan API into three steps: GetForeignRelSize,
GetForeignPaths, GetForeignPlan. We had already bit the bullet of breaking
the 9.1 FDW API for 9.2, so this shouldn't cause very much additional pain,
and it's substantially more flexible for complex FDWs.
Add an fdw_private field to RelOptInfo so that the new functions can save
state there rather than possibly having to recalculate information two or
three times.
In addition, we'd not thought through what would be needed to allow an FDW
to set up subexpressions of its choice for runtime execution. We could
treat ForeignScan.fdw_private as an executable expression but that seems
likely to break existing FDWs unnecessarily (in particular, it would
restrict the set of node types allowable in fdw_private to those supported
by expression_tree_walker). Instead, invent a separate field fdw_exprs
which will receive the postprocessing appropriate for expression trees.
(One field is enough since it can be a list of expressions; also, we assume
the corresponding expression state tree(s) will be held within fdw_state,
so we don't need to add anything to ForeignScanState.)
Per review of Hanada Shigeru's pgsql_fdw patch. We may need to tweak this
further as we continue to work on that patch, but to me it feels a lot
closer to being right now.
2012-03-09 18:48:48 +01:00
|
|
|
|
|
|
|
typedef void (*GetForeignPaths_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
RelOptInfo *baserel,
|
|
|
|
Oid foreigntableid);
|
Revise FDW planning API, again.
Further reflection shows that a single callback isn't very workable if we
desire to let FDWs generate multiple Paths, because that forces the FDW to
do all work necessary to generate a valid Plan node for each Path. Instead
split the former PlanForeignScan API into three steps: GetForeignRelSize,
GetForeignPaths, GetForeignPlan. We had already bit the bullet of breaking
the 9.1 FDW API for 9.2, so this shouldn't cause very much additional pain,
and it's substantially more flexible for complex FDWs.
Add an fdw_private field to RelOptInfo so that the new functions can save
state there rather than possibly having to recalculate information two or
three times.
In addition, we'd not thought through what would be needed to allow an FDW
to set up subexpressions of its choice for runtime execution. We could
treat ForeignScan.fdw_private as an executable expression but that seems
likely to break existing FDWs unnecessarily (in particular, it would
restrict the set of node types allowable in fdw_private to those supported
by expression_tree_walker). Instead, invent a separate field fdw_exprs
which will receive the postprocessing appropriate for expression trees.
(One field is enough since it can be a list of expressions; also, we assume
the corresponding expression state tree(s) will be held within fdw_state,
so we don't need to add anything to ForeignScanState.)
Per review of Hanada Shigeru's pgsql_fdw patch. We may need to tweak this
further as we continue to work on that patch, but to me it feels a lot
closer to being right now.
2012-03-09 18:48:48 +01:00
|
|
|
|
|
|
|
typedef ForeignScan *(*GetForeignPlan_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
RelOptInfo *baserel,
|
|
|
|
Oid foreigntableid,
|
|
|
|
ForeignPath *best_path,
|
|
|
|
List *tlist,
|
|
|
|
List *scan_clauses,
|
|
|
|
Plan *outer_plan);
|
2011-02-20 06:17:18 +01:00
|
|
|
|
|
|
|
typedef void (*BeginForeignScan_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
int eflags);
|
2011-02-20 06:17:18 +01:00
|
|
|
|
2011-04-10 17:42:00 +02:00
|
|
|
typedef TupleTableSlot *(*IterateForeignScan_function) (ForeignScanState *node);
|
2011-02-20 06:17:18 +01:00
|
|
|
|
Allow foreign and custom joins to handle EvalPlanQual rechecks.
Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 provided basic
infrastructure for allowing a foreign data wrapper or custom scan
provider to replace a join of one or more tables with a scan.
However, this infrastructure failed to take into account the need
for possible EvalPlanQual rechecks, and ExecScanFetch would fail
an assertion (or just overwrite memory) if such a check was attempted
for a plan containing a pushed-down join. To fix, adjust the EPQ
machinery to skip some processing steps when scanrelid == 0, making
those the responsibility of scan's recheck method, which also has
the responsibility in this case of correctly populating the relevant
slot.
To allow foreign scans to gain control in the right place to make
use of this new facility, add a new, optional RecheckForeignScan
method. Also, allow a foreign scan to have a child plan, which can
be used to correctly populate the slot (or perhaps for something
else, but this is the only use currently envisioned).
KaiGai Kohei, reviewed by Robert Haas, Etsuro Fujita, and Kyotaro
Horiguchi.
2015-12-08 18:31:03 +01:00
|
|
|
typedef bool (*RecheckForeignScan_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
TupleTableSlot *slot);
|
Allow foreign and custom joins to handle EvalPlanQual rechecks.
Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 provided basic
infrastructure for allowing a foreign data wrapper or custom scan
provider to replace a join of one or more tables with a scan.
However, this infrastructure failed to take into account the need
for possible EvalPlanQual rechecks, and ExecScanFetch would fail
an assertion (or just overwrite memory) if such a check was attempted
for a plan containing a pushed-down join. To fix, adjust the EPQ
machinery to skip some processing steps when scanrelid == 0, making
those the responsibility of scan's recheck method, which also has
the responsibility in this case of correctly populating the relevant
slot.
To allow foreign scans to gain control in the right place to make
use of this new facility, add a new, optional RecheckForeignScan
method. Also, allow a foreign scan to have a child plan, which can
be used to correctly populate the slot (or perhaps for something
else, but this is the only use currently envisioned).
KaiGai Kohei, reviewed by Robert Haas, Etsuro Fujita, and Kyotaro
Horiguchi.
2015-12-08 18:31:03 +01:00
|
|
|
|
2011-02-20 06:17:18 +01:00
|
|
|
typedef void (*ReScanForeignScan_function) (ForeignScanState *node);
|
|
|
|
|
|
|
|
typedef void (*EndForeignScan_function) (ForeignScanState *node);
|
|
|
|
|
Code review for foreign/custom join pushdown patch.
Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 included some design
decisions that seem pretty questionable to me, and there was quite a lot
of stuff not to like about the documentation and comments. Clean up
as follows:
* Consider foreign joins only between foreign tables on the same server,
rather than between any two foreign tables with the same underlying FDW
handler function. In most if not all cases, the FDW would simply have had
to apply the same-server restriction itself (far more expensively, both for
lack of caching and because it would be repeated for each combination of
input sub-joins), or else risk nasty bugs. Anyone who's really intent on
doing something outside this restriction can always use the
set_join_pathlist_hook.
* Rename fdw_ps_tlist/custom_ps_tlist to fdw_scan_tlist/custom_scan_tlist
to better reflect what they're for, and allow these custom scan tlists
to be used even for base relations.
* Change make_foreignscan() API to include passing the fdw_scan_tlist
value, since the FDW is required to set that. Backwards compatibility
doesn't seem like an adequate reason to expect FDWs to set it in some
ad-hoc extra step, and anyway existing FDWs can just pass NIL.
* Change the API of path-generating subroutines of add_paths_to_joinrel,
and in particular that of GetForeignJoinPaths and set_join_pathlist_hook,
so that various less-used parameters are passed in a struct rather than
as separate parameter-list entries. The objective here is to reduce the
probability that future additions to those parameter lists will result in
source-level API breaks for users of these hooks. It's possible that this
is even a small win for the core code, since most CPU architectures can't
pass more than half a dozen parameters efficiently anyway. I kept root,
joinrel, outerrel, innerrel, and jointype as separate parameters to reduce
code churn in joinpath.c --- in particular, putting jointype into the
struct would have been problematic because of the subroutines' habit of
changing their local copies of that variable.
* Avoid ad-hocery in ExecAssignScanProjectionInfo. It was probably all
right for it to know about IndexOnlyScan, but if the list is to grow
we should refactor the knowledge out to the callers.
* Restore nodeForeignscan.c's previous use of the relcache to avoid
extra GetFdwRoutine lookups for base-relation scans.
* Lots of cleanup of documentation and missed comments. Re-order some
code additions into more logical places.
2015-05-10 20:36:30 +02:00
|
|
|
typedef void (*GetForeignJoinPaths_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
RelOptInfo *joinrel,
|
|
|
|
RelOptInfo *outerrel,
|
|
|
|
RelOptInfo *innerrel,
|
|
|
|
JoinType jointype,
|
|
|
|
JoinPathExtraData *extra);
|
Code review for foreign/custom join pushdown patch.
Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 included some design
decisions that seem pretty questionable to me, and there was quite a lot
of stuff not to like about the documentation and comments. Clean up
as follows:
* Consider foreign joins only between foreign tables on the same server,
rather than between any two foreign tables with the same underlying FDW
handler function. In most if not all cases, the FDW would simply have had
to apply the same-server restriction itself (far more expensively, both for
lack of caching and because it would be repeated for each combination of
input sub-joins), or else risk nasty bugs. Anyone who's really intent on
doing something outside this restriction can always use the
set_join_pathlist_hook.
* Rename fdw_ps_tlist/custom_ps_tlist to fdw_scan_tlist/custom_scan_tlist
to better reflect what they're for, and allow these custom scan tlists
to be used even for base relations.
* Change make_foreignscan() API to include passing the fdw_scan_tlist
value, since the FDW is required to set that. Backwards compatibility
doesn't seem like an adequate reason to expect FDWs to set it in some
ad-hoc extra step, and anyway existing FDWs can just pass NIL.
* Change the API of path-generating subroutines of add_paths_to_joinrel,
and in particular that of GetForeignJoinPaths and set_join_pathlist_hook,
so that various less-used parameters are passed in a struct rather than
as separate parameter-list entries. The objective here is to reduce the
probability that future additions to those parameter lists will result in
source-level API breaks for users of these hooks. It's possible that this
is even a small win for the core code, since most CPU architectures can't
pass more than half a dozen parameters efficiently anyway. I kept root,
joinrel, outerrel, innerrel, and jointype as separate parameters to reduce
code churn in joinpath.c --- in particular, putting jointype into the
struct would have been problematic because of the subroutines' habit of
changing their local copies of that variable.
* Avoid ad-hocery in ExecAssignScanProjectionInfo. It was probably all
right for it to know about IndexOnlyScan, but if the list is to grow
we should refactor the knowledge out to the callers.
* Restore nodeForeignscan.c's previous use of the relcache to avoid
extra GetFdwRoutine lookups for base-relation scans.
* Lots of cleanup of documentation and missed comments. Re-order some
code additions into more logical places.
2015-05-10 20:36:30 +02:00
|
|
|
|
2016-03-15 01:04:44 +01:00
|
|
|
typedef void (*GetForeignUpperPaths_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
UpperRelationKind stage,
|
|
|
|
RelOptInfo *input_rel,
|
|
|
|
RelOptInfo *output_rel);
|
2016-03-15 01:04:44 +01:00
|
|
|
|
2013-03-10 19:14:53 +01:00
|
|
|
typedef void (*AddForeignUpdateTargets_function) (Query *parsetree,
|
2017-06-21 20:39:04 +02:00
|
|
|
RangeTblEntry *target_rte,
|
|
|
|
Relation target_relation);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
typedef List *(*PlanForeignModify_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
ModifyTable *plan,
|
|
|
|
Index resultRelation,
|
|
|
|
int subplan_index);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
typedef void (*BeginForeignModify_function) (ModifyTableState *mtstate,
|
2017-06-21 20:39:04 +02:00
|
|
|
ResultRelInfo *rinfo,
|
|
|
|
List *fdw_private,
|
|
|
|
int subplan_index,
|
|
|
|
int eflags);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
typedef TupleTableSlot *(*ExecForeignInsert_function) (EState *estate,
|
2017-06-21 20:39:04 +02:00
|
|
|
ResultRelInfo *rinfo,
|
|
|
|
TupleTableSlot *slot,
|
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they
flow past the right margin.
By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis. However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent. That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.
This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:35:54 +02:00
|
|
|
TupleTableSlot *planSlot);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
typedef TupleTableSlot *(*ExecForeignUpdate_function) (EState *estate,
|
2017-06-21 20:39:04 +02:00
|
|
|
ResultRelInfo *rinfo,
|
|
|
|
TupleTableSlot *slot,
|
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they
flow past the right margin.
By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis. However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent. That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.
This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:35:54 +02:00
|
|
|
TupleTableSlot *planSlot);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
typedef TupleTableSlot *(*ExecForeignDelete_function) (EState *estate,
|
2017-06-21 20:39:04 +02:00
|
|
|
ResultRelInfo *rinfo,
|
|
|
|
TupleTableSlot *slot,
|
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they
flow past the right margin.
By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis. However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent. That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.
This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:35:54 +02:00
|
|
|
TupleTableSlot *planSlot);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
typedef void (*EndForeignModify_function) (EState *estate,
|
2017-06-21 20:39:04 +02:00
|
|
|
ResultRelInfo *rinfo);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
2013-06-12 23:52:54 +02:00
|
|
|
typedef int (*IsForeignRelUpdatable_function) (Relation rel);
|
|
|
|
|
2016-03-18 18:48:58 +01:00
|
|
|
typedef bool (*PlanDirectModify_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
ModifyTable *plan,
|
|
|
|
Index resultRelation,
|
|
|
|
int subplan_index);
|
2016-03-18 18:48:58 +01:00
|
|
|
|
|
|
|
typedef void (*BeginDirectModify_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
int eflags);
|
2016-03-18 18:48:58 +01:00
|
|
|
|
|
|
|
typedef TupleTableSlot *(*IterateDirectModify_function) (ForeignScanState *node);
|
|
|
|
|
|
|
|
typedef void (*EndDirectModify_function) (ForeignScanState *node);
|
|
|
|
|
Add support for doing late row locking in FDWs.
Previously, FDWs could only do "early row locking", that is lock a row as
soon as it's fetched, even though local restriction/join conditions might
discard the row later. This patch adds callbacks that allow FDWs to do
late locking in the same way that it's done for regular tables.
To make use of this feature, an FDW must support the "ctid" column as a
unique row identifier. Currently, since ctid has to be of type TID,
the feature is of limited use, though in principle it could be used by
postgres_fdw. We may eventually allow FDWs to specify another data type
for ctid, which would make it possible for more FDWs to use this feature.
This commit does not modify postgres_fdw to use late locking. We've
tested some prototype code for that, but it's not in committable shape,
and besides it's quite unclear whether it actually makes sense to do late
locking against a remote server. The extra round trips required are likely
to outweigh any benefit from improved concurrency.
Etsuro Fujita, reviewed by Ashutosh Bapat, and hacked up a lot by me
2015-05-12 20:10:10 +02:00
|
|
|
typedef RowMarkType (*GetForeignRowMarkType_function) (RangeTblEntry *rte,
|
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they
flow past the right margin.
By default, BSD indent lines up statement continuation lines that are
within parentheses so that they start just to the right of the preceding
left parenthesis. However, traditionally, if that resulted in the
continuation line extending to the right of the desired right margin,
then indent would push it left just far enough to not overrun the margin,
if it could do so without making the continuation line start to the left of
the current statement indent. That makes for a weird mix of indentations
unless one has been completely rigid about never violating the 80-column
limit.
This behavior has been pretty universally panned by Postgres developers.
Hence, disable it with indent's new -lpl switch, so that parenthesized
lines are always lined up with the preceding left paren.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:35:54 +02:00
|
|
|
LockClauseStrength strength);
|
Add support for doing late row locking in FDWs.
Previously, FDWs could only do "early row locking", that is lock a row as
soon as it's fetched, even though local restriction/join conditions might
discard the row later. This patch adds callbacks that allow FDWs to do
late locking in the same way that it's done for regular tables.
To make use of this feature, an FDW must support the "ctid" column as a
unique row identifier. Currently, since ctid has to be of type TID,
the feature is of limited use, though in principle it could be used by
postgres_fdw. We may eventually allow FDWs to specify another data type
for ctid, which would make it possible for more FDWs to use this feature.
This commit does not modify postgres_fdw to use late locking. We've
tested some prototype code for that, but it's not in committable shape,
and besides it's quite unclear whether it actually makes sense to do late
locking against a remote server. The extra round trips required are likely
to outweigh any benefit from improved concurrency.
Etsuro Fujita, reviewed by Ashutosh Bapat, and hacked up a lot by me
2015-05-12 20:10:10 +02:00
|
|
|
|
|
|
|
typedef HeapTuple (*RefetchForeignRow_function) (EState *estate,
|
2017-06-21 20:39:04 +02:00
|
|
|
ExecRowMark *erm,
|
|
|
|
Datum rowid,
|
|
|
|
bool *updated);
|
Add support for doing late row locking in FDWs.
Previously, FDWs could only do "early row locking", that is lock a row as
soon as it's fetched, even though local restriction/join conditions might
discard the row later. This patch adds callbacks that allow FDWs to do
late locking in the same way that it's done for regular tables.
To make use of this feature, an FDW must support the "ctid" column as a
unique row identifier. Currently, since ctid has to be of type TID,
the feature is of limited use, though in principle it could be used by
postgres_fdw. We may eventually allow FDWs to specify another data type
for ctid, which would make it possible for more FDWs to use this feature.
This commit does not modify postgres_fdw to use late locking. We've
tested some prototype code for that, but it's not in committable shape,
and besides it's quite unclear whether it actually makes sense to do late
locking against a remote server. The extra round trips required are likely
to outweigh any benefit from improved concurrency.
Etsuro Fujita, reviewed by Ashutosh Bapat, and hacked up a lot by me
2015-05-12 20:10:10 +02:00
|
|
|
|
2013-03-10 19:14:53 +01:00
|
|
|
typedef void (*ExplainForeignScan_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
struct ExplainState *es);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
typedef void (*ExplainForeignModify_function) (ModifyTableState *mtstate,
|
2017-06-21 20:39:04 +02:00
|
|
|
ResultRelInfo *rinfo,
|
|
|
|
List *fdw_private,
|
|
|
|
int subplan_index,
|
|
|
|
struct ExplainState *es);
|
2013-03-10 19:14:53 +01:00
|
|
|
|
2016-03-18 18:48:58 +01:00
|
|
|
typedef void (*ExplainDirectModify_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
struct ExplainState *es);
|
2016-03-18 18:48:58 +01:00
|
|
|
|
2012-04-06 21:02:35 +02:00
|
|
|
typedef int (*AcquireSampleRowsFunc) (Relation relation, int elevel,
|
2017-06-21 20:39:04 +02:00
|
|
|
HeapTuple *rows, int targrows,
|
|
|
|
double *totalrows,
|
|
|
|
double *totaldeadrows);
|
2012-04-06 21:02:35 +02:00
|
|
|
|
2012-04-06 22:04:10 +02:00
|
|
|
typedef bool (*AnalyzeForeignTable_function) (Relation relation,
|
2017-06-21 20:39:04 +02:00
|
|
|
AcquireSampleRowsFunc *func,
|
|
|
|
BlockNumber *totalpages);
|
2011-02-20 06:17:18 +01:00
|
|
|
|
2014-07-10 21:01:31 +02:00
|
|
|
typedef List *(*ImportForeignSchema_function) (ImportForeignSchemaStmt *stmt,
|
2017-06-21 20:39:04 +02:00
|
|
|
Oid serverOid);
|
2014-07-10 21:01:31 +02:00
|
|
|
|
2016-02-03 18:46:18 +01:00
|
|
|
typedef Size (*EstimateDSMForeignScan_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
ParallelContext *pcxt);
|
2016-02-03 18:46:18 +01:00
|
|
|
typedef void (*InitializeDSMForeignScan_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
ParallelContext *pcxt,
|
|
|
|
void *coordinate);
|
Separate reinitialization of shared parallel-scan state from ExecReScan.
Previously, the parallel executor logic did reinitialization of shared
state within the ExecReScan code for parallel-aware scan nodes. This is
problematic, because it means that the ExecReScan call has to occur
synchronously (ie, during the parent Gather node's ReScan call). That is
swimming very much against the tide so far as the ExecReScan machinery is
concerned; the fact that it works at all today depends on a lot of fragile
assumptions, such as that no plan node between Gather and a parallel-aware
scan node is parameterized. Another objection is that because ExecReScan
might be called in workers as well as the leader, hacky extra tests are
needed in some places to prevent unwanted shared-state resets.
Hence, let's separate this code into two functions, a ReInitializeDSM
call and the ReScan call proper. ReInitializeDSM is called only in
the leader and is guaranteed to run before we start new workers.
ReScan is returned to its traditional function of resetting only local
state, which means that ExecReScan's usual habits of delaying or
eliminating child rescan calls are safe again.
As with the preceding commit 7df2c1f8d, it doesn't seem to be necessary
to make these changes in 9.6, which is a good thing because the FDW and
CustomScan APIs are impacted.
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com
2017-08-30 19:18:16 +02:00
|
|
|
typedef void (*ReInitializeDSMForeignScan_function) (ForeignScanState *node,
|
|
|
|
ParallelContext *pcxt,
|
|
|
|
void *coordinate);
|
2016-02-03 18:46:18 +01:00
|
|
|
typedef void (*InitializeWorkerForeignScan_function) (ForeignScanState *node,
|
2017-06-21 20:39:04 +02:00
|
|
|
shm_toc *toc,
|
|
|
|
void *coordinate);
|
2017-02-26 09:06:49 +01:00
|
|
|
typedef void (*ShutdownForeignScan_function) (ForeignScanState *node);
|
2016-02-26 11:44:46 +01:00
|
|
|
typedef bool (*IsForeignScanParallelSafe_function) (PlannerInfo *root,
|
2017-06-21 20:39:04 +02:00
|
|
|
RelOptInfo *rel,
|
|
|
|
RangeTblEntry *rte);
|
Basic partition-wise join functionality.
Instead of joining two partitioned tables in their entirety we can, if
it is an equi-join on the partition keys, join the matching partitions
individually. This involves teaching the planner about "other join"
rels, which are related to regular join rels in the same way that
other member rels are related to baserels. This can use significantly
more CPU time and memory than regular join planning, because there may
now be a set of "other" rels not only for every base relation but also
for every join relation. In most practical cases, this probably
shouldn't be a problem, because (1) it's probably unusual to join many
tables each with many partitions using the partition keys for all
joins and (2) if you do that scenario then you probably have a big
enough machine to handle the increased memory cost of planning and (3)
the resulting plan is highly likely to be better, so what you spend in
planning you'll make up on the execution side. All the same, for now,
turn this feature off by default.
Currently, we can only perform joins between two tables whose
partitioning schemes are absolutely identical. It would be nice to
cope with other scenarios, such as extra partitions on one side or the
other with no match on the other side, but that will have to wait for
a future patch.
Ashutosh Bapat, reviewed and tested by Rajkumar Raghuwanshi, Amit
Langote, Rafia Sabih, Thomas Munro, Dilip Kumar, Antonin Houska, Amit
Khandekar, and by me. A few final adjustments by me.
Discussion: http://postgr.es/m/CAFjFpRfQ8GrQvzp3jA2wnLqrHmaXna-urjm_UY9BqXj=EaDTSA@mail.gmail.com
Discussion: http://postgr.es/m/CAFjFpRcitjfrULr5jfuKWRPsGUX0LQ0k8-yG0Qw2+1LBGNpMdw@mail.gmail.com
2017-10-06 17:11:10 +02:00
|
|
|
typedef List *(*ReparameterizeForeignPathByChild_function) (PlannerInfo *root,
|
|
|
|
List *fdw_private,
|
|
|
|
RelOptInfo *child_rel);
|
2016-02-26 11:44:46 +01:00
|
|
|
|
2011-02-20 06:17:18 +01:00
|
|
|
/*
|
|
|
|
* FdwRoutine is the struct returned by a foreign-data wrapper's handler
|
|
|
|
* function. It provides pointers to the callback functions needed by the
|
|
|
|
* planner and executor.
|
|
|
|
*
|
2012-04-06 21:02:35 +02:00
|
|
|
* More function pointers are likely to be added in the future. Therefore
|
|
|
|
* it's recommended that the handler initialize the struct with
|
|
|
|
* makeNode(FdwRoutine) so that all fields are set to NULL. This will
|
|
|
|
* ensure that no fields are accidentally left undefined.
|
2011-02-20 06:17:18 +01:00
|
|
|
*/
|
|
|
|
typedef struct FdwRoutine
|
|
|
|
{
|
|
|
|
NodeTag type;
|
|
|
|
|
2013-03-10 19:14:53 +01:00
|
|
|
/* Functions for scanning foreign tables */
|
Revise FDW planning API, again.
Further reflection shows that a single callback isn't very workable if we
desire to let FDWs generate multiple Paths, because that forces the FDW to
do all work necessary to generate a valid Plan node for each Path. Instead
split the former PlanForeignScan API into three steps: GetForeignRelSize,
GetForeignPaths, GetForeignPlan. We had already bit the bullet of breaking
the 9.1 FDW API for 9.2, so this shouldn't cause very much additional pain,
and it's substantially more flexible for complex FDWs.
Add an fdw_private field to RelOptInfo so that the new functions can save
state there rather than possibly having to recalculate information two or
three times.
In addition, we'd not thought through what would be needed to allow an FDW
to set up subexpressions of its choice for runtime execution. We could
treat ForeignScan.fdw_private as an executable expression but that seems
likely to break existing FDWs unnecessarily (in particular, it would
restrict the set of node types allowable in fdw_private to those supported
by expression_tree_walker). Instead, invent a separate field fdw_exprs
which will receive the postprocessing appropriate for expression trees.
(One field is enough since it can be a list of expressions; also, we assume
the corresponding expression state tree(s) will be held within fdw_state,
so we don't need to add anything to ForeignScanState.)
Per review of Hanada Shigeru's pgsql_fdw patch. We may need to tweak this
further as we continue to work on that patch, but to me it feels a lot
closer to being right now.
2012-03-09 18:48:48 +01:00
|
|
|
GetForeignRelSize_function GetForeignRelSize;
|
|
|
|
GetForeignPaths_function GetForeignPaths;
|
|
|
|
GetForeignPlan_function GetForeignPlan;
|
2011-02-20 06:17:18 +01:00
|
|
|
BeginForeignScan_function BeginForeignScan;
|
|
|
|
IterateForeignScan_function IterateForeignScan;
|
|
|
|
ReScanForeignScan_function ReScanForeignScan;
|
|
|
|
EndForeignScan_function EndForeignScan;
|
2012-04-06 21:02:35 +02:00
|
|
|
|
|
|
|
/*
|
2013-03-10 19:14:53 +01:00
|
|
|
* Remaining functions are optional. Set the pointer to NULL for any that
|
|
|
|
* are not provided.
|
2012-04-06 21:02:35 +02:00
|
|
|
*/
|
2013-03-10 19:14:53 +01:00
|
|
|
|
Code review for foreign/custom join pushdown patch.
Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 included some design
decisions that seem pretty questionable to me, and there was quite a lot
of stuff not to like about the documentation and comments. Clean up
as follows:
* Consider foreign joins only between foreign tables on the same server,
rather than between any two foreign tables with the same underlying FDW
handler function. In most if not all cases, the FDW would simply have had
to apply the same-server restriction itself (far more expensively, both for
lack of caching and because it would be repeated for each combination of
input sub-joins), or else risk nasty bugs. Anyone who's really intent on
doing something outside this restriction can always use the
set_join_pathlist_hook.
* Rename fdw_ps_tlist/custom_ps_tlist to fdw_scan_tlist/custom_scan_tlist
to better reflect what they're for, and allow these custom scan tlists
to be used even for base relations.
* Change make_foreignscan() API to include passing the fdw_scan_tlist
value, since the FDW is required to set that. Backwards compatibility
doesn't seem like an adequate reason to expect FDWs to set it in some
ad-hoc extra step, and anyway existing FDWs can just pass NIL.
* Change the API of path-generating subroutines of add_paths_to_joinrel,
and in particular that of GetForeignJoinPaths and set_join_pathlist_hook,
so that various less-used parameters are passed in a struct rather than
as separate parameter-list entries. The objective here is to reduce the
probability that future additions to those parameter lists will result in
source-level API breaks for users of these hooks. It's possible that this
is even a small win for the core code, since most CPU architectures can't
pass more than half a dozen parameters efficiently anyway. I kept root,
joinrel, outerrel, innerrel, and jointype as separate parameters to reduce
code churn in joinpath.c --- in particular, putting jointype into the
struct would have been problematic because of the subroutines' habit of
changing their local copies of that variable.
* Avoid ad-hocery in ExecAssignScanProjectionInfo. It was probably all
right for it to know about IndexOnlyScan, but if the list is to grow
we should refactor the knowledge out to the callers.
* Restore nodeForeignscan.c's previous use of the relcache to avoid
extra GetFdwRoutine lookups for base-relation scans.
* Lots of cleanup of documentation and missed comments. Re-order some
code additions into more logical places.
2015-05-10 20:36:30 +02:00
|
|
|
/* Functions for remote-join planning */
|
|
|
|
GetForeignJoinPaths_function GetForeignJoinPaths;
|
|
|
|
|
2016-03-15 01:04:44 +01:00
|
|
|
/* Functions for remote upper-relation (post scan/join) planning */
|
|
|
|
GetForeignUpperPaths_function GetForeignUpperPaths;
|
|
|
|
|
2013-03-10 19:14:53 +01:00
|
|
|
/* Functions for updating foreign tables */
|
|
|
|
AddForeignUpdateTargets_function AddForeignUpdateTargets;
|
|
|
|
PlanForeignModify_function PlanForeignModify;
|
|
|
|
BeginForeignModify_function BeginForeignModify;
|
|
|
|
ExecForeignInsert_function ExecForeignInsert;
|
|
|
|
ExecForeignUpdate_function ExecForeignUpdate;
|
|
|
|
ExecForeignDelete_function ExecForeignDelete;
|
|
|
|
EndForeignModify_function EndForeignModify;
|
2013-06-12 23:52:54 +02:00
|
|
|
IsForeignRelUpdatable_function IsForeignRelUpdatable;
|
2016-03-18 18:48:58 +01:00
|
|
|
PlanDirectModify_function PlanDirectModify;
|
|
|
|
BeginDirectModify_function BeginDirectModify;
|
|
|
|
IterateDirectModify_function IterateDirectModify;
|
|
|
|
EndDirectModify_function EndDirectModify;
|
2013-03-10 19:14:53 +01:00
|
|
|
|
Add support for doing late row locking in FDWs.
Previously, FDWs could only do "early row locking", that is lock a row as
soon as it's fetched, even though local restriction/join conditions might
discard the row later. This patch adds callbacks that allow FDWs to do
late locking in the same way that it's done for regular tables.
To make use of this feature, an FDW must support the "ctid" column as a
unique row identifier. Currently, since ctid has to be of type TID,
the feature is of limited use, though in principle it could be used by
postgres_fdw. We may eventually allow FDWs to specify another data type
for ctid, which would make it possible for more FDWs to use this feature.
This commit does not modify postgres_fdw to use late locking. We've
tested some prototype code for that, but it's not in committable shape,
and besides it's quite unclear whether it actually makes sense to do late
locking against a remote server. The extra round trips required are likely
to outweigh any benefit from improved concurrency.
Etsuro Fujita, reviewed by Ashutosh Bapat, and hacked up a lot by me
2015-05-12 20:10:10 +02:00
|
|
|
/* Functions for SELECT FOR UPDATE/SHARE row locking */
|
|
|
|
GetForeignRowMarkType_function GetForeignRowMarkType;
|
|
|
|
RefetchForeignRow_function RefetchForeignRow;
|
Allow foreign and custom joins to handle EvalPlanQual rechecks.
Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 provided basic
infrastructure for allowing a foreign data wrapper or custom scan
provider to replace a join of one or more tables with a scan.
However, this infrastructure failed to take into account the need
for possible EvalPlanQual rechecks, and ExecScanFetch would fail
an assertion (or just overwrite memory) if such a check was attempted
for a plan containing a pushed-down join. To fix, adjust the EPQ
machinery to skip some processing steps when scanrelid == 0, making
those the responsibility of scan's recheck method, which also has
the responsibility in this case of correctly populating the relevant
slot.
To allow foreign scans to gain control in the right place to make
use of this new facility, add a new, optional RecheckForeignScan
method. Also, allow a foreign scan to have a child plan, which can
be used to correctly populate the slot (or perhaps for something
else, but this is the only use currently envisioned).
KaiGai Kohei, reviewed by Robert Haas, Etsuro Fujita, and Kyotaro
Horiguchi.
2015-12-08 18:31:03 +01:00
|
|
|
RecheckForeignScan_function RecheckForeignScan;
|
Add support for doing late row locking in FDWs.
Previously, FDWs could only do "early row locking", that is lock a row as
soon as it's fetched, even though local restriction/join conditions might
discard the row later. This patch adds callbacks that allow FDWs to do
late locking in the same way that it's done for regular tables.
To make use of this feature, an FDW must support the "ctid" column as a
unique row identifier. Currently, since ctid has to be of type TID,
the feature is of limited use, though in principle it could be used by
postgres_fdw. We may eventually allow FDWs to specify another data type
for ctid, which would make it possible for more FDWs to use this feature.
This commit does not modify postgres_fdw to use late locking. We've
tested some prototype code for that, but it's not in committable shape,
and besides it's quite unclear whether it actually makes sense to do late
locking against a remote server. The extra round trips required are likely
to outweigh any benefit from improved concurrency.
Etsuro Fujita, reviewed by Ashutosh Bapat, and hacked up a lot by me
2015-05-12 20:10:10 +02:00
|
|
|
|
2013-03-10 19:14:53 +01:00
|
|
|
/* Support functions for EXPLAIN */
|
|
|
|
ExplainForeignScan_function ExplainForeignScan;
|
|
|
|
ExplainForeignModify_function ExplainForeignModify;
|
2016-03-18 18:48:58 +01:00
|
|
|
ExplainDirectModify_function ExplainDirectModify;
|
2013-03-10 19:14:53 +01:00
|
|
|
|
|
|
|
/* Support functions for ANALYZE */
|
2012-04-06 21:02:35 +02:00
|
|
|
AnalyzeForeignTable_function AnalyzeForeignTable;
|
2014-07-10 21:01:31 +02:00
|
|
|
|
|
|
|
/* Support functions for IMPORT FOREIGN SCHEMA */
|
|
|
|
ImportForeignSchema_function ImportForeignSchema;
|
2016-02-03 18:46:18 +01:00
|
|
|
|
|
|
|
/* Support functions for parallelism under Gather node */
|
2016-02-26 11:44:46 +01:00
|
|
|
IsForeignScanParallelSafe_function IsForeignScanParallelSafe;
|
2016-02-03 18:46:18 +01:00
|
|
|
EstimateDSMForeignScan_function EstimateDSMForeignScan;
|
|
|
|
InitializeDSMForeignScan_function InitializeDSMForeignScan;
|
Separate reinitialization of shared parallel-scan state from ExecReScan.
Previously, the parallel executor logic did reinitialization of shared
state within the ExecReScan code for parallel-aware scan nodes. This is
problematic, because it means that the ExecReScan call has to occur
synchronously (ie, during the parent Gather node's ReScan call). That is
swimming very much against the tide so far as the ExecReScan machinery is
concerned; the fact that it works at all today depends on a lot of fragile
assumptions, such as that no plan node between Gather and a parallel-aware
scan node is parameterized. Another objection is that because ExecReScan
might be called in workers as well as the leader, hacky extra tests are
needed in some places to prevent unwanted shared-state resets.
Hence, let's separate this code into two functions, a ReInitializeDSM
call and the ReScan call proper. ReInitializeDSM is called only in
the leader and is guaranteed to run before we start new workers.
ReScan is returned to its traditional function of resetting only local
state, which means that ExecReScan's usual habits of delaying or
eliminating child rescan calls are safe again.
As with the preceding commit 7df2c1f8d, it doesn't seem to be necessary
to make these changes in 9.6, which is a good thing because the FDW and
CustomScan APIs are impacted.
Discussion: https://postgr.es/m/CAA4eK1JkByysFJNh9M349u_nNjqETuEnY_y1VUc_kJiU0bxtaQ@mail.gmail.com
2017-08-30 19:18:16 +02:00
|
|
|
ReInitializeDSMForeignScan_function ReInitializeDSMForeignScan;
|
2016-02-03 18:46:18 +01:00
|
|
|
InitializeWorkerForeignScan_function InitializeWorkerForeignScan;
|
2017-02-26 09:06:49 +01:00
|
|
|
ShutdownForeignScan_function ShutdownForeignScan;
|
Basic partition-wise join functionality.
Instead of joining two partitioned tables in their entirety we can, if
it is an equi-join on the partition keys, join the matching partitions
individually. This involves teaching the planner about "other join"
rels, which are related to regular join rels in the same way that
other member rels are related to baserels. This can use significantly
more CPU time and memory than regular join planning, because there may
now be a set of "other" rels not only for every base relation but also
for every join relation. In most practical cases, this probably
shouldn't be a problem, because (1) it's probably unusual to join many
tables each with many partitions using the partition keys for all
joins and (2) if you do that scenario then you probably have a big
enough machine to handle the increased memory cost of planning and (3)
the resulting plan is highly likely to be better, so what you spend in
planning you'll make up on the execution side. All the same, for now,
turn this feature off by default.
Currently, we can only perform joins between two tables whose
partitioning schemes are absolutely identical. It would be nice to
cope with other scenarios, such as extra partitions on one side or the
other with no match on the other side, but that will have to wait for
a future patch.
Ashutosh Bapat, reviewed and tested by Rajkumar Raghuwanshi, Amit
Langote, Rafia Sabih, Thomas Munro, Dilip Kumar, Antonin Houska, Amit
Khandekar, and by me. A few final adjustments by me.
Discussion: http://postgr.es/m/CAFjFpRfQ8GrQvzp3jA2wnLqrHmaXna-urjm_UY9BqXj=EaDTSA@mail.gmail.com
Discussion: http://postgr.es/m/CAFjFpRcitjfrULr5jfuKWRPsGUX0LQ0k8-yG0Qw2+1LBGNpMdw@mail.gmail.com
2017-10-06 17:11:10 +02:00
|
|
|
|
|
|
|
/* Support functions for path reparameterization. */
|
|
|
|
ReparameterizeForeignPathByChild_function ReparameterizeForeignPathByChild;
|
2011-02-20 06:17:18 +01:00
|
|
|
} FdwRoutine;
|
|
|
|
|
|
|
|
|
|
|
|
/* Functions in foreign/foreign.c */
|
|
|
|
extern FdwRoutine *GetFdwRoutine(Oid fdwhandler);
|
Code review for foreign/custom join pushdown patch.
Commit e7cb7ee14555cc9c5773e2c102efd6371f6f2005 included some design
decisions that seem pretty questionable to me, and there was quite a lot
of stuff not to like about the documentation and comments. Clean up
as follows:
* Consider foreign joins only between foreign tables on the same server,
rather than between any two foreign tables with the same underlying FDW
handler function. In most if not all cases, the FDW would simply have had
to apply the same-server restriction itself (far more expensively, both for
lack of caching and because it would be repeated for each combination of
input sub-joins), or else risk nasty bugs. Anyone who's really intent on
doing something outside this restriction can always use the
set_join_pathlist_hook.
* Rename fdw_ps_tlist/custom_ps_tlist to fdw_scan_tlist/custom_scan_tlist
to better reflect what they're for, and allow these custom scan tlists
to be used even for base relations.
* Change make_foreignscan() API to include passing the fdw_scan_tlist
value, since the FDW is required to set that. Backwards compatibility
doesn't seem like an adequate reason to expect FDWs to set it in some
ad-hoc extra step, and anyway existing FDWs can just pass NIL.
* Change the API of path-generating subroutines of add_paths_to_joinrel,
and in particular that of GetForeignJoinPaths and set_join_pathlist_hook,
so that various less-used parameters are passed in a struct rather than
as separate parameter-list entries. The objective here is to reduce the
probability that future additions to those parameter lists will result in
source-level API breaks for users of these hooks. It's possible that this
is even a small win for the core code, since most CPU architectures can't
pass more than half a dozen parameters efficiently anyway. I kept root,
joinrel, outerrel, innerrel, and jointype as separate parameters to reduce
code churn in joinpath.c --- in particular, putting jointype into the
struct would have been problematic because of the subroutines' habit of
changing their local copies of that variable.
* Avoid ad-hocery in ExecAssignScanProjectionInfo. It was probably all
right for it to know about IndexOnlyScan, but if the list is to grow
we should refactor the knowledge out to the callers.
* Restore nodeForeignscan.c's previous use of the relcache to avoid
extra GetFdwRoutine lookups for base-relation scans.
* Lots of cleanup of documentation and missed comments. Re-order some
code additions into more logical places.
2015-05-10 20:36:30 +02:00
|
|
|
extern Oid GetForeignServerIdByRelId(Oid relid);
|
|
|
|
extern FdwRoutine *GetFdwRoutineByServerId(Oid serverid);
|
2011-02-20 06:17:18 +01:00
|
|
|
extern FdwRoutine *GetFdwRoutineByRelId(Oid relid);
|
2013-03-07 05:47:38 +01:00
|
|
|
extern FdwRoutine *GetFdwRoutineForRelation(Relation relation, bool makecopy);
|
2014-07-10 21:01:31 +02:00
|
|
|
extern bool IsImportableForeignTable(const char *tablename,
|
|
|
|
ImportForeignSchemaStmt *stmt);
|
2016-02-04 23:05:09 +01:00
|
|
|
extern Path *GetExistingLocalJoinPath(RelOptInfo *joinrel);
|
2011-02-20 06:17:18 +01:00
|
|
|
|
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:18:54 +02:00
|
|
|
#endif /* FDWAPI_H */
|