install citus_columnar for citus version >= 11.1

pull/5911/head
Yanwen Jin 2022-05-25 13:55:32 -07:00
parent 345b465b18
commit e06abe3534
1 changed files with 18 additions and 2 deletions

View File

@ -203,6 +203,21 @@ multi_ProcessUtility(PlannedStmt *pstmt,
CreateExtensionStmt *createExtensionStmt = castNode(CreateExtensionStmt, CreateExtensionStmt *createExtensionStmt = castNode(CreateExtensionStmt,
parsetree); parsetree);
if (strcmp(createExtensionStmt->extname, "citus") == 0) if (strcmp(createExtensionStmt->extname, "citus") == 0)
{
double versionNumber = strtod(CITUS_MAJORVERSION, NULL);
DefElem *newVersionValue = GetExtensionOption(createExtensionStmt->options,
"new_version");
if (newVersionValue)
{
const char *newVersion = defGetString(newVersionValue);
const char schemaVersionSeparator = '-';
char *leftSeperatorPosition = strchr(newVersion, schemaVersionSeparator);
versionNumber = strtod(leftSeperatorPosition, NULL);
}
if (versionNumber >= 11.1)
{ {
if (get_extension_oid("citus_columnar", true) == InvalidOid) if (get_extension_oid("citus_columnar", true) == InvalidOid)
{ {
@ -210,6 +225,7 @@ multi_ProcessUtility(PlannedStmt *pstmt,
} }
} }
} }
}
if (!CitusHasBeenLoaded()) if (!CitusHasBeenLoaded())
{ {