postgresql/src/backend
David Rowley 5ac9c43073 Cleanup partition pruning step generation
There was some code in gen_prune_steps_from_opexps that needlessly
checked a list was not empty when it clearly had to contain at least one
item. This prompted a further cleanup operation in partprune.c.

Additionally, the previous code could end up adding additional needless
INTERSECT steps. However, those do not appear to be able to cause any
misbehavior.

gen_prune_steps_from_opexps is now no longer in charge of generating
combine pruning steps. Instead, gen_partprune_steps_internal, which
already does some combine step creation has been given the sole
responsibility of generating all combine steps. This means that when
we recursively call gen_partprune_steps_internal, since it always now adds
a combine step when it produces multiple steps, we can just pay attention
to the final step returned.

In passing, do quite a bit of work on the comments to try to more clearly
explain the role of both gen_partprune_steps_internal and
gen_prune_steps_from_opexps. This is fairly complex code so some extra
effort to give any new readers an overview of how things work seems like
a good idea.

Author: Amit Langote
Reported-by: Andy Fan
Reviewed-by: Kyotaro Horiguchi, Andy Fan, Ryan Lambert, David Rowley
Discussion: https://postgr.es/m/CAKU4AWqWoVii+bRTeBQmeVW+PznkdO8DfbwqNsu9Gj4ubt9A6w@mail.gmail.com
2021-04-08 22:35:48 +12:00
..
access autovacuum: handle analyze for partitioned tables 2021-04-08 01:19:36 -04:00
bootstrap Split backend status and progress related functionality out of pgstat.c. 2021-04-03 11:42:52 -07:00
catalog Add functions to wait for backend termination 2021-04-08 11:40:54 +02:00
commands autovacuum: handle analyze for partitioned tables 2021-04-08 01:19:36 -04:00
executor Cope with NULL query string in ExecInitParallelPlan(). 2021-04-07 22:08:24 -07:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
lib Update copyright for 2021 2021-01-02 13:06:25 -05:00
libpq Refactor hba_authname 2021-04-07 14:24:47 +02:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes SQL-standard function body 2021-04-07 21:47:55 +02:00
optimizer SQL-standard function body 2021-04-07 21:47:55 +02:00
parser SQL-standard function body 2021-04-07 21:47:55 +02:00
partitioning Cleanup partition pruning step generation 2021-04-08 22:35:48 +12:00
po Translation updates 2020-05-18 12:49:30 +02:00
port Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
postmaster autovacuum: handle analyze for partitioned tables 2021-04-08 01:19:36 -04:00
regex Further tweak memory management for regex DFAs. 2021-03-08 16:32:29 -05:00
replication Message improvement 2021-04-07 07:42:44 +02:00
rewrite Clean up treatment of missing default and CHECK-constraint records. 2021-04-06 10:34:39 -04:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Fix handling of clauses incompatible with extended statistics 2021-04-06 16:56:06 +02:00
storage Add functions to wait for backend termination 2021-04-08 11:40:54 +02:00
tcop SQL-standard function body 2021-04-07 21:47:55 +02:00
tsearch Don't leak compiled regex(es) when an ispell cache entry is dropped. 2021-03-18 22:22:47 -04:00
utils Add functions to wait for backend termination 2021-04-08 11:40:54 +02:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Add missing gettext triggers 2020-04-28 13:35:40 +02:00