mirror of https://github.com/citusdata/citus.git
wip
parent
6c9872d182
commit
c8237b6c73
|
@ -149,6 +149,13 @@ CreateCimv(CimvCreate *cimvCreate)
|
||||||
elog(ERROR, "SPI_connect failed");
|
elog(ERROR, "SPI_connect failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Oid savedUserId = InvalidOid;
|
||||||
|
int savedSecurityContext = 0;
|
||||||
|
|
||||||
|
/* make sure we have write access */
|
||||||
|
GetUserIdAndSecContext(&savedUserId, &savedSecurityContext);
|
||||||
|
SetUserIdAndSecContext(CitusExtensionOwner(), SECURITY_LOCAL_USERID_CHANGE);
|
||||||
|
|
||||||
CreateMatTable(cimvCreate, false);
|
CreateMatTable(cimvCreate, false);
|
||||||
|
|
||||||
if (cimvCreate->createOptions->schedule != NULL)
|
if (cimvCreate->createOptions->schedule != NULL)
|
||||||
|
@ -172,6 +179,8 @@ CreateCimv(CimvCreate *cimvCreate)
|
||||||
{
|
{
|
||||||
RefreshCimv(cimvCreate->formCimv, cimvCreate->stmt->into->skipData, true);
|
RefreshCimv(cimvCreate->formCimv, cimvCreate->stmt->into->skipData, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetUserIdAndSecContext(savedUserId, savedSecurityContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,13 @@ RefreshCimv(Form_pg_cimv formCimv, bool skipData, bool isCreate)
|
||||||
elog(ERROR, "SPI_connect failed");
|
elog(ERROR, "SPI_connect failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Oid savedUserId = InvalidOid;
|
||||||
|
int savedSecurityContext = 0;
|
||||||
|
|
||||||
|
/* make sure we have write access */
|
||||||
|
GetUserIdAndSecContext(&savedUserId, &savedSecurityContext);
|
||||||
|
SetUserIdAndSecContext(CitusExtensionOwner(), SECURITY_LOCAL_USERID_CHANGE);
|
||||||
|
|
||||||
const char *matTableSchemaName = get_namespace_name(get_rel_namespace(
|
const char *matTableSchemaName = get_namespace_name(get_rel_namespace(
|
||||||
formCimv->mattable));
|
formCimv->mattable));
|
||||||
const char *matTableName = get_rel_name(formCimv->mattable);
|
const char *matTableName = get_rel_name(formCimv->mattable);
|
||||||
|
@ -149,6 +156,8 @@ RefreshCimv(Form_pg_cimv formCimv, bool skipData, bool isCreate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetUserIdAndSecContext(savedUserId, savedSecurityContext);
|
||||||
|
|
||||||
/* Close SPI context. */
|
/* Close SPI context. */
|
||||||
if (SPI_finish() != SPI_OK_FINISH)
|
if (SPI_finish() != SPI_OK_FINISH)
|
||||||
{
|
{
|
||||||
|
|
|
@ -460,10 +460,17 @@ multi_ProcessUtility(PlannedStmt *pstmt,
|
||||||
bool continueProcessing = true;
|
bool continueProcessing = true;
|
||||||
if (IsA(parsetree, CreateTableAsStmt))
|
if (IsA(parsetree, CreateTableAsStmt))
|
||||||
{
|
{
|
||||||
|
Oid savedUserId = InvalidOid;
|
||||||
|
int savedSecurityContext = 0;
|
||||||
|
|
||||||
|
/* make sure we have write access */
|
||||||
|
GetUserIdAndSecContext(&savedUserId, &savedSecurityContext);
|
||||||
|
SetUserIdAndSecContext(CitusExtensionOwner(), SECURITY_LOCAL_USERID_CHANGE);
|
||||||
continueProcessing = !ProcessCreateMaterializedViewStmt((const
|
continueProcessing = !ProcessCreateMaterializedViewStmt((const
|
||||||
CreateTableAsStmt *)
|
CreateTableAsStmt *)
|
||||||
parsetree, queryString,
|
parsetree, queryString,
|
||||||
pstmt);
|
pstmt);
|
||||||
|
SetUserIdAndSecContext(savedUserId, savedSecurityContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsA(parsetree, RefreshMatViewStmt))
|
if (IsA(parsetree, RefreshMatViewStmt))
|
||||||
|
|
Loading…
Reference in New Issue