postgresql/src
Tom Lane e3101a0317 Ensure that foreign scans with lateral refs are planned correctly.
As reported in bug #15613 from Srinivasan S A, file_fdw and postgres_fdw
neglected to mark plain baserel foreign paths as parameterized when the
relation has lateral_relids.  Other FDWs have surely copied this mistake,
so rather than just patching those two modules, install a band-aid fix
in create_foreignscan_path to rectify the mistake centrally.

Although the band-aid is enough to fix the visible symptom, correct
the calls in file_fdw and postgres_fdw anyway, so that they are valid
examples for external FDWs.

Also, since the band-aid isn't enough to make this work for parameterized
foreign joins, throw an elog(ERROR) if such a case is passed to
create_foreignscan_path.  This shouldn't pose much of a problem for
existing external FDWs, since it's likely they aren't trying to make such
paths anyway (though some of them may need a defense against joins with
lateral_relids, similar to the one this patch installs into postgres_fdw).

Add some assertions in relnode.c to catch future occurrences of the same
error --- in particular, as backstop against core-code mistakes like the
one fixed by commit bdd9a99aa.

Discussion: https://postgr.es/m/15613-092be1be9576c728@postgresql.org
2019-02-07 13:11:14 -05:00
..
backend Ensure that foreign scans with lateral refs are planned correctly. 2019-02-07 13:11:14 -05:00
bin Fix searchpath and module location for pg_rewind and ssl TAP tests 2019-02-07 11:10:06 -05:00
common Fix portability failure introduced in commits d2b0b60e7 et al. 2018-12-26 15:30:27 -05:00
fe_utils Fix translation of special characters in psql's LaTeX output modes. 2018-11-26 17:32:51 -05:00
include Fix misc typos in comments. 2019-01-23 13:50:50 +02:00
interfaces Remove infinite-loop hazards in ecpg test suite. 2019-01-24 16:46:55 -05:00
makefiles Move port-specific parts of with_temp_install to port makefile. 2019-02-04 18:57:27 +00:00
pl Fix misc typos in comments. 2019-01-23 13:50:50 +02:00
port Use our own getopt() on OpenBSD. 2019-01-18 15:06:26 -05:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Fix searchpath and module location for pg_rewind and ssl TAP tests 2019-02-07 11:10:06 -05:00
timezone Update time zone data files to tzdata release 2018i. 2019-02-05 10:59:15 -05:00
tools Unify searchpath and do file logic in MSVC build scripts. 2019-02-06 07:49:27 -05:00
tutorial Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Build src/test/isolation during "make" and "make install". 2017-11-22 20:18:52 -08:00
Makefile.global.in Move port-specific parts of with_temp_install to port makefile. 2019-02-04 18:57:27 +00:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00