mirror of https://github.com/citusdata/citus.git
Fixes indentation
parent
2ebeea3ce3
commit
1b9a8ea2db
|
@ -574,55 +574,61 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
|
||||||
initStringInfo(&str);
|
initStringInfo(&str);
|
||||||
|
|
||||||
appendStringInfo(&str, "CREATE DATABASE %s",
|
appendStringInfo(&str, "CREATE DATABASE %s",
|
||||||
quote_identifier(NameStr(databaseForm->datname)));
|
quote_identifier(NameStr(databaseForm->datname)));
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " ENCODING = %s",
|
appendStringInfo(&str, " ENCODING = %s",
|
||||||
quote_literal_cstr(pg_encoding_to_char(databaseForm->encoding)));
|
quote_literal_cstr(pg_encoding_to_char(databaseForm->encoding)));
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " LC_CTYPE = %s", quote_literal_cstr(collInfo.ctype));
|
appendStringInfo(&str, " LC_CTYPE = %s", quote_literal_cstr(collInfo.ctype));
|
||||||
}
|
}
|
||||||
|
|
||||||
#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);
|
||||||
|
|
||||||
|
|
|
@ -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"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue