postgresql/src
Tom Lane f0f53195b5 Avoid crash with WHERE CURRENT OF and a custom scan plan.
execCurrent.c's search_plan_tree() assumed that ForeignScanStates
and CustomScanStates necessarily have a valid ss_currentRelation.
This is demonstrably untrue for postgres_fdw's remote join and
remote aggregation plans, and non-leaf custom scans might not have
an identifiable scan relation either.  Avoid crashing by ignoring
such nodes when the field is null.

This solution will lead to errors like 'cursor "foo" is not a
simply updatable scan of table "bar"' in cases where maybe we
could have allowed WHERE CURRENT OF to work.  That's not an issue
for postgres_fdw's usages, since joins or aggregations would render
WHERE CURRENT OF invalid anyway.  But an otherwise-transparent
upper level custom scan node might find this annoying.  When and if
someone cares to expend work on such a scenario, we could invent a
custom-scan-provider callback to determine what's safe.

Report and patch by David Geier, commentary by me.  It's been like
this for awhile, so back-patch to all supported branches.

Discussion: https://postgr.es/m/0253344d-9bdd-11c4-7f0d-d88c02cd7991@swarm64.com
2021-01-18 18:32:40 -05:00
..
backend Avoid crash with WHERE CURRENT OF and a custom scan plan. 2021-01-18 18:32:40 -05:00
bin Fix pg_dump for GRANT OPTION among initial privileges. 2021-01-16 12:21:38 -08:00
common Second thoughts on TOAST decompression. 2020-11-02 11:25:18 -05:00
fe_utils Remove incorrect %s in string 2020-11-09 10:38:43 +01:00
include Prevent excess SimpleLruTruncate() deletion. 2021-01-16 12:21:38 -08:00
interfaces Fix bugs in libpq's GSSAPI encryption support. 2020-12-28 15:43:44 -05:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Further fix thinko in plpgsql memory leak fix. 2020-12-28 11:55:32 -05:00
port Clear some style deviations. 2020-05-21 08:31:16 -07:00
template Improve our heuristic for selecting PG_SYSROOT on macOS. 2021-01-15 11:29:05 -05:00
test Fix pg_dump for GRANT OPTION among initial privileges. 2021-01-16 12:21:38 -08:00
timezone Update time zone data files to tzdata release 2020d. 2020-10-22 21:24:01 -04:00
tools backpatch "jit: Add support for LLVM 12." 2020-12-07 18:32:32 -08:00
tutorial Update copyrights for 2020 2020-01-01 12:21:45 -05: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 Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Update Unicode data to Unicode 13.0.0 and CLDR 37 2020-04-24 09:52:59 +02:00
Makefile.shlib Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00