Skip to content

Commit 3cb69ae

Browse files
committed
Merge with rel_future_beta
2 parents b83e27b + 6abb30c commit 3cb69ae

File tree

11 files changed

+110
-148
lines changed

11 files changed

+110
-148
lines changed

expected/pathman_basic.out

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
450450
-> Seq Scan on hash_rel_2
451451
(4 rows)
452452

453+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE false;
454+
QUERY PLAN
455+
--------------------------
456+
Result
457+
One-Time Filter: false
458+
(2 rows)
459+
453460
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = NULL;
454461
QUERY PLAN
455462
--------------------------
@@ -609,6 +616,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
609616
-> Seq Scan on hash_rel_2
610617
(4 rows)
611618

619+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE false;
620+
QUERY PLAN
621+
--------------------------
622+
Result
623+
One-Time Filter: false
624+
(2 rows)
625+
612626
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = NULL;
613627
QUERY PLAN
614628
--------------------------

sql/pathman_basic.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ SET enable_bitmapscan = OFF;
165165
SET enable_seqscan = ON;
166166

167167
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
168+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE false;
168169
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = NULL;
169170
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = 2;
170171
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = 2 OR value = 1;
@@ -189,6 +190,7 @@ SET enable_bitmapscan = OFF;
189190
SET enable_seqscan = OFF;
190191

191192
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
193+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE false;
192194
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = NULL;
193195
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = 2;
194196
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = 2 OR value = 1;

src/hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pathman_join_pathlist_hook(PlannerInfo *root,
137137
{
138138
WrapperNode *wrap;
139139

140-
InitWalkerContext(&context, part_expr, inner_prel, NULL, false);
140+
InitWalkerContext(&context, part_expr, inner_prel, NULL);
141141
wrap = walk_expr_tree((Expr *) lfirst(lc), &context);
142142
paramsel *= wrap->paramsel;
143143
}
@@ -359,7 +359,7 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
359359
ranges = list_make1_irange_full(prel, IR_COMPLETE);
360360

361361
/* Make wrappers over restrictions and collect final rangeset */
362-
InitWalkerContext(&context, part_expr, prel, NULL, false);
362+
InitWalkerContext(&context, part_expr, prel, NULL);
363363
wrappers = NIL;
364364
foreach(lc, rel->baserestrictinfo)
365365
{

src/include/pathman.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,14 @@ typedef struct
139139
Node *prel_expr; /* expression from PartRelationInfo */
140140
const PartRelationInfo *prel; /* main partitioning structure */
141141
ExprContext *econtext; /* for ExecEvalExpr() */
142-
bool for_insert; /* are we in PartitionFilter now? */
143142
} WalkerContext;
144143

145144
/* Usual initialization procedure for WalkerContext */
146-
#define InitWalkerContext(context, expr, prel_info, ecxt, for_ins) \
145+
#define InitWalkerContext(context, expr, prel_info, ecxt) \
147146
do { \
148147
(context)->prel_expr = (expr); \
149148
(context)->prel = (prel_info); \
150149
(context)->econtext = (ecxt); \
151-
(context)->for_insert = (for_ins); \
152150
} while (0)
153151

154152
/* Check that WalkerContext contains ExprContext (plan execution stage) */
@@ -159,11 +157,11 @@ WrapperNode *walk_expr_tree(Expr *expr, WalkerContext *context);
159157

160158

161159
void select_range_partitions(const Datum value,
160+
const Oid collid,
162161
FmgrInfo *cmp_func,
163162
const RangeEntry *ranges,
164163
const int nranges,
165164
const int strategy,
166-
const Oid collid,
167165
WrapperNode *result);
168166

169167

src/nodes_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ rescan_append_common(CustomScanState *node)
741741
/* First we select all available partitions... */
742742
ranges = list_make1_irange_full(prel, IR_COMPLETE);
743743

744-
InitWalkerContext(&wcxt, prel_expr, prel, econtext, false);
744+
InitWalkerContext(&wcxt, prel_expr, prel, econtext);
745745
foreach (lc, scan_state->canon_custom_exprs)
746746
{
747747
WrapperNode *wn;

src/partition_creation.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,7 @@ invoke_init_callback_internal(init_callback_params *cb_params)
15621562

15631563
default:
15641564
WrongPartType(cb_params->parttype);
1565+
result = NULL; /* keep compiler happy */
15651566
}
15661567

15671568
/* Fetch function call data */

src/partition_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ find_partitions_for_value(Datum value, Oid value_type,
403403
CopyToTempConst(constbyval, ev_byval);
404404

405405
/* We use 0 since varno doesn't matter for Const */
406-
InitWalkerContext(&wcxt, 0, prel, NULL, true);
406+
InitWalkerContext(&wcxt, 0, prel, NULL);
407407
ranges = walk_expr_tree((Expr *) &temp_const, &wcxt)->rangeset;
408408

409409
return get_partition_oids(ranges, nparts, prel, false);

0 commit comments

Comments
 (0)