mirror of https://github.com/citusdata/citus.git
Fixes review comments
parent
75589d1c11
commit
afa60556fd
|
@ -574,66 +574,64 @@ GenerateCreateDatabaseStatementFromPgDatabase(Form_pg_database databaseForm)
|
||||||
StringInfoData str;
|
StringInfoData str;
|
||||||
initStringInfo(&str);
|
initStringInfo(&str);
|
||||||
|
|
||||||
appendStringInfo(&str, "CREATE DATABASE %s", quote_identifier(NameStr(
|
appendStringInfo(&str, "CREATE DATABASE %s",
|
||||||
databaseForm->
|
quote_identifier(NameStr(databaseForm->datname)));
|
||||||
datname)));
|
|
||||||
|
|
||||||
if (databaseForm->datdba != InvalidOid)
|
if (databaseForm->datdba != InvalidOid)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " OWNER = %s", GetUserNameFromId(databaseForm->datdba,
|
appendStringInfo(&str, " OWNER = %s",
|
||||||
false));
|
quote_literal_cstr(GetUserNameFromId(databaseForm->datdba,false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (databaseForm->encoding != -1)
|
if (databaseForm->encoding != -1)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " ENCODING = '%s'", pg_encoding_to_char(
|
appendStringInfo(&str, " ENCODING = %s",
|
||||||
databaseForm->encoding));
|
quote_literal_cstr(pg_encoding_to_char(databaseForm->encoding)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collInfo.collation != NULL)
|
if (collInfo.collation != NULL)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " LC_COLLATE = '%s'", 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'", 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'", 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'", GetLocaleProviderString(
|
appendStringInfo(&str, " LOCALE_PROVIDER = %s",
|
||||||
databaseForm->datlocprovider));
|
quote_literal_cstr(GetLocaleProviderString(databaseForm->datlocprovider)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collInfo.collversion != NULL)
|
if (collInfo.collversion != NULL)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " COLLATION_VERSION = '%s'", 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", quote_identifier(GetTablespaceName(
|
appendStringInfo(&str, " TABLESPACE = %s",
|
||||||
databaseForm->
|
quote_identifier(GetTablespaceName(databaseForm->dattablespace)));
|
||||||
dattablespace)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&str, " ALLOW_CONNECTIONS = '%s'", databaseForm->datallowconn ?
|
appendStringInfo(&str, " ALLOW_CONNECTIONS = %s",
|
||||||
"true" : "false");
|
quote_literal_cstr(databaseForm->datallowconn ?"true" : "false"));
|
||||||
|
|
||||||
if (databaseForm->datconnlimit >= 0)
|
if (databaseForm->datconnlimit >= 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(&str, " CONNECTION LIMIT %d", databaseForm->datconnlimit);
|
appendStringInfo(&str, " CONNECTION LIMIT %d", databaseForm->datconnlimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&str, " IS_TEMPLATE = '%s'", databaseForm->datistemplate ? "true" :
|
appendStringInfo(&str, " IS_TEMPLATE = %s",
|
||||||
"false");
|
quote_literal_cstr(databaseForm->datistemplate ? "true" :"false"));
|
||||||
|
|
||||||
FreeDatabaseCollationInfo(collInfo);
|
FreeDatabaseCollationInfo(collInfo);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ CREATE OR REPLACE FUNCTION pg_catalog.citus_internal_database_command(command te
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C
|
LANGUAGE C
|
||||||
VOLATILE
|
VOLATILE
|
||||||
STRICT
|
|
||||||
AS 'MODULE_PATHNAME', $$citus_internal_database_command$$;
|
AS 'MODULE_PATHNAME', $$citus_internal_database_command$$;
|
||||||
COMMENT ON FUNCTION pg_catalog.citus_internal_database_command(text) IS
|
COMMENT ON FUNCTION pg_catalog.citus_internal_database_command(text) IS
|
||||||
'run a database command without transaction block restrictions';
|
'run a database command without transaction block restrictions';
|
||||||
|
|
Loading…
Reference in New Issue