[glom/glom-1-28] PostgresSelf: Pass --locale=C to initdb.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-28] PostgresSelf: Pass --locale=C to initdb.
- Date: Thu, 25 Feb 2016 19:15:12 +0000 (UTC)
commit ed3ad8ec5f03ba7199aa0f7561995486d1e8aef7
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Feb 7 17:02:53 2016 +0100
PostgresSelf: Pass --locale=C to initdb.
So we always get the same result regardless of the current locale,
because the "data" shouldn't really be locale-specific.
This has disadvantages for collation but we also want the database
to be fairly portable across environments.
This might help this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=761372
.../connectionpool_backends/postgres_self.cc | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc
b/glom/libglom/connectionpool_backends/postgres_self.cc
index 33be3dc..e767404 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -220,8 +220,15 @@ Backend::InitErrors PostgresSelfHosted::initialize(const SlotProgress& slot_prog
// Make sure to use double quotes for the executable path, because the
// CreateProcess() API used on Windows does not support single quotes.
- const std::string command_initdb = get_path_to_postgres_executable("initdb") + " -D " +
Glib::shell_quote(dbdir_data) +
- " -U " + initial_username + " --pwfile=" +
Glib::shell_quote(temp_pwfile);
+ // We set the default locale, with --locale, to avoid the database's initial locale
+ // from being based on the current environment, because we want the database to be
+ // as portable as possible.
+ // See http://www.postgresql.org/docs/current/static/app-initdb.html
+ const std::string command_initdb = get_path_to_postgres_executable("initdb") +
+ " -D " + Glib::shell_quote(dbdir_data) +
+ " -U " + initial_username +
+ " --pwfile=" + Glib::shell_quote(temp_pwfile) +
+ " --locale=C";
//Note that --pwfile takes the password from the first line of a file. It's an alternative to supplying it
when prompted on stdin.
const bool result = Glom::Spawn::execute_command_line_and_wait(command_initdb, slot_progress);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]