in include/compatibility.h [40:178]
static void PU_hook(PlannedStmt *pstmt, const char *queryString, bool ReadOnlyTree, \
ProcessUtilityContext context, ParamListInfo params, \
QueryEnvironment *queryEnv, \
DestReceiver *dest, QueryCompletion *qc)
#define _prev_hook \
prev_hook(pstmt, queryString, ReadOnlyTree, context, params, queryEnv, dest, qc)
#define _standard_ProcessUtility \
standard_ProcessUtility(pstmt, queryString, ReadOnlyTree, context, params, queryEnv, dest, qc)
#define getObjectIdentity(address) \
getObjectIdentity(address,false)
#endif /* 14+ */
/*
* PostgreSQL version 13+
*
* Introduces QueryCompletion struct
*/
#if PG_VERSION_NUM >= 130000
#ifndef _PU_HOOK
#define _PU_HOOK \
static void PU_hook(PlannedStmt *pstmt, const char *queryString, \
ProcessUtilityContext context, ParamListInfo params, \
QueryEnvironment *queryEnv, \
DestReceiver *dest, QueryCompletion *qc)
#define _prev_hook \
prev_hook(pstmt, queryString, context, params, queryEnv, dest, qc)
#define _standard_ProcessUtility \
standard_ProcessUtility(pstmt, queryString, context, params, queryEnv, dest, qc)
#endif
#endif /* 13+ */
/*
* PostgreSQL version 10+
*
* - Introduces PlannedStmt struct
* - Introduces varlena.h
*/
#if PG_VERSION_NUM >= 100000
#ifndef _PU_HOOK
#define _PU_HOOK \
static void PU_hook(PlannedStmt *pstmt, const char *queryString, \
ProcessUtilityContext context, ParamListInfo params, \
QueryEnvironment *queryEnv, \
DestReceiver *dest, char *completionTag)
#define _prev_hook \
prev_hook(pstmt, queryString, context, params, queryEnv, dest, completionTag)
#define _standard_ProcessUtility \
standard_ProcessUtility(pstmt, queryString, context, params, queryEnv, dest, completionTag)
#endif
#define pu_parsetree ((Node *) pstmt->utilityStmt)
#endif /* 10+ */
#if !defined(PG_VERSION_NUM) || PG_VERSION_NUM < 120000
#error "This extension only builds with PostgreSQL 12 or later"
#endif
/* additional compatibility hacks */
#if PG_VERSION_NUM >= 150000
#define PG_ANALYZE_AND_REWRITE pg_analyze_and_rewrite_fixedparams
#else
#define PG_ANALYZE_AND_REWRITE pg_analyze_and_rewrite
#endif
/*
* PostgreSQL 15 introduces the ability to assign permissions to adjust server
* variables. This adds the call for the new function in previous PostgreSQL
* versions.
*/
#if PG_VERSION_NUM < 150000
#define set_config_option_ext(name, value, context, source, srole, action, changeVal, \
elevel, is_reload) \
set_config_option(name, value, context, source, action, changeVal, elevel, \
is_reload)
#endif
#if PG_VERSION_NUM < 140000
#define GETOBJECTDESCRIPTION(a) getObjectDescription(a)
#else
#define GETOBJECTDESCRIPTION(a) getObjectDescription(a, false)
#endif
/* if prior to pg13, upgrade to newer macro defs.
* This also adds support for PG_FINALLY */
#if PG_VERSION_NUM < 130000
#ifdef PG_TRY
#undef PG_TRY
#endif
#ifdef PG_CATCH
#undef PG_CATCH
#endif
#ifdef PG_END_TRY
#undef PG_END_TRY
#endif
#define PG_TRY() \
do { \
sigjmp_buf *_save_exception_stack = PG_exception_stack; \
ErrorContextCallback *_save_context_stack = error_context_stack; \
sigjmp_buf _local_sigjmp_buf; \
bool _do_rethrow = false; \
if (sigsetjmp(_local_sigjmp_buf, 0) == 0) \
{ \
PG_exception_stack = &_local_sigjmp_buf
#define PG_CATCH() \
} \
else \
{ \
PG_exception_stack = _save_exception_stack; \
error_context_stack = _save_context_stack
#define PG_FINALLY() \
} \
else \
_do_rethrow = true; \
{ \
PG_exception_stack = _save_exception_stack; \
error_context_stack = _save_context_stack
#define PG_END_TRY() \
} \
if (_do_rethrow) \
PG_RE_THROW(); \
PG_exception_stack = _save_exception_stack; \
error_context_stack = _save_context_stack; \
} while (0)