mirror of https://github.com/citusdata/citus.git
Support for v13
parent
65cf9f0a6c
commit
acd49b68aa
|
@ -3,7 +3,7 @@
|
||||||
DO $proc$
|
DO $proc$
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
IF version() ~ '12' THEN
|
IF version() ~ '12' or version() ~ '13' THEN
|
||||||
EXECUTE $$
|
EXECUTE $$
|
||||||
CREATE FUNCTION cstore_tableam_handler(internal)
|
CREATE FUNCTION cstore_tableam_handler(internal)
|
||||||
RETURNS table_am_handler
|
RETURNS table_am_handler
|
||||||
|
|
43
cstore_fdw.c
43
cstore_fdw.c
|
@ -20,7 +20,11 @@
|
||||||
|
|
||||||
#include "access/heapam.h"
|
#include "access/heapam.h"
|
||||||
#include "access/reloptions.h"
|
#include "access/reloptions.h"
|
||||||
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
#include "access/heaptoast.h"
|
||||||
|
#else
|
||||||
#include "access/tuptoaster.h"
|
#include "access/tuptoaster.h"
|
||||||
|
#endif
|
||||||
#include "access/xact.h"
|
#include "access/xact.h"
|
||||||
#include "catalog/catalog.h"
|
#include "catalog/catalog.h"
|
||||||
#include "catalog/indexing.h"
|
#include "catalog/indexing.h"
|
||||||
|
@ -110,7 +114,14 @@ static const CStoreValidOption ValidOptionArray[] =
|
||||||
static object_access_hook_type prevObjectAccessHook = NULL;
|
static object_access_hook_type prevObjectAccessHook = NULL;
|
||||||
|
|
||||||
/* local functions forward declarations */
|
/* local functions forward declarations */
|
||||||
#if PG_VERSION_NUM >= 100000
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
static void CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString,
|
||||||
|
ProcessUtilityContext context,
|
||||||
|
ParamListInfo paramListInfo,
|
||||||
|
QueryEnvironment *queryEnvironment,
|
||||||
|
DestReceiver *destReceiver,
|
||||||
|
QueryCompletion *queryCompletion);
|
||||||
|
#elif PG_VERSION_NUM >= 100000
|
||||||
static void CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString,
|
static void CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString,
|
||||||
ProcessUtilityContext context,
|
ProcessUtilityContext context,
|
||||||
ParamListInfo paramListInfo,
|
ParamListInfo paramListInfo,
|
||||||
|
@ -216,7 +227,8 @@ static ProcessUtility_hook_type PreviousProcessUtilityHook = NULL;
|
||||||
void
|
void
|
||||||
cstore_fdw_init()
|
cstore_fdw_init()
|
||||||
{
|
{
|
||||||
PreviousProcessUtilityHook = ProcessUtility_hook;
|
PreviousProcessUtilityHook = (ProcessUtility_hook != NULL) ?
|
||||||
|
ProcessUtility_hook : standard_ProcessUtility;
|
||||||
ProcessUtility_hook = CStoreProcessUtility;
|
ProcessUtility_hook = CStoreProcessUtility;
|
||||||
prevObjectAccessHook = object_access_hook;
|
prevObjectAccessHook = object_access_hook;
|
||||||
object_access_hook = CStoreFdwObjectAccessHook;
|
object_access_hook = CStoreFdwObjectAccessHook;
|
||||||
|
@ -284,7 +296,14 @@ cstore_ddl_event_end_trigger(PG_FUNCTION_ARGS)
|
||||||
* the previous utility hook or the standard utility command via macro
|
* the previous utility hook or the standard utility command via macro
|
||||||
* CALL_PREVIOUS_UTILITY.
|
* CALL_PREVIOUS_UTILITY.
|
||||||
*/
|
*/
|
||||||
#if PG_VERSION_NUM >= 100000
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
static void
|
||||||
|
CStoreProcessUtility(PlannedStmt *plannedStatement, const char *queryString,
|
||||||
|
ProcessUtilityContext context,
|
||||||
|
ParamListInfo paramListInfo,
|
||||||
|
QueryEnvironment *queryEnvironment,
|
||||||
|
DestReceiver *destReceiver, QueryCompletion *queryCompletion)
|
||||||
|
#elif PG_VERSION_NUM >= 100000
|
||||||
static void
|
static void
|
||||||
CStoreProcessUtility(PlannedStmt * plannedStatement, const char * queryString,
|
CStoreProcessUtility(PlannedStmt * plannedStatement, const char * queryString,
|
||||||
ProcessUtilityContext context,
|
ProcessUtilityContext context,
|
||||||
|
@ -299,6 +318,9 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
|
||||||
DestReceiver * destReceiver, char * completionTag)
|
DestReceiver * destReceiver, char * completionTag)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
char *completionTag = NULL;
|
||||||
|
#endif
|
||||||
#if PG_VERSION_NUM >= 100000
|
#if PG_VERSION_NUM >= 100000
|
||||||
Node *parseTree = plannedStatement->utilityStmt;
|
Node *parseTree = plannedStatement->utilityStmt;
|
||||||
#endif
|
#endif
|
||||||
|
@ -313,8 +335,7 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo,
|
CALL_PREVIOUS_UTILITY();
|
||||||
destReceiver, completionTag);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nodeTag(parseTree) == T_TruncateStmt)
|
else if (nodeTag(parseTree) == T_TruncateStmt)
|
||||||
|
@ -330,8 +351,7 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
|
||||||
{
|
{
|
||||||
truncateStatement->relations = otherTablesList;
|
truncateStatement->relations = otherTablesList;
|
||||||
|
|
||||||
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo,
|
CALL_PREVIOUS_UTILITY();
|
||||||
destReceiver, completionTag);
|
|
||||||
|
|
||||||
/* restore the former relation list. Our
|
/* restore the former relation list. Our
|
||||||
* replacement could be freed but still needed
|
* replacement could be freed but still needed
|
||||||
|
@ -352,21 +372,18 @@ CStoreProcessUtility(Node * parseTree, const char * queryString,
|
||||||
{
|
{
|
||||||
AlterTableStmt *alterTable = (AlterTableStmt *) parseTree;
|
AlterTableStmt *alterTable = (AlterTableStmt *) parseTree;
|
||||||
CStoreProcessAlterTableCommand(alterTable);
|
CStoreProcessAlterTableCommand(alterTable);
|
||||||
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo,
|
CALL_PREVIOUS_UTILITY();
|
||||||
destReceiver, completionTag);
|
|
||||||
}
|
}
|
||||||
else if (nodeTag(parseTree) == T_DropdbStmt)
|
else if (nodeTag(parseTree) == T_DropdbStmt)
|
||||||
{
|
{
|
||||||
/* let postgres handle error checking and dropping of the database */
|
/* let postgres handle error checking and dropping of the database */
|
||||||
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo,
|
CALL_PREVIOUS_UTILITY();
|
||||||
destReceiver, completionTag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle other utility statements */
|
/* handle other utility statements */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo,
|
CALL_PREVIOUS_UTILITY();
|
||||||
destReceiver, completionTag);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,11 @@
|
||||||
#include "access/rewriteheap.h"
|
#include "access/rewriteheap.h"
|
||||||
#include "access/tableam.h"
|
#include "access/tableam.h"
|
||||||
#include "access/tsmapi.h"
|
#include "access/tsmapi.h"
|
||||||
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
#include "access/heaptoast.h"
|
||||||
|
#else
|
||||||
#include "access/tuptoaster.h"
|
#include "access/tuptoaster.h"
|
||||||
|
#endif
|
||||||
#include "access/xact.h"
|
#include "access/xact.h"
|
||||||
#include "catalog/catalog.h"
|
#include "catalog/catalog.h"
|
||||||
#include "catalog/index.h"
|
#include "catalog/index.h"
|
||||||
|
@ -41,6 +45,7 @@
|
||||||
#include "cstore.h"
|
#include "cstore.h"
|
||||||
#include "cstore_customscan.h"
|
#include "cstore_customscan.h"
|
||||||
#include "cstore_tableam.h"
|
#include "cstore_tableam.h"
|
||||||
|
#include "cstore_version_compat.h"
|
||||||
|
|
||||||
#define CSTORE_TABLEAM_NAME "cstore_tableam"
|
#define CSTORE_TABLEAM_NAME "cstore_tableam"
|
||||||
|
|
||||||
|
@ -70,6 +75,15 @@ static ProcessUtility_hook_type PreviousProcessUtilityHook = NULL;
|
||||||
static void CStoreTableAMObjectAccessHook(ObjectAccessType access, Oid classId, Oid
|
static void CStoreTableAMObjectAccessHook(ObjectAccessType access, Oid classId, Oid
|
||||||
objectId, int subId,
|
objectId, int subId,
|
||||||
void *arg);
|
void *arg);
|
||||||
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
|
||||||
|
const char *queryString,
|
||||||
|
ProcessUtilityContext context,
|
||||||
|
ParamListInfo paramListInfo,
|
||||||
|
QueryEnvironment *queryEnvironment,
|
||||||
|
DestReceiver *destReceiver,
|
||||||
|
QueryCompletion *qc);
|
||||||
|
#else
|
||||||
static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
|
static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
|
||||||
const char *queryString,
|
const char *queryString,
|
||||||
ProcessUtilityContext context,
|
ProcessUtilityContext context,
|
||||||
|
@ -77,6 +91,8 @@ static void CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
|
||||||
QueryEnvironment *queryEnvironment,
|
QueryEnvironment *queryEnvironment,
|
||||||
DestReceiver *destReceiver,
|
DestReceiver *destReceiver,
|
||||||
char *completionTag);
|
char *completionTag);
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool IsCStoreTableAmTable(Oid relationId);
|
static bool IsCStoreTableAmTable(Oid relationId);
|
||||||
static bool ConditionalLockRelationWithTimeout(Relation rel, LOCKMODE lockMode,
|
static bool ConditionalLockRelationWithTimeout(Relation rel, LOCKMODE lockMode,
|
||||||
int timeout, int retryInterval);
|
int timeout, int retryInterval);
|
||||||
|
@ -1035,6 +1051,16 @@ CStoreExecutorEnd(QueryDesc *queryDesc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
static void
|
||||||
|
CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
|
||||||
|
const char *queryString,
|
||||||
|
ProcessUtilityContext context,
|
||||||
|
ParamListInfo paramListInfo,
|
||||||
|
QueryEnvironment *queryEnvironment,
|
||||||
|
DestReceiver *destReceiver,
|
||||||
|
QueryCompletion *queryCompletion)
|
||||||
|
#else
|
||||||
static void
|
static void
|
||||||
CStoreTableAMProcessUtility(PlannedStmt * plannedStatement,
|
CStoreTableAMProcessUtility(PlannedStmt * plannedStatement,
|
||||||
const char * queryString,
|
const char * queryString,
|
||||||
|
@ -1043,6 +1069,7 @@ CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
|
||||||
QueryEnvironment * queryEnvironment,
|
QueryEnvironment * queryEnvironment,
|
||||||
DestReceiver * destReceiver,
|
DestReceiver * destReceiver,
|
||||||
char * completionTag)
|
char * completionTag)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
Node *parseTree = plannedStatement->utilityStmt;
|
Node *parseTree = plannedStatement->utilityStmt;
|
||||||
|
|
||||||
|
@ -1067,18 +1094,7 @@ CStoreTableAMProcessUtility(PlannedStmt *plannedStatement,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PreviousProcessUtilityHook != NULL)
|
CALL_PREVIOUS_UTILITY();
|
||||||
{
|
|
||||||
PreviousProcessUtilityHook(plannedStatement, queryString, context,
|
|
||||||
paramListInfo, queryEnvironment,
|
|
||||||
destReceiver, completionTag);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
standard_ProcessUtility(plannedStatement, queryString, context,
|
|
||||||
paramListInfo, queryEnvironment,
|
|
||||||
destReceiver, completionTag);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1087,7 +1103,8 @@ cstore_tableam_init()
|
||||||
{
|
{
|
||||||
PreviousExecutorEndHook = ExecutorEnd_hook;
|
PreviousExecutorEndHook = ExecutorEnd_hook;
|
||||||
ExecutorEnd_hook = CStoreExecutorEnd;
|
ExecutorEnd_hook = CStoreExecutorEnd;
|
||||||
PreviousProcessUtilityHook = ProcessUtility_hook;
|
PreviousProcessUtilityHook = (ProcessUtility_hook != NULL) ?
|
||||||
|
ProcessUtility_hook : standard_ProcessUtility;
|
||||||
ProcessUtility_hook = CStoreTableAMProcessUtility;
|
ProcessUtility_hook = CStoreTableAMProcessUtility;
|
||||||
prevObjectAccessHook = object_access_hook;
|
prevObjectAccessHook = object_access_hook;
|
||||||
object_access_hook = CStoreTableAMObjectAccessHook;
|
object_access_hook = CStoreTableAMObjectAccessHook;
|
||||||
|
|
|
@ -32,18 +32,18 @@
|
||||||
ExplainPropertyInteger(qlabel, NULL, value, es)
|
ExplainPropertyInteger(qlabel, NULL, value, es)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PREVIOUS_UTILITY (PreviousProcessUtilityHook != NULL \
|
#if PG_VERSION_NUM >= 130000
|
||||||
? PreviousProcessUtilityHook : standard_ProcessUtility)
|
#define CALL_PREVIOUS_UTILITY() \
|
||||||
#if PG_VERSION_NUM >= 100000
|
PreviousProcessUtilityHook(plannedStatement, queryString, context, paramListInfo, \
|
||||||
#define CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, \
|
queryEnvironment, destReceiver, queryCompletion)
|
||||||
destReceiver, completionTag) \
|
#elif PG_VERSION_NUM >= 100000
|
||||||
PREVIOUS_UTILITY(plannedStatement, queryString, context, paramListInfo, \
|
#define CALL_PREVIOUS_UTILITY() \
|
||||||
|
PreviousProcessUtilityHook(plannedStatement, queryString, context, paramListInfo, \
|
||||||
queryEnvironment, destReceiver, completionTag)
|
queryEnvironment, destReceiver, completionTag)
|
||||||
#else
|
#else
|
||||||
#define CALL_PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, \
|
#define CALL_PREVIOUS_UTILITY() \
|
||||||
destReceiver, completionTag) \
|
PreviousProcessUtilityHook(parseTree, queryString, context, paramListInfo, \
|
||||||
PREVIOUS_UTILITY(parseTree, queryString, context, paramListInfo, destReceiver, \
|
destReceiver, completionTag)
|
||||||
completionTag)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PG_VERSION_NUM < 120000
|
#if PG_VERSION_NUM < 120000
|
||||||
|
@ -56,4 +56,10 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= 130000
|
||||||
|
#define heap_open table_open
|
||||||
|
#define heap_openrv table_openrv
|
||||||
|
#define heap_close table_close
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* CSTORE_COMPAT_H */
|
#endif /* CSTORE_COMPAT_H */
|
||||||
|
|
Loading…
Reference in New Issue