Fixes indentation problems

pull/7178/head
gindibay 2023-09-04 10:50:40 +03:00
parent e45c3c7ed8
commit 458f820755
3 changed files with 24 additions and 16 deletions

View File

@ -469,7 +469,7 @@ static DistributeObjectOps Database_Rename = {
static DistributeObjectOps Database_RefreshColl = { static DistributeObjectOps Database_RefreshColl = {
.deparse = DeparseAlterDatabaseRefreshCollStmt, .deparse = DeparseAlterDatabaseRefreshCollStmt,
.qualify = NULL, .qualify = NULL,
.preprocess = NULL,//TODO: Add PostprocessAfter adding addresses .preprocess = NULL,/*TODO: Add PostprocessAfter adding addresses */
.postprocess = NULL, .postprocess = NULL,
.objectType = OBJECT_DATABASE, .objectType = OBJECT_DATABASE,
.operationType = DIST_OPS_ALTER, .operationType = DIST_OPS_ALTER,

View File

@ -7,10 +7,8 @@
#include "utils/guc.h" #include "utils/guc.h"
static void static void AppendVarSetValue2(StringInfo buf, VariableSetStmt *setStmt);
AppendVarSetValue2(StringInfo buf, VariableSetStmt *setStmt); static void AppendVariableSet2(StringInfo buf, VariableSetStmt *setStmt);
static void
AppendVariableSet2(StringInfo buf, VariableSetStmt *setStmt);
static void static void
@ -115,6 +113,7 @@ AppendVarSetValue2(StringInfo buf, VariableSetStmt *setStmt)
} }
} }
/* /*
* AppendVariableSet appends a string representing the VariableSetStmt to a buffer * AppendVariableSet appends a string representing the VariableSetStmt to a buffer
*/ */

View File

@ -32,7 +32,7 @@ char *
DeparseAlterDatabaseOwnerStmt(Node *node) DeparseAlterDatabaseOwnerStmt(Node *node)
{ {
AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node); AlterOwnerStmt *stmt = castNode(AlterOwnerStmt, node);
StringInfoData str = {0}; StringInfoData str = { 0 };
initStringInfo(&str); initStringInfo(&str);
Assert(stmt->objectType == OBJECT_DATABASE); Assert(stmt->objectType == OBJECT_DATABASE);
@ -42,6 +42,7 @@ DeparseAlterDatabaseOwnerStmt(Node *node)
return str.data; return str.data;
} }
static void static void
AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt) AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt)
{ {
@ -49,17 +50,18 @@ AppendAlterDatabaseOwnerStmt(StringInfo buf, AlterOwnerStmt *stmt)
appendStringInfo(buf, appendStringInfo(buf,
"ALTER DATABASE %s OWNER TO %s;", "ALTER DATABASE %s OWNER TO %s;",
quote_identifier(strVal((String *)stmt->object)), quote_identifier(strVal((String *) stmt->object)),
RoleSpecString(stmt->newowner, true)); RoleSpecString(stmt->newowner, true));
} }
static void static void
AppendGrantDatabases(StringInfo buf, GrantStmt *stmt) AppendGrantDatabases(StringInfo buf, GrantStmt *stmt)
{ {
ListCell *cell = NULL; ListCell *cell = NULL;
appendStringInfo(buf, " ON DATABASE "); appendStringInfo(buf, " ON DATABASE ");
foreach (cell, stmt->objects) foreach(cell, stmt->objects)
{ {
char *database = strVal(lfirst(cell)); char *database = strVal(lfirst(cell));
appendStringInfoString(buf, quote_identifier(database)); appendStringInfoString(buf, quote_identifier(database));
@ -70,6 +72,7 @@ AppendGrantDatabases(StringInfo buf, GrantStmt *stmt)
} }
} }
static void static void
AppendGrantOnDatabaseStmt(StringInfo buf, GrantStmt *stmt) AppendGrantOnDatabaseStmt(StringInfo buf, GrantStmt *stmt)
{ {
@ -223,9 +226,10 @@ AppendAlterDatabaseSetStmt(StringInfo buf, AlterDatabaseSetStmt *stmt)
static void static void
AppendDefElemConnLimit(StringInfo buf, DefElem *def) AppendDefElemConnLimit(StringInfo buf, DefElem *def)
{ {
appendStringInfo(buf, " CONNECTION LIMIT %ld",(long int) defGetNumeric(def)); appendStringInfo(buf, " CONNECTION LIMIT %ld", (long int) defGetNumeric(def));
} }
static void static void
AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt) AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt)
{ {
@ -253,7 +257,8 @@ AppendAlterDatabaseStmt(StringInfo buf, AlterDatabaseStmt *stmt)
ereport(ERROR, ereport(ERROR,
errmsg("ALLOW_CONNECTIONS is not supported")); errmsg("ALLOW_CONNECTIONS is not supported"));
} }
else{ else
{
ereport(ERROR, ereport(ERROR,
errmsg("unrecognized AlterDatabaseStmt option: %s", errmsg("unrecognized AlterDatabaseStmt option: %s",
def->defname)); def->defname));
@ -308,7 +313,7 @@ DeparseGrantOnDatabaseStmt(Node *node)
GrantStmt *stmt = castNode(GrantStmt, node); GrantStmt *stmt = castNode(GrantStmt, node);
Assert(stmt->objtype == OBJECT_DATABASE); Assert(stmt->objtype == OBJECT_DATABASE);
StringInfoData str = {0}; StringInfoData str = { 0 };
initStringInfo(&str); initStringInfo(&str);
AppendGrantOnDatabaseStmt(&str, stmt); AppendGrantOnDatabaseStmt(&str, stmt);
@ -316,12 +321,13 @@ DeparseGrantOnDatabaseStmt(Node *node)
return str.data; return str.data;
} }
char * char *
DeparseAlterDatabaseStmt(Node *node) DeparseAlterDatabaseStmt(Node *node)
{ {
AlterDatabaseStmt *stmt = castNode(AlterDatabaseStmt, node); AlterDatabaseStmt *stmt = castNode(AlterDatabaseStmt, node);
StringInfoData str = {0}; StringInfoData str = { 0 };
initStringInfo(&str); initStringInfo(&str);
AppendAlterDatabaseStmt(&str, stmt); AppendAlterDatabaseStmt(&str, stmt);
@ -333,25 +339,28 @@ DeparseAlterDatabaseStmt(Node *node)
char * char *
DeparseAlterDatabaseRenameStmt(Node *node) DeparseAlterDatabaseRenameStmt(Node *node)
{ {
RenameStmt *stmt = (RenameStmt *)node; RenameStmt *stmt = (RenameStmt *) node;
StringInfoData str; StringInfoData str;
initStringInfo(&str); initStringInfo(&str);
appendStringInfo(&str, "ALTER DATABASE %s RENAME TO %s;", quote_identifier(stmt->subname), quote_identifier(stmt->newname)); appendStringInfo(&str, "ALTER DATABASE %s RENAME TO %s;", quote_identifier(
stmt->subname), quote_identifier(stmt->newname));
return str.data; return str.data;
} }
char * char *
DeparseAlterDatabaseRefreshCollStmt(Node *node) DeparseAlterDatabaseRefreshCollStmt(Node *node)
{ {
AlterDatabaseRefreshCollStmt *stmt = (AlterDatabaseRefreshCollStmt *)node; AlterDatabaseRefreshCollStmt *stmt = (AlterDatabaseRefreshCollStmt *) node;
StringInfoData str; StringInfoData str;
initStringInfo(&str); initStringInfo(&str);
appendStringInfo(&str, "ALTER DATABASE %s REFRESH COLLATION;", quote_identifier(stmt->dbname)); appendStringInfo(&str, "ALTER DATABASE %s REFRESH COLLATION;", quote_identifier(
stmt->dbname));
return str.data; return str.data;
} }