Skip to content

Commit 4c166c1

Browse files
committed
clean pg_compat.h
1 parent 10e9e1a commit 4c166c1

File tree

5 files changed

+20
-25
lines changed

5 files changed

+20
-25
lines changed

src/include/compat/pg_compat.h

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -273,25 +273,22 @@ extern void create_plain_partial_paths(PlannerInfo *root,
273273

274274

275275
/*
276-
* ExecEvalExpr
277-
*
278-
* 'errmsg' specifies error string when result of ExecEvalExpr doesn't return
279-
* a single value
276+
* ExecEvalExpr()
277+
* NOTE: 'errmsg' specifies error string when ExecEvalExpr returns multiple values.
280278
*/
281279
#if PG_VERSION_NUM >= 100000
282280
#define ExecEvalExprCompat(expr, econtext, isNull, errHandler) \
283281
ExecEvalExpr((expr), (econtext), (isNull))
284282
#elif PG_VERSION_NUM >= 90500
285283
#include "partition_filter.h"
286-
extern Datum exprResult;
287-
extern ExprDoneCond isDone;
288-
static inline void
289-
dummy_handler() { }
290-
static inline void
291-
not_signle_result_handler()
292-
{
293-
elog(ERROR, ERR_PART_ATTR_MULTIPLE_RESULTS);
294-
}
284+
285+
/* Variables for ExecEvalExprCompat() */
286+
extern Datum exprResult;
287+
extern ExprDoneCond isDone;
288+
289+
/* Error handlers */
290+
static inline void mult_result_handler() { elog(ERROR, ERR_PART_ATTR_MULTIPLE_RESULTS); }
291+
295292
#define ExecEvalExprCompat(expr, econtext, isNull, errHandler) \
296293
( \
297294
exprResult = ExecEvalExpr((expr), (econtext), (isNull), &isDone), \
@@ -481,11 +478,11 @@ extern int oid_cmp(const void *p1, const void *p2);
481478
completionTag) \
482479
do { \
483480
PlannedStmt *stmt = makeNode(PlannedStmt); \
484-
stmt->commandType = CMD_UTILITY; \
485-
stmt->canSetTag = true; \
486-
stmt->utilityStmt = (parsetree); \
487-
stmt->stmt_location = -1; \
488-
stmt->stmt_len = 0; \
481+
stmt->commandType = CMD_UTILITY; \
482+
stmt->canSetTag = true; \
483+
stmt->utilityStmt = (parsetree); \
484+
stmt->stmt_location = -1; \
485+
stmt->stmt_len = 0; \
489486
ProcessUtility(stmt, (queryString), (context), (params), NULL, \
490487
(dest), (completionTag)); \
491488
} while (0)
@@ -550,9 +547,6 @@ extern void set_rel_consider_parallel(PlannerInfo *root,
550547
*/
551548

552549
void set_append_rel_size_compat(PlannerInfo *root, RelOptInfo *rel, Index rti);
553-
List *init_createstmts_for_partition(RangeVar *parent_rv,
554-
RangeVar *partition_rv,
555-
char *tablespace);
556550

557551

558552
#endif /* PG_COMPAT_H */

src/partition_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ partition_filter_exec(CustomScanState *node)
642642
tmp_slot = econtext->ecxt_scantuple;
643643
econtext->ecxt_scantuple = slot;
644644
value = ExecEvalExprCompat(state->expr_state, econtext, &isnull,
645-
not_signle_result_handler);
645+
mult_result_handler);
646646
econtext->ecxt_scantuple = tmp_slot;
647647

648648
if (isnull)

src/pg_pathman.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ ExtractConst(Node *node, const WalkerContext *context)
159159

160160
/* Evaluate expression */
161161
estate = ExecInitExpr((Expr *) node, NULL);
162-
value = ExecEvalExpr(estate, context->econtext, &isnull, NULL);
162+
value = ExecEvalExprCompat(estate, context->econtext, &isnull,
163+
mult_result_handler);
163164

164165
switch (nodeTag(node))
165166
{

src/pl_funcs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ pathman_update_trigger_func(PG_FUNCTION_ARGS)
12331233
new_tuple,
12341234
&value_type);
12351235
value = ExecEvalExprCompat(expr_state, econtext, &isnull,
1236-
not_signle_result_handler);
1236+
mult_result_handler);
12371237
MemoryContextSwitchTo(old_mcxt);
12381238

12391239
if (isnull)

src/utility_stmt_hooking.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ PathmanCopyFrom(CopyState cstate, Relation parent_rel,
649649
tmp_slot = econtext->ecxt_scantuple;
650650
econtext->ecxt_scantuple = slot;
651651
value = ExecEvalExprCompat(expr_state, econtext, &isnull,
652-
not_signle_result_handler);
652+
mult_result_handler);
653653
econtext->ecxt_scantuple = tmp_slot;
654654

655655
if (isnull)

0 commit comments

Comments
 (0)