Skip to content

Commit 28668b8

Browse files
committed
Merge branch 'master' of git://git.postgresql.org/git/postgresql
2 parents 3ca1937 + cca705a commit 28668b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+3130
-1032
lines changed

config/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ include $(top_builddir)/src/Makefile.global
77

88
install: all installdirs
99
$(INSTALL_SCRIPT) $(srcdir)/install-sh '$(DESTDIR)$(pgxsdir)/config/install-sh'
10+
$(INSTALL_SCRIPT) $(srcdir)/missing '$(DESTDIR)$(pgxsdir)/config/missing'
1011

1112
installdirs:
1213
$(MKDIR_P) '$(DESTDIR)$(pgxsdir)/config'
1314

1415
uninstall:
1516
rm -f '$(DESTDIR)$(pgxsdir)/config/install-sh'
17+
rm -f '$(DESTDIR)$(pgxsdir)/config/missing'

contrib/file_fdw/file_fdw.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ static ForeignScan *fileGetForeignPlan(PlannerInfo *root,
121121
Oid foreigntableid,
122122
ForeignPath *best_path,
123123
List *tlist,
124-
List *scan_clauses);
124+
List *scan_clauses,
125+
Plan *outer_plan);
125126
static void fileExplainForeignScan(ForeignScanState *node, ExplainState *es);
126127
static void fileBeginForeignScan(ForeignScanState *node, int eflags);
127128
static TupleTableSlot *fileIterateForeignScan(ForeignScanState *node);
@@ -525,6 +526,7 @@ fileGetForeignPaths(PlannerInfo *root,
525526
total_cost,
526527
NIL, /* no pathkeys */
527528
NULL, /* no outer rel either */
529+
NULL, /* no extra plan */
528530
coptions));
529531

530532
/*
@@ -544,7 +546,8 @@ fileGetForeignPlan(PlannerInfo *root,
544546
Oid foreigntableid,
545547
ForeignPath *best_path,
546548
List *tlist,
547-
List *scan_clauses)
549+
List *scan_clauses,
550+
Plan *outer_plan)
548551
{
549552
Index scan_relid = baserel->relid;
550553

@@ -564,7 +567,8 @@ fileGetForeignPlan(PlannerInfo *root,
564567
NIL, /* no expressions to evaluate */
565568
best_path->fdw_private,
566569
NIL, /* no custom tlist */
567-
NIL /* no remote quals */ );
570+
NIL, /* no remote quals */
571+
outer_plan);
568572
}
569573

570574
/*

contrib/postgres_fdw/postgres_fdw.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ static ForeignScan *postgresGetForeignPlan(PlannerInfo *root,
215215
Oid foreigntableid,
216216
ForeignPath *best_path,
217217
List *tlist,
218-
List *scan_clauses);
218+
List *scan_clauses,
219+
Plan *outer_plan);
219220
static void postgresBeginForeignScan(ForeignScanState *node, int eflags);
220221
static TupleTableSlot *postgresIterateForeignScan(ForeignScanState *node);
221222
static void postgresReScanForeignScan(ForeignScanState *node);
@@ -536,6 +537,7 @@ postgresGetForeignPaths(PlannerInfo *root,
536537
fpinfo->total_cost,
537538
NIL, /* no pathkeys */
538539
NULL, /* no outer rel either */
540+
NULL, /* no extra plan */
539541
NIL); /* no fdw_private list */
540542
add_path(baserel, (Path *) path);
541543

@@ -590,6 +592,7 @@ postgresGetForeignPaths(PlannerInfo *root,
590592
total_cost,
591593
usable_pathkeys,
592594
NULL,
595+
NULL,
593596
NIL));
594597
}
595598

@@ -757,6 +760,7 @@ postgresGetForeignPaths(PlannerInfo *root,
757760
total_cost,
758761
NIL, /* no pathkeys */
759762
param_info->ppi_req_outer,
763+
NULL,
760764
NIL); /* no fdw_private list */
761765
add_path(baserel, (Path *) path);
762766
}
@@ -772,7 +776,8 @@ postgresGetForeignPlan(PlannerInfo *root,
772776
Oid foreigntableid,
773777
ForeignPath *best_path,
774778
List *tlist,
775-
List *scan_clauses)
779+
List *scan_clauses,
780+
Plan *outer_plan)
776781
{
777782
PgFdwRelationInfo *fpinfo = (PgFdwRelationInfo *) baserel->fdw_private;
778783
Index scan_relid = baserel->relid;
@@ -916,7 +921,8 @@ postgresGetForeignPlan(PlannerInfo *root,
916921
params_list,
917922
fdw_private,
918923
NIL, /* no custom tlist */
919-
remote_exprs);
924+
remote_exprs,
925+
outer_plan);
920926
}
921927

922928
/*

doc/src/sgml/earthdistance.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<para>
2020
In this module, the Earth is assumed to be perfectly spherical.
2121
(If that's too inaccurate for you, you might want to look at the
22-
<application><ulink url="http://www.postgis.org/">PostGIS</ulink></>
22+
<application><ulink url="http://postgis.net/">PostGIS</ulink></>
2323
project.)
2424
</para>
2525

doc/src/sgml/external-projects.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
contains several extensions, which are described in
232232
<xref linkend="contrib">. Other extensions are developed
233233
independently, like <application><ulink
234-
url="http://www.postgis.org/">PostGIS</ulink></>. Even
234+
url="http://postgis.net/">PostGIS</ulink></>. Even
235235
<productname>PostgreSQL</> replication solutions can be developed
236236
externally. For example, <application> <ulink
237237
url="http://www.slony.info">Slony-I</ulink></> is a popular

doc/src/sgml/fdwhandler.sgml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ GetForeignPlan (PlannerInfo *root,
168168
Oid foreigntableid,
169169
ForeignPath *best_path,
170170
List *tlist,
171-
List *scan_clauses);
171+
List *scan_clauses,
172+
Plan *outer_plan);
172173
</programlisting>
173174

174175
Create a <structname>ForeignScan</> plan node from the selected foreign
@@ -765,6 +766,35 @@ RefetchForeignRow (EState *estate,
765766
See <xref linkend="fdw-row-locking"> for more information.
766767
</para>
767768

769+
<para>
770+
<programlisting>
771+
bool
772+
RecheckForeignScan (ForeignScanState *node, TupleTableSlot *slot);
773+
</programlisting>
774+
Recheck that a previously-returned tuple still matches the relevant
775+
scan and join qualifiers, and possibly provide a modified version of
776+
the tuple. For foreign data wrappers which do not perform join pushdown,
777+
it will typically be more convenient to set this to <literal>NULL</> and
778+
instead set <structfield>fdw_recheck_quals</structfield> appropriately.
779+
When outer joins are pushed down, however, it isn't sufficient to
780+
reapply the checks relevant to all the base tables to the result tuple,
781+
even if all needed attributes are present, because failure to match some
782+
qualifier might result in some attributes going to NULL, rather than in
783+
no tuple being returned. <literal>RecheckForeignScan</> can recheck
784+
qualifiers and return true if they are still satisfied and false
785+
otherwise, but it can also store a replacement tuple into the supplied
786+
slot.
787+
</para>
788+
789+
<para>
790+
To implement join pushdown, a foreign data wrapper will typically
791+
construct an alternative local join plan which is used only for
792+
rechecks; this will become the outer subplan of the
793+
<literal>ForeignScan</>. When a recheck is required, this subplan
794+
can be executed and the resulting tuple can be stored in the slot.
795+
This plan need not be efficient since no base table will return more
796+
than one row; for example, it may implement all joins as nested loops.
797+
</para>
768798
</sect2>
769799

770800
<sect2 id="fdw-callbacks-explain">
@@ -1137,11 +1167,17 @@ GetForeignServerByName(const char *name, bool missing_ok);
11371167

11381168
<para>
11391169
Any clauses removed from the plan node's qual list must instead be added
1140-
to <literal>fdw_recheck_quals</> in order to ensure correct behavior
1170+
to <literal>fdw_recheck_quals</> or rechecked by
1171+
<literal>RecheckForeignScan</> in order to ensure correct behavior
11411172
at the <literal>READ COMMITTED</> isolation level. When a concurrent
11421173
update occurs for some other table involved in the query, the executor
11431174
may need to verify that all of the original quals are still satisfied for
1144-
the tuple, possibly against a different set of parameter values.
1175+
the tuple, possibly against a different set of parameter values. Using
1176+
<literal>fdw_recheck_quals</> is typically easier than implementing checks
1177+
inside <literal>RecheckForeignScan</>, but this method will be
1178+
insufficient when outer joins have been pushed down, since the join tuples
1179+
in that case might have some fields go to NULL without rejecting the
1180+
tuple entirely.
11451181
</para>
11461182

11471183
<para>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy