postgresql/src/backend
Tom Lane 6630ccad7a Restructure creation of run-time pruning steps.
Previously, gen_partprune_steps() always built executor pruning steps
using all suitable clauses, including those containing PARAM_EXEC
Params.  This meant that the pruning steps were only completely safe
for executor run-time (scan start) pruning.  To prune at executor
startup, we had to ignore the steps involving exec Params.  But this
doesn't really work in general, since there may be logic changes
needed as well --- for example, pruning according to the last operator's
btree strategy is the wrong thing if we're not applying that operator.
The rules embodied in gen_partprune_steps() and its minions are
sufficiently complicated that tracking their incremental effects in
other logic seems quite impractical.

Short of a complete redesign, the only safe fix seems to be to run
gen_partprune_steps() twice, once to create executor startup pruning
steps and then again for run-time pruning steps.  We can save a few
cycles however by noting during the first scan whether we rejected
any clauses because they involved exec Params --- if not, we don't
need to do the second scan.

In support of this, refactor the internal APIs in partprune.c to make
more use of passing information in the GeneratePruningStepsContext
struct, rather than as separate arguments.

This is, I hope, the last piece of our response to a bug report from
Alan Jackson.  Back-patch to v11 where this code came in.

Discussion: https://postgr.es/m/FAD28A83-AC73-489E-A058-2681FA31D648@tvsquared.com
2019-05-17 19:44:34 -04:00
..
access Remove extra nbtree half-dead internal page check. 2019-05-16 15:11:58 -07:00
bootstrap In bootstrap mode, use default signal handling for SIGINT etc. 2019-05-14 10:22:28 -04:00
catalog Update SQL features/conformance information to SQL:2016 2019-05-14 15:44:37 +02:00
commands More message style fixes 2019-05-16 19:14:31 -04:00
executor Restructure creation of run-time pruning steps. 2019-05-17 19:44:34 -04:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Improve comment spelling and style in llvmjit_deform.c. 2019-04-30 16:20:07 -07:00
lib Fix example in comment. 2019-04-09 08:33:42 +03:00
libpq Clean up minor warnings from buildfarm. 2019-04-28 12:45:55 -04:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Restructure creation of run-time pruning steps. 2019-05-17 19:44:34 -04:00
optimizer Repair issues with faulty generation of merge-append plans. 2019-05-09 16:53:05 -04:00
parser More message style fixes 2019-05-16 19:14:31 -04:00
partitioning Restructure creation of run-time pruning steps. 2019-05-17 19:44:34 -04:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Cope with EINVAL and EIDRM shmat() failures in PGSharedMemoryAttach. 2019-05-10 14:56:41 -04:00
postmaster More message style fixes 2019-05-16 19:14:31 -04:00
regex Fix misoptimization of "{1,1}" quantifiers in regular expressions. 2019-05-12 18:53:38 -04:00
replication More message style fixes 2019-05-16 19:14:31 -04:00
rewrite Perform RLS subquery checks as the right user when going via a view. 2019-04-02 08:13:59 +01:00
snowball Update copyright for 2019 2019-01-02 12:44:25 -05:00
statistics Fix mvdistinct and dependencies size calculations 2019-04-21 20:23:34 +02:00
storage Standardize ItemIdData terminology. 2019-05-13 15:53:39 -07:00
tcop Fix potential catalog corruption with temporary identity columns 2019-04-29 08:49:03 +02:00
tsearch Fix more strcmp() calls using boolean-like comparisons for result checks 2019-04-12 10:16:49 +09:00
utils More message style fixes 2019-05-16 19:14:31 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00