postgresql/src/include
Tom Lane 34ea1ab7fd Split create_foreignscan_path() into three functions.
Up to now postgres_fdw has been using create_foreignscan_path() to
generate not only base-relation paths, but also paths for foreign joins
and foreign upperrels.  This is wrong, because create_foreignscan_path()
calls get_baserel_parampathinfo() which will only do the right thing for
baserels.  It accidentally fails to fail for unparameterized paths, which
are the only ones postgres_fdw (thought it) was handling, but we really
need different APIs for the baserel and join cases.

In HEAD, the best thing to do seems to be to split up the baserel,
joinrel, and upperrel cases into three functions so that they can
have different APIs.  I haven't actually given create_foreign_join_path
a different API in this commit: we should spend a bit of time thinking
about just what we want to do there, since perhaps FDWs would want to
do something different from the build-up-a-join-pairwise approach that
get_joinrel_parampathinfo expects.  In the meantime, since postgres_fdw
isn't prepared to generate parameterized joins anyway, just give it a
defense against trying to plan joins with lateral refs.

In addition (and this is what triggered this whole mess) fix bug #15613
from Srinivasan S A, by teaching file_fdw and postgres_fdw that plain
baserel foreign paths still have outer refs if the relation has
lateral_relids.  Add some assertions in relnode.c to catch future
occurrences of the same error --- in particular, to catch other FDWs
doing that, but also as backstop against core-code mistakes like the
one fixed by commit bdd9a99aa.

Bug #15613 also needs to be fixed in the back branches, but the
appropriate fix will look quite a bit different there, since we don't
want to assume that existing FDWs get the word right away.

Discussion: https://postgr.es/m/15613-092be1be9576c728@postgresql.org
2019-02-07 13:11:12 -05:00
..
access Fix heap_getattr() handling of fast defaults. 2019-02-06 01:09:32 -08:00
bootstrap Update copyright for 2019 2019-01-02 12:44:25 -05:00
catalog Use EXECUTE FUNCTION syntax for triggers more 2019-02-07 09:21:34 +01:00
commands Move vacuumlazy.c into access/heap. 2019-01-15 12:06:19 -08:00
common Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
datatype Update copyright for 2019 2019-01-02 12:44:25 -05:00
executor Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
fe_utils pgbench: add \cset and \gset commands 2019-01-10 13:42:20 -03:00
foreign Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
jit Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
lib Update copyright for 2019 2019-01-02 12:44:25 -05:00
libpq Add more columns to pg_stat_ssl 2019-02-01 00:33:47 +01:00
mb Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodes Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
optimizer Split create_foreignscan_path() into three functions. 2019-02-07 13:11:12 -05:00
parser Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
partitioning Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
port Update copyright for 2019 2019-01-02 12:44:25 -05:00
portability Update copyright for 2019 2019-01-02 12:44:25 -05:00
postmaster Update copyright for 2019 2019-01-02 12:44:25 -05:00
regex Update copyright for 2019 2019-01-02 12:44:25 -05:00
replication Update copyright for 2019 2019-01-02 12:44:25 -05:00
rewrite Update copyright for 2019 2019-01-02 12:44:25 -05:00
snowball Update copyright for 2019 2019-01-02 12:44:25 -05:00
statistics Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
storage Avoid creation of the free space map for small heap relations, take 2. 2019-02-04 07:49:15 +05:30
tcop Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsearch Update copyright for 2019 2019-01-02 12:44:25 -05:00
utils Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
fmgr.h Change function call information to be variable length. 2019-01-26 14:17:52 -08:00
funcapi.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
getaddrinfo.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
getopt_long.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
Makefile Install JIT related headers. 2019-01-28 13:51:12 -08:00
miscadmin.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_config.h.in Second try at fixing ecpglib thread-safety problem. 2019-01-21 16:17:10 -05:00
pg_config.h.win32 Second try at fixing ecpglib thread-safety problem. 2019-01-21 16:17:10 -05:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_getopt.h Use our own getopt() on OpenBSD. 2019-01-18 15:06:26 -05:00
pg_trace.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pgstat.h Add more columns to pg_stat_ssl 2019-02-01 00:33:47 +01:00
pgtar.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pgtime.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
port.h Fix misc typos in comments. 2019-01-23 13:39:00 +02:00
postgres.h Change function call information to be variable length. 2019-01-26 14:17:52 -08:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
rusagestub.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
windowapi.h Update copyright for 2019 2019-01-02 12:44:25 -05:00