Fixes indentation

pull/7240/head
gindibay 2023-11-10 06:11:43 +03:00
parent 2ebeea3ce3
commit 1b9a8ea2db
2 changed files with 22 additions and 17 deletions

View File

@ -579,7 +579,8 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
if (databaseForm->datdba != InvalidOid) if (databaseForm->datdba != InvalidOid)
{ {
appendStringInfo(&str, " OWNER = %s", appendStringInfo(&str, " OWNER = %s",
quote_literal_cstr(GetUserNameFromId(databaseForm->datdba,false))); quote_literal_cstr(GetUserNameFromId(databaseForm->datdba,
false)));
} }
if (databaseForm->encoding != -1) if (databaseForm->encoding != -1)
@ -590,7 +591,8 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
if (collInfo.collation != NULL) if (collInfo.collation != NULL)
{ {
appendStringInfo(&str, " LC_COLLATE = %s", quote_literal_cstr(collInfo.collation)); appendStringInfo(&str, " LC_COLLATE = %s", quote_literal_cstr(
collInfo.collation));
} }
if (collInfo.ctype != NULL) if (collInfo.ctype != NULL)
{ {
@ -600,29 +602,33 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
#if PG_VERSION_NUM >= PG_VERSION_15 #if PG_VERSION_NUM >= PG_VERSION_15
if (collInfo.icu_locale != NULL) if (collInfo.icu_locale != NULL)
{ {
appendStringInfo(&str, " ICU_LOCALE = %s", quote_literal_cstr(collInfo.icu_locale)); appendStringInfo(&str, " ICU_LOCALE = %s", quote_literal_cstr(
collInfo.icu_locale));
} }
if (databaseForm->datlocprovider != 0) if (databaseForm->datlocprovider != 0)
{ {
appendStringInfo(&str, " LOCALE_PROVIDER = %s", appendStringInfo(&str, " LOCALE_PROVIDER = %s",
quote_literal_cstr(GetLocaleProviderString(databaseForm->datlocprovider))); quote_literal_cstr(GetLocaleProviderString(
databaseForm->datlocprovider)));
} }
if (collInfo.collversion != NULL) if (collInfo.collversion != NULL)
{ {
appendStringInfo(&str, " COLLATION_VERSION = %s", quote_literal_cstr(collInfo.collversion)); appendStringInfo(&str, " COLLATION_VERSION = %s", quote_literal_cstr(
collInfo.collversion));
} }
#endif #endif
if (databaseForm->dattablespace != InvalidOid) if (databaseForm->dattablespace != InvalidOid)
{ {
appendStringInfo(&str, " TABLESPACE = %s", appendStringInfo(&str, " TABLESPACE = %s",
quote_identifier(GetTablespaceName(databaseForm->dattablespace))); quote_identifier(GetTablespaceName(
databaseForm->dattablespace)));
} }
appendStringInfo(&str, " ALLOW_CONNECTIONS = %s", appendStringInfo(&str, " ALLOW_CONNECTIONS = %s",
quote_literal_cstr(databaseForm->datallowconn ?"true" : "false")); quote_literal_cstr(databaseForm->datallowconn ? "true" : "false"));
if (databaseForm->datconnlimit >= 0) if (databaseForm->datconnlimit >= 0)
{ {
@ -630,7 +636,7 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
} }
appendStringInfo(&str, " IS_TEMPLATE = %s", appendStringInfo(&str, " IS_TEMPLATE = %s",
quote_literal_cstr(databaseForm->datistemplate ? "true" :"false")); quote_literal_cstr(databaseForm->datistemplate ? "true" : "false"));
FreeDatabaseCollationInfo(collInfo); FreeDatabaseCollationInfo(collInfo);

View File

@ -259,20 +259,19 @@ DeparseAlterDatabaseSetStmt(Node *node)
static void static void
ValidateCreateDatabaseOptions(DefElem *option) ValidateCreateDatabaseOptions(DefElem *option)
{ {
if (strcmp(option->defname, "strategy") == 0){ if (strcmp(option->defname, "strategy") == 0)
{
ereport(ERROR, ereport(ERROR,
errmsg("CREATE DATABASE option \"%s\" is not supported", errmsg("CREATE DATABASE option \"%s\" is not supported",
option->defname)); option->defname));
} }
char *optionValue = defGetString(option); char *optionValue = defGetString(option);
if (strcmp(option->defname,"template") == 0 && strcmp(optionValue, "template1") != 0) if (strcmp(option->defname, "template") == 0 && strcmp(optionValue, "template1") != 0)
{ {
ereport(ERROR, errmsg(
ereport(ERROR,errmsg("Only template1 is supported as template parameter for CREATE DATABASE")); "Only template1 is supported as template parameter for CREATE DATABASE"));
} }
} }