Fixes review issues

pull/7253/head
gindibay 2023-11-13 12:07:40 +03:00
parent e31ca6e31e
commit a35cae0ed7
3 changed files with 26 additions and 24 deletions

View File

@ -231,7 +231,6 @@ PreprocessAlterDatabaseStmt(Node *node, const char *queryString,
{
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
}
}
@ -636,7 +635,8 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
if (databaseForm->datdba != InvalidOid)
{
appendStringInfo(&str, " OWNER = %s",
quote_literal_cstr(GetUserNameFromId(databaseForm->datdba,false)));
quote_literal_cstr(GetUserNameFromId(databaseForm->datdba,
false)));
}
if (databaseForm->encoding != -1)
@ -647,7 +647,8 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
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)
{
@ -657,25 +658,29 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
#if PG_VERSION_NUM >= PG_VERSION_15
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)
{
appendStringInfo(&str, " LOCALE_PROVIDER = %s",
quote_literal_cstr(GetLocaleProviderString(databaseForm->datlocprovider)));
quote_literal_cstr(GetLocaleProviderString(
databaseForm->datlocprovider)));
}
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
if (databaseForm->dattablespace != InvalidOid)
{
appendStringInfo(&str, " TABLESPACE = %s",
quote_identifier(GetTablespaceName(databaseForm->dattablespace)));
quote_identifier(GetTablespaceName(
databaseForm->dattablespace)));
}
appendStringInfo(&str, " ALLOW_CONNECTIONS = %s",

View File

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

View File

@ -196,8 +196,6 @@ extern void SendInterTableRelationshipCommands(MetadataSyncContext *context);
"SELECT pg_catalog.worker_drop_sequence_dependency(%s);"
#define DISABLE_DDL_PROPAGATION "SET citus.enable_ddl_propagation TO 'off'"
#define BEGIN_TRANSACTION "BEGIN"
#define COMMIT_TRANSACTION "COMMIT"
#define ENABLE_DDL_PROPAGATION "SET citus.enable_ddl_propagation TO 'on'"
#define DISABLE_METADATA_SYNC "SET citus.enable_metadata_sync TO 'off'"
#define ENABLE_METADATA_SYNC "SET citus.enable_metadata_sync TO 'on'"