Skip to content

Commit 72e3c00

Browse files
committed
Add stub version of parse_partitioning_expression and ExprDoneCond flag as result of ExecEvalExpr for pg10
1 parent 3cb69ae commit 72e3c00

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed

src/partition_filter.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ partition_filter_exec(CustomScanState *node)
600600
ResultRelInfoHolder *rri_holder;
601601
bool isnull;
602602
Datum value;
603+
#if PG_VERSION_NUM < 100000
603604
ExprDoneCond itemIsDone;
605+
#endif
604606
TupleTableSlot *tmp_slot;
605607

606608
/* Fetch PartRelationInfo for this partitioned relation */
@@ -628,8 +630,10 @@ partition_filter_exec(CustomScanState *node)
628630
if (isnull)
629631
elog(ERROR, ERR_PART_ATTR_NULL);
630632

633+
#if PG_VERSION_NUM < 100000
631634
if (itemIsDone != ExprSingleResult)
632635
elog(ERROR, ERR_PART_ATTR_MULTIPLE_RESULTS);
636+
#endif
633637

634638
/* Search for a matching partition */
635639
rri_holder = select_partition_for_insert(value, prel->ev_type, prel,

src/pg_pathman.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,7 @@ get_cheapest_parameterized_child_path(PlannerInfo *root, RelOptInfo *rel,
19391939
NIL,
19401940
required_outer,
19411941
TOTAL_COST,
1942-
true);
1942+
false);
19431943
#else
19441944
cheapest = get_cheapest_path_for_pathkeys(rel->pathlist,
19451945
NIL,

src/pl_funcs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,9 @@ pathman_update_trigger_func(PG_FUNCTION_ARGS)
11271127
Datum value;
11281128
Oid value_type;
11291129
bool isnull;
1130+
#if PG_VERSION_NUM < 100000
11301131
ExprDoneCond itemIsDone;
1132+
#endif
11311133

11321134
Oid *parts;
11331135
int nparts;
@@ -1182,8 +1184,10 @@ pathman_update_trigger_func(PG_FUNCTION_ARGS)
11821184
if (isnull)
11831185
elog(ERROR, ERR_PART_ATTR_NULL);
11841186

1187+
#if PG_VERSION_NUM < 100000
11851188
if (itemIsDone != ExprSingleResult)
11861189
elog(ERROR, ERR_PART_ATTR_MULTIPLE_RESULTS);
1190+
#endif
11871191

11881192
/* Search for matching partitions */
11891193
parts = find_partitions_for_value(value, value_type, prel, &nparts);

src/relation_info.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,13 +579,21 @@ parse_partitioning_expression(const Oid relid,
579579
if (list_length(parsetree_list) != 1)
580580
elog(ERROR, "expression \"%s\" produced more than one query", exp_cstr);
581581

582+
#if PG_VERSION_NUM >= 100000
583+
select_stmt = (SelectStmt *) ((RawStmt *) linitial(parsetree_list))->stmt;
584+
#else
582585
select_stmt = (SelectStmt *) linitial(parsetree_list);
586+
#endif
583587

584588
if (query_string_out)
585589
*query_string_out = query_string;
586590

587591
if (parsetree_out)
592+
#if PG_VERSION_NUM >= 100000
593+
*parsetree_out = (Node *) linitial(parsetree_list);
594+
#else
588595
*parsetree_out = (Node *) select_stmt;
596+
#endif
589597

590598
return ((ResTarget *) linitial(select_stmt->targetList))->val;
591599
}
@@ -662,7 +670,7 @@ cook_partitioning_expression(const Oid relid,
662670

663671
/* This will fail with elog in case of wrong expression */
664672
#if PG_VERSION_NUM >= 100000
665-
querytree_list = pg_analyze_and_rewrite(NULL/* stub value */, query_string, NULL, 0, NULL);
673+
querytree_list = pg_analyze_and_rewrite((RawStmt *) parsetree/* stub value */, query_string, NULL, 0, NULL);
666674
#else
667675
querytree_list = pg_analyze_and_rewrite(parsetree, query_string, NULL, 0);
668676
#endif

src/utility_stmt_hooking.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,9 @@ PathmanCopyFrom(CopyState cstate, Relation parent_rel,
607607
{
608608
TupleTableSlot *slot,
609609
*tmp_slot;
610+
#if PG_VERSION_NUM < 100000
610611
ExprDoneCond itemIsDone;
612+
#endif
611613
bool skip_tuple,
612614
isnull;
613615
Oid tuple_oid = InvalidOid;
@@ -657,8 +659,10 @@ PathmanCopyFrom(CopyState cstate, Relation parent_rel,
657659
if (isnull)
658660
elog(ERROR, ERR_PART_ATTR_NULL);
659661

662+
#if PG_VERSION_NUM < 100000
660663
if (itemIsDone != ExprSingleResult)
661664
elog(ERROR, ERR_PART_ATTR_MULTIPLE_RESULTS);
665+
#endif
662666

663667
/* Search for a matching partition */
664668
rri_holder = select_partition_for_insert(value,

0 commit comments

Comments
 (0)