summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorTatsuo Ishii2013-12-18 14:42:44 +0000
committerTatsuo Ishii2013-12-18 14:42:44 +0000
commit65d6e4cb5c62371dae6c236a7e709d503ae6ddf8 (patch)
tree07fff22fb42940bcf618885589909de0adaa9f9c /src/bin
parentdba5a9dda9adbda16a72c46e1c012ee6552c248a (diff)
Add ALTER SYSTEM command to edit the server configuration file.
Patch contributed by Amit Kapila. Reviewed by Hari Babu, Masao Fujii, Boszormenyi Zoltan, Andres Freund, Greg Smith and others.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/initdb/initdb.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 30e3701f92a..e6bb132beaf 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1228,6 +1228,7 @@ setup_config(void)
char repltok[MAXPGPATH];
char path[MAXPGPATH];
const char *default_timezone;
+ char *autoconflines[3];
fputs(_("creating configuration files ... "), stdout);
fflush(stdout);
@@ -1320,6 +1321,21 @@ setup_config(void)
writefile(path, conflines);
chmod(path, S_IRUSR | S_IWUSR);
+ /*
+ * create the automatic configuration file to store the configuration
+ * parameters set by ALTER SYSTEM command. The parameters present in this
+ * file will override the value of parameters that exists before parse of
+ * this file.
+ */
+ autoconflines[0] = pg_strdup("# Do not edit this file manually! \n");
+ autoconflines[1] = pg_strdup("# It will be overwritten by the ALTER SYSTEM command. \n");
+ autoconflines[2] = NULL;
+
+ sprintf(path, "%s/%s", pg_data, PG_AUTOCONF_FILENAME);
+
+ writefile(path, autoconflines);
+ chmod(path, S_IRUSR | S_IWUSR);
+
free(conflines);