mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-23 22:41:34 +08:00
Adjust code to PG14 post_parse_analyze_hook changes
PG14 adds an argument to post_parse_analyze_hook https://github.com/postgres/postgres/commit/5fd9dfa5f5
This commit is contained in:
parent
044441e02a
commit
1a05529c40
@ -111,7 +111,12 @@ static ProcessUtility_hook_type prev_ProcessUtility_hook;
|
|||||||
static post_parse_analyze_hook_type extension_post_parse_analyze_hook = NULL;
|
static post_parse_analyze_hook_type extension_post_parse_analyze_hook = NULL;
|
||||||
|
|
||||||
static void inline extension_check(void);
|
static void inline extension_check(void);
|
||||||
|
#if PG14_LT
|
||||||
static void call_extension_post_parse_analyze_hook(ParseState *pstate, Query *query);
|
static void call_extension_post_parse_analyze_hook(ParseState *pstate, Query *query);
|
||||||
|
#else
|
||||||
|
static void call_extension_post_parse_analyze_hook(ParseState *pstate, Query *query,
|
||||||
|
JumbleState *jstate);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char *
|
extern char *
|
||||||
ts_loader_extension_version(void)
|
ts_loader_extension_version(void)
|
||||||
@ -332,7 +337,11 @@ stop_workers_on_db_drop(DropdbStmt *drop_db_statement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
#if PG14_LT
|
||||||
post_analyze_hook(ParseState *pstate, Query *query)
|
post_analyze_hook(ParseState *pstate, Query *query)
|
||||||
|
#else
|
||||||
|
post_analyze_hook(ParseState *pstate, Query *query, JumbleState *jstate)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (query->commandType == CMD_UTILITY)
|
if (query->commandType == CMD_UTILITY)
|
||||||
{
|
{
|
||||||
@ -437,19 +446,27 @@ post_analyze_hook(ParseState *pstate, Query *query)
|
|||||||
(query->commandType != CMD_UTILITY || load_utility_cmd(query->utilityStmt)))
|
(query->commandType != CMD_UTILITY || load_utility_cmd(query->utilityStmt)))
|
||||||
extension_check();
|
extension_check();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call the extension's hook. This is necessary since the extension is
|
* Call the extension's hook. This is necessary since the extension is
|
||||||
* installed during the hook. If we did not do this the extension's hook
|
* installed during the hook. If we did not do this the extension's hook
|
||||||
* would not be called during the first command because the extension
|
* would not be called during the first command because the extension
|
||||||
* would not have yet been installed. Thus the loader captures the
|
* would not have yet been installed. Thus the loader captures the
|
||||||
* extension hook and calls it explicitly after the check for installing
|
* extension hook and calls it explicitly after the check for installing
|
||||||
* the extension.
|
* the extension.
|
||||||
*/
|
*/
|
||||||
|
#if PG14_LT
|
||||||
call_extension_post_parse_analyze_hook(pstate, query);
|
call_extension_post_parse_analyze_hook(pstate, query);
|
||||||
|
#else
|
||||||
|
call_extension_post_parse_analyze_hook(pstate, query, jstate);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (prev_post_parse_analyze_hook != NULL)
|
if (prev_post_parse_analyze_hook != NULL)
|
||||||
{
|
{
|
||||||
|
#if PG14_LT
|
||||||
prev_post_parse_analyze_hook(pstate, query);
|
prev_post_parse_analyze_hook(pstate, query);
|
||||||
|
#else
|
||||||
|
prev_post_parse_analyze_hook(pstate, query, jstate);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,10 +713,18 @@ ts_loader_extension_check(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
#if PG14_LT
|
||||||
call_extension_post_parse_analyze_hook(ParseState *pstate, Query *query)
|
call_extension_post_parse_analyze_hook(ParseState *pstate, Query *query)
|
||||||
|
#else
|
||||||
|
call_extension_post_parse_analyze_hook(ParseState *pstate, Query *query, JumbleState *jstate)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (loaded && extension_post_parse_analyze_hook != NULL)
|
if (loaded && extension_post_parse_analyze_hook != NULL)
|
||||||
{
|
{
|
||||||
|
#if PG14_LT
|
||||||
extension_post_parse_analyze_hook(pstate, query);
|
extension_post_parse_analyze_hook(pstate, query);
|
||||||
|
#else
|
||||||
|
extension_post_parse_analyze_hook(pstate, query, jstate);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <utils/guc.h>
|
#include <utils/guc.h>
|
||||||
#include <utils/inval.h>
|
#include <utils/inval.h>
|
||||||
#include <parser/analyze.h>
|
#include <parser/analyze.h>
|
||||||
|
#include "compat/compat.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
|
|
||||||
#define STR_EXPAND(x) #x
|
#define STR_EXPAND(x) #x
|
||||||
@ -44,7 +45,11 @@ cache_invalidate_callback(Datum arg, Oid relid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
#if PG14_LT
|
||||||
post_analyze_hook(ParseState *pstate, Query *query)
|
post_analyze_hook(ParseState *pstate, Query *query)
|
||||||
|
#else
|
||||||
|
post_analyze_hook(ParseState *pstate, Query *query, JumbleState *jstate)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (ts_extension_is_loaded())
|
if (ts_extension_is_loaded())
|
||||||
elog(WARNING, "mock post_analyze_hook " STR(TIMESCALEDB_VERSION_MOD));
|
elog(WARNING, "mock post_analyze_hook " STR(TIMESCALEDB_VERSION_MOD));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user