mirror of
https://github.com/postgres/postgres.git
synced 2025-08-15 14:02:29 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user