Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 60d50d5

Browse files
committed
Fix incompatibility with 10 version of Postgres
1 parent 85ddcf6 commit 60d50d5

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

deparse.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ static void deparseExpr(Expr *expr, deparse_expr_cxt *context);
114114
static void deparseVar(Var *node, deparse_expr_cxt *context);
115115
static void deparseConst(Const *node, deparse_expr_cxt *context, int showtype);
116116
static void deparseParam(Param *node, deparse_expr_cxt *context);
117+
#if PG_VERSION_NUM>=120000
117118
static void deparseSubscriptingRef(SubscriptingRef *node, deparse_expr_cxt *context);
119+
#else
120+
static void deparseArrayRef(ArrayRef *node, deparse_expr_cxt *context);
121+
#endif
118122
static void deparseFuncExpr(FuncExpr *node, deparse_expr_cxt *context);
119123
static void deparseOpExpr(OpExpr *node, deparse_expr_cxt *context);
120124
static void deparseOperatorName(StringInfo buf, Form_pg_operator opform);
@@ -246,10 +250,15 @@ foreign_expr_walker(Node *node,
246250
case T_Const:
247251
case T_Param:
248252
break;
253+
#if PG_VERSION_NUM>=120000
249254
case T_SubscriptingRef:
250255
{
251256
SubscriptingRef *ar = (SubscriptingRef *) node;
252-
257+
#else
258+
case T_ArrayRef:
259+
{
260+
ArrayRef *ar = (ArrayRef *) node;
261+
#endif
253262
/* Assignment should not be in restrictions. */
254263
if (ar->refassgnexpr != NULL)
255264
return false;
@@ -1490,8 +1499,13 @@ deparseExpr(Expr *node, deparse_expr_cxt *context)
14901499
case T_Param:
14911500
deparseParam((Param *) node, context);
14921501
break;
1502+
#if PG_VERSION_NUM>=120000
14931503
case T_SubscriptingRef:
14941504
deparseSubscriptingRef((SubscriptingRef *) node, context);
1505+
#else
1506+
case T_ArrayRef:
1507+
deparseArrayRef((ArrayRef *) node, context);
1508+
#endif
14951509
break;
14961510
case T_FuncExpr:
14971511
deparseFuncExpr((FuncExpr *) node, context);
@@ -1724,8 +1738,13 @@ deparseParam(Param *node, deparse_expr_cxt *context)
17241738
/*
17251739
* Deparse an array subscript expression.
17261740
*/
1741+
#if PG_VERSION_NUM>=120000
17271742
static void
17281743
deparseSubscriptingRef(SubscriptingRef *node, deparse_expr_cxt *context)
1744+
#else
1745+
static void
1746+
deparseArrayRef(ArrayRef *node, deparse_expr_cxt *context)
1747+
#endif
17291748
{
17301749
StringInfo buf = context->buf;
17311750
ListCell *lowlist_item;

vops_fdw.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ estimate_path_cost_size(PlannerInfo *root,
10281028
startup_cost += aggcosts.transCost.per_tuple * input_rows;
10291029
startup_cost += (cpu_operator_cost * numGroupCols) * input_rows;
10301030
startup_cost += ptarget->cost.startup;
1031-
1031+
10321032
/*-----
10331033
* Run time cost includes:
10341034
* 1. Run time cost of underneath input relation
@@ -1037,15 +1037,19 @@ estimate_path_cost_size(PlannerInfo *root,
10371037
*-----
10381038
*/
10391039
run_cost = ofpinfo->rel_total_cost - ofpinfo->rel_startup_cost;
1040+
#if PG_VERSION_NUM>=120000
10401041
run_cost += aggcosts.finalCost.per_tuple * numGroups;
1042+
#else
1043+
run_cost += aggcosts.finalCost * numGroups;
1044+
#endif
10411045
run_cost += cpu_tuple_cost * numGroups;
10421046
run_cost += ptarget->cost.per_tuple * numGroups;
10431047
}
10441048
else
10451049
{
10461050
/* Clamp retrieved rows estimates to at most foreignrel->tuples. */
10471051
retrieved_rows = Min(retrieved_rows, foreignrel->tuples);
1048-
1052+
10491053
/*
10501054
* Cost as though this were a seqscan, which is pessimistic. We
10511055
* effectively imagine the local_conds are being evaluated

0 commit comments

Comments
 (0)