postgresql/src/backend
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
..
access Prevent excess SimpleLruTruncate() deletion. 2021-01-16 12:21:38 -08:00
bootstrap Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
catalog Prevent drop of tablespaces used by partitioned relations 2021-01-14 15:32:14 -03:00
commands Prevent excess SimpleLruTruncate() deletion. 2021-01-16 12:21:38 -08:00
executor Avoid crash with WHERE CURRENT OF and a custom scan plan. 2021-01-18 18:32:40 -05:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit jit: Correct parameter type for generated expression evaluation functions. 2020-12-07 18:33:03 -08:00
lib Use pg_bitutils for HyperLogLog. 2020-07-30 09:17:00 -07:00
libpq Fix up usage of krb_server_keyfile GUC parameter. 2020-12-30 11:38:42 -05:00
main Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nodes Ensure that expandTableLikeClause() re-examines the same table. 2020-12-01 14:02:27 -05:00
optimizer Improve find_em_expr_usable_for_sorting_rel comment 2020-12-22 02:01:42 +01:00
parser Ensure that expandTableLikeClause() re-examines the same table. 2020-12-01 14:02:27 -05:00
partitioning Do not return NULL for error cases in satisfies_hash_partition(). 2020-11-16 16:39:59 -05:00
po Translation updates 2020-11-09 12:34:05 +01:00
port Spelling adjustments 2020-06-07 15:06:51 +02:00
postmaster Fix assorted issues in backend's GSSAPI encryption support. 2020-12-28 17:44:17 -05:00
regex Fix ancient bug in parsing of BRE-mode regular expressions. 2021-01-08 12:16:00 -05:00
replication Ensure that a standby is able to follow a primary on a newer timeline. 2021-01-14 12:28:47 +09:00
rewrite Calculate extraUpdatedCols in query rewriter, not parser. 2020-10-28 13:47:02 -04:00
snowball Update copyrights for 2020 2020-01-01 12:21:45 -05:00
statistics Run pgindent with new pg_bsd_indent version 2.1.1. 2020-05-16 11:54:51 -04:00
storage Prevent excess SimpleLruTruncate() deletion. 2021-01-16 12:21:38 -08:00
tcop Further second thoughts about idle_session_timeout patch. 2021-01-07 11:45:09 -05:00
tsearch Avoid possible dangling-pointer access in tsearch_readline_callback. 2020-09-23 11:36:13 -04:00
utils Add an explicit cast to double when using fabs(). 2021-01-05 11:51:21 +00:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nls.mk Translation updates 2020-09-14 13:14:53 +02:00