diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:19 +0000 |
commit | 31176cd686f31dcb71392f6583f7b8d9cef63770 (patch) | |
tree | 27fefbaada5177e179c6cf8806be49dfe613d5f4 /src/bin/initdb/initdb.c | |
parent | Adding upstream version 16.2. (diff) | |
download | postgresql-16-upstream.tar.xz postgresql-16-upstream.zip |
Adding upstream version 16.3.upstream/16.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bin/initdb/initdb.c')
-rw-r--r-- | src/bin/initdb/initdb.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 3afe14c..458dc11 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -482,6 +482,7 @@ replace_guc_value(char **lines, const char *guc_name, const char *guc_value, for (i = 0; lines[i]; i++) { const char *where; + const char *namestart; /* * Look for a line assigning to guc_name. Typically it will be @@ -492,15 +493,19 @@ replace_guc_value(char **lines, const char *guc_name, const char *guc_value, where = lines[i]; while (*where == '#' || isspace((unsigned char) *where)) where++; - if (strncmp(where, guc_name, namelen) != 0) + if (pg_strncasecmp(where, guc_name, namelen) != 0) continue; + namestart = where; where += namelen; while (isspace((unsigned char) *where)) where++; if (*where != '=') continue; - /* found it -- append the original comment if any */ + /* found it -- let's use the canonical casing shown in the file */ + memcpy(&newline->data[mark_as_comment ? 1 : 0], namestart, namelen); + + /* now append the original comment if any */ where = strrchr(where, '#'); if (where) { |