mirror of https://github.com/citusdata/citus.git
Fixes indentation
parent
eb46d9399b
commit
6f838e6e88
|
@ -63,14 +63,16 @@ typedef struct DatabaseCollationInfo
|
|||
} DatabaseCollationInfo;
|
||||
|
||||
static void EnsureSupportedCreateDatabaseCommand(CreatedbStmt *stmt);
|
||||
static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm);
|
||||
static char * GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database
|
||||
databaseForm);
|
||||
static DatabaseCollationInfo GetDatabaseCollation(Oid dbOid);
|
||||
static AlterOwnerStmt * RecreateAlterDatabaseOwnerStmt(Oid databaseOid);
|
||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||
static char * GetLocaleProviderString(char datlocprovider);
|
||||
#endif
|
||||
static char * GetTablespaceName(Oid tablespaceOid);
|
||||
static ObjectAddress * GetDatabaseAddressFromDatabaseName(char *databaseName,bool missingOk);
|
||||
static ObjectAddress * GetDatabaseAddressFromDatabaseName(char *databaseName, bool
|
||||
missingOk);
|
||||
|
||||
static Oid get_database_owner(Oid db_oid);
|
||||
|
||||
|
@ -660,12 +662,14 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
|
|||
return str.data;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GrantOnDatabaseDDLCommands returns a list of sql statements to idempotently apply a
|
||||
* GRANT on distributed databases.
|
||||
*/
|
||||
|
||||
List * GenerateGrantDatabaseCommandList(void){
|
||||
List *
|
||||
GenerateGrantDatabaseCommandList(void)
|
||||
{
|
||||
List *grantCommands = NIL;
|
||||
|
||||
Relation pgDatabaseRel = table_open(DatabaseRelationId, AccessShareLock);
|
||||
|
@ -712,7 +716,8 @@ List * GenerateGrantDatabaseCommandList(void){
|
|||
* Commands in the list are wrapped by citus_internal_database_command() UDF
|
||||
* to avoid from transaction block restrictions that apply to database commands
|
||||
*/
|
||||
List * GenerateCreateDatabaseCommandList(void)
|
||||
List *
|
||||
GenerateCreateDatabaseCommandList(void)
|
||||
{
|
||||
List *commands = NIL;
|
||||
|
||||
|
|
|
@ -465,13 +465,13 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
|
|||
List *ownerDDLCommands = DatabaseOwnerDDLCommands(dependency);
|
||||
databaseDDLCommands = list_concat(databaseDDLCommands, ownerDDLCommands);
|
||||
}
|
||||
//TODO: To reviewer: Having a code block for dependency makes sense
|
||||
// However dependency tree is based on pg metadata; which does not reflect
|
||||
// actual database dependencies. I added this block just to point out the issue.
|
||||
// if(EnableCreateDatabasePropagation){
|
||||
// List *dbGrants = GrantOnDatabaseDDLCommands(dependency->objectId);
|
||||
// databaseDDLCommands = list_concat(databaseDDLCommands, dbGrants);
|
||||
// }
|
||||
/*TODO: To reviewer: Having a code block for dependency makes sense */
|
||||
/* However dependency tree is based on pg metadata; which does not reflect */
|
||||
/* actual database dependencies. I added this block just to point out the issue. */
|
||||
/* if(EnableCreateDatabasePropagation){ */
|
||||
/* List *dbGrants = GrantOnDatabaseDDLCommands(dependency->objectId); */
|
||||
/* databaseDDLCommands = list_concat(databaseDDLCommands, dbGrants); */
|
||||
/* } */
|
||||
|
||||
return databaseDDLCommands;
|
||||
}
|
||||
|
|
|
@ -513,7 +513,7 @@ GenerateRoleOptionsList(HeapTuple tuple)
|
|||
List *
|
||||
GenerateCreateOrAlterRoleCommand(Oid roleOid)
|
||||
{
|
||||
elog(LOG,"GenerateCreateOrAlterRoleCommand execution");
|
||||
elog(LOG, "GenerateCreateOrAlterRoleCommand execution");
|
||||
|
||||
HeapTuple roleTuple = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleOid));
|
||||
Form_pg_authid role = ((Form_pg_authid) GETSTRUCT(roleTuple));
|
||||
|
|
|
@ -2048,6 +2048,7 @@ GenerateGrantOnSchemaQueriesFromAclItem(Oid schemaOid, AclItem *aclItem)
|
|||
return queries;
|
||||
}
|
||||
|
||||
|
||||
List *
|
||||
GrantOnDatabaseDDLCommands(Oid databaseOid)
|
||||
{
|
||||
|
@ -2071,7 +2072,7 @@ GrantOnDatabaseDDLCommands(Oid databaseOid)
|
|||
{
|
||||
commands = list_concat(commands,
|
||||
GenerateGrantOnDatabaseFromAclItem(
|
||||
databaseOid,&aclDat[i]));
|
||||
databaseOid, &aclDat[i]));
|
||||
}
|
||||
|
||||
return commands;
|
||||
|
@ -2098,21 +2099,24 @@ GenerateGrantOnDatabaseFromAclItem(Oid databaseOid, AclItem *aclItem)
|
|||
if (permissions & ACL_CONNECT)
|
||||
{
|
||||
char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights(
|
||||
OBJECT_DATABASE ,granteeOid, databaseOid, "CONNECT",
|
||||
OBJECT_DATABASE, granteeOid, databaseOid,
|
||||
"CONNECT",
|
||||
grants & ACL_CONNECT));
|
||||
queries = lappend(queries, query);
|
||||
}
|
||||
if (permissions & ACL_CREATE)
|
||||
{
|
||||
char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights(
|
||||
OBJECT_DATABASE, granteeOid, databaseOid, "CREATE",
|
||||
OBJECT_DATABASE, granteeOid, databaseOid,
|
||||
"CREATE",
|
||||
grants & ACL_CREATE));
|
||||
queries = lappend(queries, query);
|
||||
}
|
||||
if (permissions & ACL_CREATE_TEMP)
|
||||
{
|
||||
char *query = DeparseTreeNode((Node *) GenerateGrantStmtForRights(
|
||||
OBJECT_DATABASE, granteeOid, databaseOid, "TEMPORARY",
|
||||
OBJECT_DATABASE, granteeOid, databaseOid,
|
||||
"TEMPORARY",
|
||||
grants & ACL_CREATE_TEMP));
|
||||
queries = lappend(queries, query);
|
||||
}
|
||||
|
@ -4762,6 +4766,7 @@ SendNodeWideObjectsSyncCommands(MetadataSyncContext *context)
|
|||
SendOrCollectCommandListToActivatedNodes(context, commandList);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SendDatabaseGrantSyncCommands sends database grants to roles to workers with
|
||||
* transactional or nontransactional mode according to transactionMode inside
|
||||
|
|
Loading…
Reference in New Issue