mirror of https://github.com/citusdata/citus.git
Fixes review issues
parent
e31ca6e31e
commit
a35cae0ed7
|
@ -215,8 +215,8 @@ PreprocessAlterDatabaseStmt(Node *node, const char *queryString,
|
|||
char *sql = DeparseTreeNode((Node *) stmt);
|
||||
|
||||
List *commands = list_make3(DISABLE_DDL_PROPAGATION,
|
||||
sql,
|
||||
ENABLE_DDL_PROPAGATION);
|
||||
sql,
|
||||
ENABLE_DDL_PROPAGATION);
|
||||
|
||||
if (isSetTablespaceStatement(stmt))
|
||||
{
|
||||
|
@ -231,7 +231,6 @@ PreprocessAlterDatabaseStmt(Node *node, const char *queryString,
|
|||
{
|
||||
return NodeDDLTaskList(NON_COORDINATOR_NODES, commands);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -273,7 +272,7 @@ PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *queryString,
|
|||
* PreprocessAlterDatabaseRenameStmt is executed before the statement is applied to the local
|
||||
* postgres instance. In this stage we prepare ALTER DATABASE RENAME statement to be run on
|
||||
* all workers.
|
||||
*/
|
||||
*/
|
||||
List *
|
||||
PreprocessAlterDatabaseRenameStmt(Node *node, const char *queryString,
|
||||
ProcessUtilityContext processUtilityContext)
|
||||
|
@ -631,55 +630,61 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
|
|||
initStringInfo(&str);
|
||||
|
||||
appendStringInfo(&str, "CREATE DATABASE %s",
|
||||
quote_identifier(NameStr(databaseForm->datname)));
|
||||
quote_identifier(NameStr(databaseForm->datname)));
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
appendStringInfo(&str, " LC_COLLATE = %s", quote_literal_cstr(collInfo.collation));
|
||||
appendStringInfo(&str, " LC_COLLATE = %s", quote_literal_cstr(
|
||||
collInfo.collation));
|
||||
}
|
||||
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 (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",
|
||||
quote_literal_cstr(databaseForm->datallowconn ?"true" : "false"));
|
||||
quote_literal_cstr(databaseForm->datallowconn ? "true" : "false"));
|
||||
|
||||
if (databaseForm->datconnlimit >= 0)
|
||||
{
|
||||
|
@ -687,7 +692,7 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
|
|||
}
|
||||
|
||||
appendStringInfo(&str, " IS_TEMPLATE = %s",
|
||||
quote_literal_cstr(databaseForm->datistemplate ? "true" :"false"));
|
||||
quote_literal_cstr(databaseForm->datistemplate ? "true" : "false"));
|
||||
|
||||
FreeDatabaseCollationInfo(collInfo);
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ AppendBasicAlterDatabaseOptions(StringInfo buf, DefElem *def, bool
|
|||
prefix_appended_for_basic_options = true;
|
||||
}
|
||||
DefElemOptionToStatement(buf, def, alter_database_option_formats, lengthof(
|
||||
alter_database_option_formats));
|
||||
alter_database_option_formats));
|
||||
return prefix_appended_for_basic_options;
|
||||
}
|
||||
|
||||
|
@ -290,20 +290,19 @@ 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));
|
||||
}
|
||||
|
||||
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("Only template1 is supported as template parameter for CREATE DATABASE"));
|
||||
|
||||
ereport(ERROR, errmsg(
|
||||
"Only template1 is supported as template parameter for CREATE DATABASE"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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'"
|
||||
|
|
Loading…
Reference in New Issue