Add wrapper function introduced in PG11 for compatibility

pull/2572/head
Hanefi Onaldi 2019-01-23 11:53:33 +03:00
parent 1106e14385
commit 574b071113
No known key found for this signature in database
GPG Key ID: 95177DABDC09D1F5
2 changed files with 29 additions and 0 deletions

View File

@ -67,6 +67,7 @@
#include "distributed/query_colocation_checker.h"
#include "distributed/recursive_planning.h"
#include "distributed/relation_restriction_equivalence.h"
#include "distributed/version_compat.h"
#include "lib/stringinfo.h"
#include "optimizer/planner.h"
#include "optimizer/prep.h"

View File

@ -23,6 +23,7 @@
#include "optimizer/prep.h"
#include "postmaster/bgworker.h"
#include "utils/memutils.h"
#include "funcapi.h"
/* PostgreSQL 11 splits hash procs into "standard" and "extended" */
#define HASHSTANDARD_PROC HASHPROC
@ -134,6 +135,33 @@ canonicalize_qual_compat(Expr *qual, bool is_check)
}
/*
* A convenient wrapper around get_expr_result_type() that is added on PG11
*
* Note that this function ignores the second parameter and behaves
* slightly differently.
*
* 1. The original function throws errors if noError flag is not set, we ignore
* this flag here and return NULL in that case
* 2. TYPEFUNC_COMPOSITE_DOMAIN is introduced in PG11, and references to this
* macro is removed
* */
static inline TupleDesc
get_expr_result_tupdesc(Node *expr, bool noError)
{
TupleDesc tupleDesc;
TypeFuncClass functypclass;
functypclass = get_expr_result_type(expr, NULL, &tupleDesc);
if (functypclass == TYPEFUNC_COMPOSITE)
{
return tupleDesc;
}
return NULL;
}
#endif
#if (PG_VERSION_NUM >= 110000)