From 73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 10 Jun 2018 15:22:25 -0400 Subject: Improve run-time partition pruning to handle any stable expression. The initial coding of the run-time-pruning feature only coped with cases where the partition key(s) are compared to Params. That is a bit silly; we can allow it to work with any non-Var-containing stable expression, as long as we take special care with expressions containing PARAM_EXEC Params. The code is hardly any longer this way, and it's considerably clearer (IMO at least). Per gripe from Pavel Stehule. David Rowley, whacked around a bit by me Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com --- src/backend/nodes/copyfuncs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/backend/nodes/copyfuncs.c') diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 7c045a7afef..db14a99e442 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -2175,10 +2175,13 @@ _copyPartitionPruneInfo(const PartitionPruneInfo *from) COPY_NODE_FIELD(pruning_steps); COPY_BITMAPSET_FIELD(present_parts); COPY_SCALAR_FIELD(nparts); + COPY_SCALAR_FIELD(nexprs); COPY_POINTER_FIELD(subnode_map, from->nparts * sizeof(int)); COPY_POINTER_FIELD(subpart_map, from->nparts * sizeof(int)); - COPY_BITMAPSET_FIELD(extparams); - COPY_BITMAPSET_FIELD(execparams); + COPY_POINTER_FIELD(hasexecparam, from->nexprs * sizeof(bool)); + COPY_SCALAR_FIELD(do_initial_prune); + COPY_SCALAR_FIELD(do_exec_prune); + COPY_BITMAPSET_FIELD(execparamids); return newnode; } -- cgit v1.2.3