GUC names in messages

Started by Peter Smithabout 2 years ago70 messages
#1Peter Smith
smithpb2250@gmail.com

Hi hackers,

While reviewing another patch I noticed how the GUCs are
inconsistently named within the GUC_check_errdetail messages:

======

below, the GUC name is embedded but not quoted:

src/backend/access/transam/xlogprefetcher.c:
GUC_check_errdetail("recovery_prefetch is not supported on platforms
that lack posix_fadvise().");
src/backend/access/transam/xlogrecovery.c:
GUC_check_errdetail("recovery_target_timeline is not a valid
number.");
src/backend/commands/variable.c:
GUC_check_errdetail("effective_io_concurrency must be set to 0 on
platforms that lack posix_fadvise().");
src/backend/commands/variable.c:
GUC_check_errdetail("maintenance_io_concurrency must be set to 0 on
platforms that lack posix_fadvise().");
src/backend/port/sysv_shmem.c:
GUC_check_errdetail("huge_page_size must be 0 on this platform.");
src/backend/port/win32_shmem.c:
GUC_check_errdetail("huge_page_size must be 0 on this platform.");
src/backend/replication/syncrep.c:
GUC_check_errdetail("synchronous_standby_names parser failed");
src/backend/storage/file/fd.c:
GUC_check_errdetail("debug_io_direct is not supported on this
platform.");
src/backend/storage/file/fd.c:
GUC_check_errdetail("debug_io_direct is not supported for WAL because
XLOG_BLCKSZ is too small");
src/backend/storage/file/fd.c:
GUC_check_errdetail("debug_io_direct is not supported for data because
BLCKSZ is too small");
src/backend/tcop/postgres.c:
GUC_check_errdetail("client_connection_check_interval must be set to 0
on this platform.");

~~~

below, the GUC name is embedded and double-quoted:

src/backend/commands/vacuum.c:
GUC_check_errdetail("\"vacuum_buffer_usage_limit\" must be 0 or
between %d kB and %d kB",
src/backend/commands/variable.c:
GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
src/backend/storage/buffer/localbuf.c:
GUC_check_errdetail("\"temp_buffers\" cannot be changed after any
temporary tables have been accessed in the session.");
src/backend/tcop/postgres.c:
GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
src/backend/tcop/postgres.c: GUC_check_errdetail("Cannot enable
parameter when \"log_statement_stats\" is true.");
src/backend/tcop/postgres.c: GUC_check_errdetail("Cannot enable
\"log_statement_stats\" when "

~~~

below, the GUC name is substituted but not quoted:

src/backend/access/table/tableamapi.c: GUC_check_errdetail("%s
cannot be empty.",
src/backend/access/table/tableamapi.c: GUC_check_errdetail("%s is
too long (maximum %d characters).",

~~~

I had intended to make a patch to address the inconsistency, but
couldn't decide which of those styles was the preferred one.

Then I worried this could be the tip of the iceberg -- GUC names occur
in many other error messages where they are sometimes quoted and
sometimes not quoted:
e.g. Not quoted -- errhint("You might need to run fewer transactions
at a time or increase max_connections.")));
e.g. Quoted -- errmsg("\"max_wal_size\" must be at least twice
\"wal_segment_size\"")));

Ideally, they should all look the same everywhere, shouldn't they?

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#2Peter Smith
smithpb2250@gmail.com
In reply to: Peter Smith (#1)
Re: GUC names in messages

On Wed, Nov 1, 2023 at 8:02 PM Peter Smith <smithpb2250@gmail.com> wrote:
...

I had intended to make a patch to address the inconsistency, but
couldn't decide which of those styles was the preferred one.

Then I worried this could be the tip of the iceberg -- GUC names occur
in many other error messages where they are sometimes quoted and
sometimes not quoted:
e.g. Not quoted -- errhint("You might need to run fewer transactions
at a time or increase max_connections.")));
e.g. Quoted -- errmsg("\"max_wal_size\" must be at least twice
\"wal_segment_size\"")));

Ideally, they should all look the same everywhere, shouldn't they?

One idea to achieve consistency might be to always substitute GUC
names using a macro.

#define GUC_NAME(s) ("\"" s "\"")

ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s must be at least twice %s",
GUC_NAME("max_wal_size"),
GUC_NAME("wal_segment_size"))));

Thoughts?

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#3Daniel Gustafsson
daniel@yesql.se
In reply to: Peter Smith (#1)
Re: GUC names in messages

On 1 Nov 2023, at 10:02, Peter Smith <smithpb2250@gmail.com> wrote:

GUC_check_errdetail("effective_io_concurrency must be set to 0 on
platforms that lack posix_fadvise().");
src/backend/commands/variable.c:
GUC_check_errdetail("maintenance_io_concurrency must be set to 0 on
platforms that lack posix_fadvise().");

These should be substituted to reduce the number of distinct messages that need
to be translated. I wouldn't be surprised if more like these have slipped
through.

I had intended to make a patch to address the inconsistency, but
couldn't decide which of those styles was the preferred one.

Given the variety in the codebase I don't think there is a preferred one.

Then I worried this could be the tip of the iceberg

All good rabbit-holes uncovered during hacking are.. =)

Ideally, they should all look the same everywhere, shouldn't they?

Having a policy would be good, having one which is known and enforced is even
better (like how we are consistent around error messages based on our Error
Message Style Guide).

--
Daniel Gustafsson

#4Daniel Gustafsson
daniel@yesql.se
In reply to: Peter Smith (#2)
Re: GUC names in messages

On 1 Nov 2023, at 10:22, Peter Smith <smithpb2250@gmail.com> wrote:

On Wed, Nov 1, 2023 at 8:02 PM Peter Smith <smithpb2250@gmail.com> wrote:
...

I had intended to make a patch to address the inconsistency, but
couldn't decide which of those styles was the preferred one.

Then I worried this could be the tip of the iceberg -- GUC names occur
in many other error messages where they are sometimes quoted and
sometimes not quoted:
e.g. Not quoted -- errhint("You might need to run fewer transactions
at a time or increase max_connections.")));
e.g. Quoted -- errmsg("\"max_wal_size\" must be at least twice
\"wal_segment_size\"")));

Ideally, they should all look the same everywhere, shouldn't they?

One idea to achieve consistency might be to always substitute GUC
names using a macro.

#define GUC_NAME(s) ("\"" s "\"")

ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s must be at least twice %s",
GUC_NAME("max_wal_size"),
GUC_NAME("wal_segment_size"))));

Something like this might make translations harder since the remaining string
leaves little context about the message. We already have that today to some
extent (so it might not be an issue), and it might be doable to automatically
add translator comments, but it's something to consider.

--
Daniel Gustafsson

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daniel Gustafsson (#4)
Re: GUC names in messages

Daniel Gustafsson <daniel@yesql.se> writes:

On 1 Nov 2023, at 10:22, Peter Smith <smithpb2250@gmail.com> wrote:

One idea to achieve consistency might be to always substitute GUC
names using a macro.

#define GUC_NAME(s) ("\"" s "\"")

ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s must be at least twice %s",
GUC_NAME("max_wal_size"),
GUC_NAME("wal_segment_size"))));

Something like this might make translations harder since the remaining string
leaves little context about the message. We already have that today to some
extent (so it might not be an issue), and it might be doable to automatically
add translator comments, but it's something to consider.

Our error message style guidelines say not to assemble messages out
of separate parts, because it makes translation difficult. Originally
we applied that rule to GUC names mentioned in messages as well.
Awhile ago the translation team decided that that made for too many
duplicative translations, so they'd be willing to compromise on
substituting GUC names. That's only been changed in a haphazard
fashion though, mostly in cases where there actually were duplicative
messages that could be merged this way. And there's never been any
real clarity about whether to quote GUC names, though certainly we're
more likely to quote anything injected with %s. So that's why we have
a mishmash right now.

I'm not enamored of the GUC_NAME idea suggested above. I don't
think it buys anything, and what it does do is make *every single
one* of our GUC-mentioning messages wrong. I think if we want to
standardize here, we should standardize on something that's
already pretty common in the code base.

Another problem with the idea as depicted above is that it
mistakenly assumes that "..." is the correct quoting method
in all languages. You could make GUC_NAME be a pure no-op
macro and continue to put quoting in the translatable string
where it belongs, but then the macro brings even less value.

regards, tom lane

#6Peter Eisentraut
peter@eisentraut.org
In reply to: Tom Lane (#5)
Re: GUC names in messages

On 01.11.23 10:25, Tom Lane wrote:

And there's never been any
real clarity about whether to quote GUC names, though certainly we're
more likely to quote anything injected with %s. So that's why we have
a mishmash right now.

I'm leaning toward not quoting GUC names. The quoting is needed in
places where the value can be arbitrary, to avoid potential confusion.
But the GUC names are well-known, and we wouldn't add confusing GUC
names like "table" or "not found" in the future.

#7Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Peter Eisentraut (#6)
Re: GUC names in messages

On Wed, 2023-11-01 at 16:12 -0400, Peter Eisentraut wrote:

On 01.11.23 10:25, Tom Lane wrote:

And there's never been any
real clarity about whether to quote GUC names, though certainly we're
more likely to quote anything injected with %s. So that's why we have
a mishmash right now.

I'm leaning toward not quoting GUC names. The quoting is needed in
places where the value can be arbitrary, to avoid potential confusion.
But the GUC names are well-known, and we wouldn't add confusing GUC
names like "table" or "not found" in the future.

I agree for names with underscores in them. But I think that quoting
is necessary for names like "timezone" or "datestyle" that might be
mistaken for normal words. My personal preference is to always quote
GUC names, but I think it is OK not to quote GOCs whose name are
clearly not natural language words.

Yours,
Laurenz Albe

#8Peter Smith
smithpb2250@gmail.com
In reply to: Tom Lane (#5)
Re: GUC names in messages

On Thu, Nov 2, 2023 at 1:25 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Daniel Gustafsson <daniel@yesql.se> writes:

On 1 Nov 2023, at 10:22, Peter Smith <smithpb2250@gmail.com> wrote:

One idea to achieve consistency might be to always substitute GUC
names using a macro.

#define GUC_NAME(s) ("\"" s "\"")

ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("%s must be at least twice %s",
GUC_NAME("max_wal_size"),
GUC_NAME("wal_segment_size"))));

Something like this might make translations harder since the remaining string
leaves little context about the message. We already have that today to some
extent (so it might not be an issue), and it might be doable to automatically
add translator comments, but it's something to consider.

Our error message style guidelines say not to assemble messages out
of separate parts, because it makes translation difficult. Originally
we applied that rule to GUC names mentioned in messages as well.
Awhile ago the translation team decided that that made for too many
duplicative translations, so they'd be willing to compromise on
substituting GUC names. That's only been changed in a haphazard
fashion though, mostly in cases where there actually were duplicative
messages that could be merged this way. And there's never been any
real clarity about whether to quote GUC names, though certainly we're
more likely to quote anything injected with %s. So that's why we have
a mishmash right now.

I'm not enamored of the GUC_NAME idea suggested above. I don't
think it buys anything, and what it does do is make *every single
one* of our GUC-mentioning messages wrong. I think if we want to
standardize here, we should standardize on something that's
already pretty common in the code base.

Thanks to everybody for the feedback received so far.

Perhaps as a first step, I can try to quantify the GUC name styles
already in the source code. The numbers might help decide how to
proceed

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#9Nathan Bossart
nathandbossart@gmail.com
In reply to: Laurenz Albe (#7)
Re: GUC names in messages

On Wed, Nov 01, 2023 at 09:46:52PM +0100, Laurenz Albe wrote:

I agree for names with underscores in them. But I think that quoting
is necessary for names like "timezone" or "datestyle" that might be
mistaken for normal words. My personal preference is to always quote
GUC names, but I think it is OK not to quote GOCs whose name are
clearly not natural language words.

+1, IMHO quoting GUC names makes it abundantly clear that they are special
identifiers. In de4d456, we quoted the role names in a bunch of messages.
We didn't quote the attribute/option names, but those are in all-caps, so
they already stand out nicely.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

#10Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Nathan Bossart (#9)
1 attachment(s)
Re: GUC names in messages

On 2023-Nov-01, Nathan Bossart wrote:

On Wed, Nov 01, 2023 at 09:46:52PM +0100, Laurenz Albe wrote:

I agree for names with underscores in them. But I think that quoting
is necessary for names like "timezone" or "datestyle" that might be
mistaken for normal words. My personal preference is to always quote
GUC names, but I think it is OK not to quote GOCs whose name are
clearly not natural language words.

+1, IMHO quoting GUC names makes it abundantly clear that they are special
identifiers. In de4d456, we quoted the role names in a bunch of messages.
We didn't quote the attribute/option names, but those are in all-caps, so
they already stand out nicely.

I like this, and I propose we codify it in the message style guide. How
about this? We can start looking at code changes to make once we decide
we agree with this.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"La verdad no siempre es bonita, pero el hambre de ella sí"

Attachments:

0001-Message-style-Add-paragraph-about-quoting-names.patchtext/x-diff; charset=utf-8Download
From 909355851bfb21086422e6edc0b2b75fbaa58418 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Tue, 7 Nov 2023 10:24:00 +0100
Subject: [PATCH] Message style: Add paragraph about quoting names

---
 doc/src/sgml/sources.sgml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index 06d995e4b7..d72e114ea3 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -532,23 +532,31 @@ Hint:       The addendum, written as a complete sentence.
   <simplesect id="error-style-guide-quotes">
    <title>Use of Quotes</title>
 
    <para>
     Always use quotes to delimit file names, user-supplied identifiers, and
     other variables that might contain words.  Do not use them to mark up
     variables that will not contain words (for example, operator names).
    </para>
 
    <para>
     There are functions in the backend that will double-quote their own output
     as needed (for example, <function>format_type_be()</function>).  Do not put
     additional quotes around the output of such functions.
    </para>
 
+   <para>
+    In messages containing configuration variable names, quotes are
+    not necessary when the names are visibly not English natural words, such
+    as when they have underscores or are all-uppercase.  Otherwise, quotes
+    must be added.  Do include double-quotes in a message where an arbitrary
+    variable name is to be expanded.
+   </para>
+
    <para>
     Rationale: Objects can have names that create ambiguity when embedded in a
     message.  Be consistent about denoting where a plugged-in name starts and
     ends.  But don't clutter messages with unnecessary or duplicate quote
     marks.
    </para>
 
   </simplesect>
-- 
2.39.2

#11Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#10)
Re: GUC names in messages

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:

On 2023-Nov-01, Nathan Bossart wrote:

+1, IMHO quoting GUC names makes it abundantly clear that they are special
identifiers. In de4d456, we quoted the role names in a bunch of messages.
We didn't quote the attribute/option names, but those are in all-caps, so
they already stand out nicely.

I like this, and I propose we codify it in the message style guide. How
about this? We can start looking at code changes to make once we decide
we agree with this.

WFM.

regards, tom lane

#12Nathan Bossart
nathandbossart@gmail.com
In reply to: Alvaro Herrera (#10)
Re: GUC names in messages

On Tue, Nov 07, 2023 at 10:33:03AM +0100, Alvaro Herrera wrote:

On 2023-Nov-01, Nathan Bossart wrote:

+1, IMHO quoting GUC names makes it abundantly clear that they are special
identifiers. In de4d456, we quoted the role names in a bunch of messages.
We didn't quote the attribute/option names, but those are in all-caps, so
they already stand out nicely.

I like this, and I propose we codify it in the message style guide. How
about this? We can start looking at code changes to make once we decide
we agree with this.

+   <para>
+    In messages containing configuration variable names, quotes are
+    not necessary when the names are visibly not English natural words, such
+    as when they have underscores or are all-uppercase.  Otherwise, quotes
+    must be added.  Do include double-quotes in a message where an arbitrary
+    variable name is to be expanded.
+   </para>

І'd vote for quoting all GUC names, if for no other reason than "visibly
not English natural words" feels a bit open to interpretation. But this
seems like it's on the right track, so I won't argue too strongly if I'm
the only holdout.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

#13Peter Smith
smithpb2250@gmail.com
In reply to: Nathan Bossart (#12)
Re: GUC names in messages

FWIW, I am halfway through doing regex checking of the PG16 source for
all GUC names in messages to see what current styles are in use today.

Not sure if those numbers will influence the decision.

I hope I can post my findings today or tomorrow.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#14Peter Smith
smithpb2250@gmail.com
In reply to: Peter Smith (#13)
1 attachment(s)
Re: GUC names in messages

On Wed, Nov 8, 2023 at 7:40 AM Peter Smith <smithpb2250@gmail.com> wrote:

FWIW, I am halfway through doing regex checking of the PG16 source for
all GUC names in messages to see what current styles are in use today.

Not sure if those numbers will influence the decision.

I hope I can post my findings today or tomorrow.

Here are my findings from the current PG16 source messages.

I used a regex search:
".*GUCNAME

to find how each GUCNAME is used in the messages in *.c files.

The GUC names are taken from the guc_tables.c code, so they are
grouped accordingly below.

~TOTALS:

messages where GUC names are QUOTED:
- bool = 11
- int = 11
- real = 0
- string = 10
- enum = 7
TOTAL = 39

messages where GUC names are NOT QUOTED:
- bool = 14
- int = 60
- real = 0
- string = 59
- enum = 31
TOTAL = 164

~~~

Details are in the attached file. PSA.

I've categorised them as being currently QUOTED, NOT QUOTED, and NONE
(most are not used in any messages).

Notice that NOT QUOTED is the far more common pattern, so my vote
would be just to standardise on making everything this way. I know
there was some concern raised about ambiguous words like "timezone"
and "datestyle" etc but in practice, those are rare. Also, those GUCs
are different in that they are written as camel-case (e.g.
"DateStyle") in the guc_tables.c, so if they were also written
camel-case in the messages that could remove ambiguities with normal
words. YMMV.

Anyway, I will await a verdict about what to do.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

20231107-guc-names-in-messages-data.txttext/plain; charset=US-ASCII; name=20231107-guc-names-in-messages-data.txtDownload
#15Peter Smith
smithpb2250@gmail.com
In reply to: Tom Lane (#5)
1 attachment(s)
Re: GUC names in messages

On Thu, Nov 2, 2023 at 1:25 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

...

Our error message style guidelines say not to assemble messages out
of separate parts, because it makes translation difficult. Originally
we applied that rule to GUC names mentioned in messages as well.
Awhile ago the translation team decided that that made for too many
duplicative translations, so they'd be willing to compromise on
substituting GUC names. That's only been changed in a haphazard
fashion though, mostly in cases where there actually were duplicative
messages that could be merged this way. And there's never been any
real clarity about whether to quote GUC names, though certainly we're
more likely to quote anything injected with %s. So that's why we have
a mishmash right now.

Right. While looking at all the messages I observed a number of them
having almost the same (but not quite the same) wording:

For example,

errhint("Consider increasing the configuration parameter \"max_wal_size\".")));
errhint("You might need to increase %s.", "max_locks_per_transaction")));
errhint("You might need to increase %s.", "max_pred_locks_per_transaction")));
errmsg("could not find free replication state, increase
max_replication_slots")));
hint ? errhint("You might need to increase %s.", "max_slot_wal_keep_size") : 0);
errhint("You may need to increase max_worker_processes.")));
errhint("Consider increasing configuration parameter
\"max_worker_processes\".")));
errhint("Consider increasing the configuration parameter
\"max_worker_processes\".")));
errhint("You might need to increase %s.", "max_worker_processes")));
errhint("You may need to increase max_worker_processes.")));
errhint("You might need to increase %s.", "max_logical_replication_workers")));

~

The most common pattern there is "You might need to increase %s.".

Here is a patch to modify those other similar variations so they share
that common wording.

PSA.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v1-0001-Use-a-common-message-for-increasing-a-GUC.patchapplication/octet-stream; name=v1-0001-Use-a-common-message-for-increasing-a-GUC.patchDownload
From 5750183cb3236fede2e2d061544baa54783f1fd8 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 9 Nov 2023 12:34:15 +1100
Subject: [PATCH v1] Use a common message for increasing a GUC

---
 contrib/pg_prewarm/autoprewarm.c         | 4 ++--
 src/backend/postmaster/bgworker.c        | 2 +-
 src/backend/postmaster/checkpointer.c    | 2 +-
 src/backend/replication/logical/origin.c | 4 +++-
 src/test/modules/test_shm_mq/setup.c     | 2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index d0efc9e..daf0bce 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -841,7 +841,7 @@ apw_start_leader_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("could not register background process"),
-				 errhint("You may need to increase max_worker_processes.")));
+				 errhint("You might need to increase %s.", "max_worker_processes")));
 
 	status = WaitForBackgroundWorkerStartup(handle, &pid);
 	if (status != BGWH_STARTED)
@@ -877,7 +877,7 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter \"max_worker_processes\".")));
+				 errhint("You might need to increase %s.", "max_worker_processes")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index 48a9924..7a8c8af 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -944,7 +944,7 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 								  "Up to %d background workers can be registered with the current settings.",
 								  max_worker_processes,
 								  max_worker_processes),
-				 errhint("Consider increasing the configuration parameter \"max_worker_processes\".")));
+				 errhint("You might need to increase %s.", "max_worker_processes")));
 		return;
 	}
 
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index a3c1aba..3dab5f8 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -423,7 +423,7 @@ CheckpointerMain(void)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"max_wal_size\".")));
+						 errhint("You might need to increase %s.", "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index b0255ff..fca8924 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -795,7 +795,9 @@ StartupReplicationOrigin(void)
 		if (last_state == max_replication_slots)
 			ereport(PANIC,
 					(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-					 errmsg("could not find free replication state, increase max_replication_slots")));
+					 errmsg("could not find free replication state"),
+					 errhint("You might need to increase %s.",
+							 "max_replication_slots")));
 
 		/* copy data to shared memory */
 		replication_states[last_state].roident = disk_state.roident;
diff --git a/src/test/modules/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c
index abc7935..d00648e 100644
--- a/src/test/modules/test_shm_mq/setup.c
+++ b/src/test/modules/test_shm_mq/setup.c
@@ -233,7 +233,7 @@ setup_background_workers(int nworkers, dsm_segment *seg)
 			ereport(ERROR,
 					(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 					 errmsg("could not register background process"),
-					 errhint("You may need to increase max_worker_processes.")));
+					 errhint("You might need to increase %s.", "max_worker_processes")));
 		++wstate->nworkers;
 	}
 
-- 
1.8.3.1

#16Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Peter Smith (#15)
Re: GUC names in messages

At Thu, 9 Nov 2023 12:55:44 +1100, Peter Smith <smithpb2250@gmail.com> wrote in

The most common pattern there is "You might need to increase %s.".

..

Here is a patch to modify those other similar variations so they share
that common wording.

PSA.

I'm uncertain whether the phrases "Consider doing something" and "You
might need to do something" are precisely interchangeable. However,
(for me..) it appears that either phrase could be applied for all
messages that the patch touches.

In short, I'm fine with the patch.

By the way, I was left scratching my head after seeing the following
message.

ereport(PANIC,
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
- errmsg("could not find free replication state, increase max_replication_slots")));

Being told to increase max_replication_slots in a PANIC
message feels somewhat off to me. Just looking at the message, it
seems unconvincing to increase "slots" because there is a lack of
"state". So, I poked around in the code and found the following
comment:

ReplicationOriginShmemSize(void)
{
...
/*
* XXX: max_replication_slots is arguably the wrong thing to use, as here
* we keep the replay state of *remote* transactions. But for now it seems
* sufficient to reuse it, rather than introduce a separate GUC.
*/

I haven't read the related code, but if my understanding based on this
comment is correct, wouldn't it mean that a lack of storage space for
the state at the location outputting the message indicates a bug in
the program, not a user configuration error? In other words, isn't
this message something that at least shouldn't be a user-facing
message, and might it be more appropriate to use an Assert instead?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#17Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Peter Smith (#14)
Re: GUC names in messages

On 2023-Nov-09, Peter Smith wrote:

Notice that NOT QUOTED is the far more common pattern, so my vote
would be just to standardise on making everything this way. I know
there was some concern raised about ambiguous words like "timezone"
and "datestyle" etc but in practice, those are rare. Also, those GUCs
are different in that they are written as camel-case (e.g.
"DateStyle") in the guc_tables.c, so if they were also written
camel-case in the messages that could remove ambiguities with normal
words. YMMV.

Well, I think camel-casing is also a sufficient differentiator for these
identifiers not being English words. We'd need to ensure they're always
written that way, when not quoted. However, in cases where arbitrary
values are expanded, I don't know that they would be expanded that way,
so I would still go for quoting in that case.

There's also a few that are not camel-cased nor have any underscores --
looking at postgresql.conf.sample, we have "port", "bonjour", "ssl",
"fsync", "geqo", "jit", "autovacuum", "xmlbinary", "xmloption". (We also
have "include", but I doubt that's ever used in an error message). But
actually, there's more: every reloption is a candidate, and there we
have "fillfactor", "autosummarize", "fastupdate", "buffering". So if we
want to make generic advice on how to deal with option names in error
messages, I think the wording on conditional quoting I proposed should
go in (adding CamelCase as a reason not to quote), and then we can fix
the code to match. Looking at your list, I think the changes to make
are not too numerous.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Nadie está tan esclavizado como el que se cree libre no siéndolo" (Goethe)

#18Peter Smith
smithpb2250@gmail.com
In reply to: Alvaro Herrera (#17)
2 attachment(s)
Re: GUC names in messages

On Thu, Nov 9, 2023 at 10:04 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

On 2023-Nov-09, Peter Smith wrote:

Notice that NOT QUOTED is the far more common pattern, so my vote
would be just to standardise on making everything this way. I know
there was some concern raised about ambiguous words like "timezone"
and "datestyle" etc but in practice, those are rare. Also, those GUCs
are different in that they are written as camel-case (e.g.
"DateStyle") in the guc_tables.c, so if they were also written
camel-case in the messages that could remove ambiguities with normal
words. YMMV.

Well, I think camel-casing is also a sufficient differentiator for these
identifiers not being English words. We'd need to ensure they're always
written that way, when not quoted. However, in cases where arbitrary
values are expanded, I don't know that they would be expanded that way,
so I would still go for quoting in that case.

There's also a few that are not camel-cased nor have any underscores --
looking at postgresql.conf.sample, we have "port", "bonjour", "ssl",
"fsync", "geqo", "jit", "autovacuum", "xmlbinary", "xmloption". (We also
have "include", but I doubt that's ever used in an error message). But
actually, there's more: every reloption is a candidate, and there we
have "fillfactor", "autosummarize", "fastupdate", "buffering". So if we
want to make generic advice on how to deal with option names in error
messages, I think the wording on conditional quoting I proposed should
go in (adding CamelCase as a reason not to quote), and then we can fix
the code to match. Looking at your list, I think the changes to make
are not too numerous.

Sorry for my delay in getting back to this thread.

PSA a patch for this work.

There may be some changes I've missed, but hopefully, this is a nudge
in the right direction.

======
Kind Regards,
Peter Smith.
Fujitsu Australia.

Attachments:

v1-0001-GUC-names-docs.patchapplication/octet-stream; name=v1-0001-GUC-names-docs.patchDownload
From d935519fa69d873a1b11340076910b31caad2a05 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 23 Nov 2023 14:05:58 +1100
Subject: [PATCH v1] GUC names - docs

---
 doc/src/sgml/sources.sgml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index 06d995e..45ad706 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -539,6 +539,14 @@ Hint:       The addendum, written as a complete sentence.
    </para>
 
    <para>
+    In messages containing configuration variable names, do not include quotes
+    when the names are visibly not English natural words, such as when they
+    have underscores or are all-uppercase or have mixed case. Otherwise, quotes
+    must be added.  Do include quotes in a message where an arbitrary variable
+    name is to be expanded.
+   </para>
+
+   <para>
     There are functions in the backend that will double-quote their own output
     as needed (for example, <function>format_type_be()</function>).  Do not put
     additional quotes around the output of such functions.
-- 
1.8.3.1

v1-0002-GUC-names-fix-quotes.patchapplication/octet-stream; name=v1-0002-GUC-names-fix-quotes.patchDownload
From fab191bb5564552a61e5f98dd05fc79ca724a1af Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 23 Nov 2023 18:21:47 +1100
Subject: [PATCH v1] GUC names - fix quotes

---
 src/backend/access/heap/vacuumlazy.c           |  2 +-
 src/backend/access/transam/commit_ts.c         |  4 +-
 src/backend/access/transam/xlog.c              |  4 +-
 src/backend/commands/vacuum.c                  |  2 +-
 src/backend/commands/variable.c                |  4 +-
 src/backend/libpq/be-secure-openssl.c          |  6 +--
 src/backend/postmaster/checkpointer.c          |  2 +-
 src/backend/postmaster/pgarch.c                |  2 +-
 src/backend/storage/buffer/localbuf.c          |  2 +-
 src/backend/storage/file/fd.c                  |  2 +-
 src/backend/storage/lmgr/predicate.c           |  2 +-
 src/backend/tcop/postgres.c                    | 10 ++---
 src/backend/utils/adt/datetime.c               |  2 +-
 src/backend/utils/adt/pg_locale.c              |  4 +-
 src/backend/utils/fmgr/dfmgr.c                 |  4 +-
 src/backend/utils/misc/guc.c                   |  2 +-
 src/backend/utils/misc/guc_tables.c            |  4 +-
 src/test/regress/expected/collate.icu.utf8.out |  4 +-
 src/test/regress/expected/date.out             | 58 +++++++++++++-------------
 src/test/regress/expected/horology.out         |  2 +-
 src/test/regress/expected/json.out             |  4 +-
 src/test/regress/expected/jsonb.out            |  4 +-
 22 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 59f51f4..3b9299b 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -2658,7 +2658,7 @@ lazy_check_wraparound_failsafe(LVRelState *vacrel)
 						vacrel->dbname, vacrel->relnamespace, vacrel->relname,
 						vacrel->num_index_scans),
 				 errdetail("The table's relfrozenxid or relminmxid is too far in the past."),
-				 errhint("Consider increasing configuration parameter \"maintenance_work_mem\" or \"autovacuum_work_mem\".\n"
+				 errhint("Consider increasing configuration parameter maintenance_work_mem or autovacuum_work_mem.\n"
 						 "You might also need to consider other ways for VACUUM to keep up with the allocation of transaction IDs.")));
 
 		/* Stop applying cost limits from this point on */
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index b897fab..9385790 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -376,9 +376,9 @@ error_commit_ts_disabled(void)
 			(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 			 errmsg("could not get commit timestamp data"),
 			 RecoveryInProgress() ?
-			 errhint("Make sure the configuration parameter \"%s\" is set on the primary server.",
+			 errhint("Make sure the configuration parameter %s is set on the primary server.",
 					 "track_commit_timestamp") :
-			 errhint("Make sure the configuration parameter \"%s\" is set.",
+			 errhint("Make sure the configuration parameter %s is set.",
 					 "track_commit_timestamp")));
 }
 
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 1159dff..32adc63 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4244,11 +4244,11 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("min_wal_size must be at least twice wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("max_wal_size must be at least twice wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 8bdbee6..be43b46 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -134,7 +134,7 @@ check_vacuum_buffer_usage_limit(int *newval, void **extra,
 		return true;
 
 	/* Value does not fall within any allowable range */
-	GUC_check_errdetail("\"vacuum_buffer_usage_limit\" must be 0 or between %d kB and %d kB",
+	GUC_check_errdetail("vacuum_buffer_usage_limit must be 0 or between %d kB and %d kB",
 						MIN_BAS_VAC_RING_SIZE_KB, MAX_BAS_VAC_RING_SIZE_KB);
 
 	return false;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index a88cf5f..2703d2e 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting DateStyle specifications.");
 		return false;
 	}
 
@@ -717,7 +717,7 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change client_encoding now.");
 		}
 		return false;
 	}
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index 31b6a6e..e715fee 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -195,7 +195,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 			/*- translator: first %s is a GUC option name, second %s is its value */
-					(errmsg("\"%s\" setting \"%s\" not supported by this build",
+					(errmsg("%s setting \"%s\" not supported by this build",
 							"ssl_min_protocol_version",
 							GetConfigOption("ssl_min_protocol_version",
 											false, false))));
@@ -218,7 +218,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 			/*- translator: first %s is a GUC option name, second %s is its value */
-					(errmsg("\"%s\" setting \"%s\" not supported by this build",
+					(errmsg("%s setting \"%s\" not supported by this build",
 							"ssl_max_protocol_version",
 							GetConfigOption("ssl_max_protocol_version",
 											false, false))));
@@ -245,7 +245,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 					(errmsg("could not set SSL protocol version range"),
-					 errdetail("\"%s\" cannot be higher than \"%s\"",
+					 errdetail("%s cannot be higher than %s",
 							   "ssl_min_protocol_version",
 							   "ssl_max_protocol_version")));
 			goto error;
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 42c807d..dc2da5a 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -423,7 +423,7 @@ CheckpointerMain(void)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"max_wal_size\".")));
+						 errhint("Consider increasing the configuration parameter max_wal_size.")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 46af349..a2555e8 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -807,7 +807,7 @@ HandlePgArchInterrupts(void)
 			 */
 			ereport(LOG,
 					(errmsg("restarting archiver process because value of "
-							"\"archive_library\" was changed")));
+							"archive_library was changed")));
 
 			proc_exit(0);
 		}
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 4efb34b..aebcf14 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -705,7 +705,7 @@ check_temp_buffers(int *newval, void **extra, GucSource source)
 	 */
 	if (source != PGC_S_TEST && NLocBuffer && NLocBuffer != *newval)
 	{
-		GUC_check_errdetail("\"temp_buffers\" cannot be changed after any temporary tables have been accessed in the session.");
+		GUC_check_errdetail("temp_buffers cannot be changed after any temporary tables have been accessed in the session.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index f691ba0..a185fb3 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3931,7 +3931,7 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 
 	if (!SplitGUCList(rawstring, ',', &elemlist))
 	{
-		GUC_check_errdetail("invalid list syntax in parameter \"%s\"",
+		GUC_check_errdetail("invalid list syntax in parameter %s",
 							"debug_io_direct");
 		pfree(rawstring);
 		list_free(elemlist);
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index a794546..f1f6d0c 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1643,7 +1643,7 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
+				 errdetail("default_transaction_isolation is set to \"serializable\"."),
 				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
 
 	/*
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index e415cf1..7298a18 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3524,7 +3524,7 @@ check_stack_depth(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
 				 errmsg("stack depth limit exceeded"),
-				 errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "
+				 errhint("Increase the configuration parameter max_stack_depth (currently %dkB), "
 						 "after ensuring the platform's stack depth limit is adequate.",
 						 max_stack_depth)));
 	}
@@ -3571,7 +3571,7 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("max_stack_depth must not exceed %ldkB.",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3632,9 +3632,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable log_statement_stats when "
+							"log_parser_stats, log_planner_stats, "
+							"or log_executor_stats is true.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index fca9a2a..8ef5bf0 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4022,7 +4022,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different DateStyle setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index d5003da..1dee462 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -2875,7 +2875,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("could not get language from ICU locale \"%s\": %s",
 						loc_str, u_errorName(status)),
-				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
 						 "icu_validation_level", "disabled")));
 		return;
 	}
@@ -2904,7 +2904,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("ICU locale \"%s\" has unknown language \"%s\"",
 						loc_str, lang),
-				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
 						 "icu_validation_level", "disabled")));
 
 	/* check that it can be opened */
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index b85d52c..56724ff 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -555,7 +555,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (piece == p)
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("zero-length component in parameter \"dynamic_library_path\"")));
+					 errmsg("zero-length component in parameter dynamic_library_path")));
 
 		if (piece == NULL)
 			len = strlen(p);
@@ -574,7 +574,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (!is_absolute_path(mangled))
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("component in parameter \"dynamic_library_path\" is not an absolute path")));
+					 errmsg("component in parameter dynamic_library_path is not an absolute path")));
 
 		full = palloc(strlen(mangled) + 1 + baselen + 1);
 		sprintf(full, "%s/%s", mangled, basename);
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 82d8efb..e76c083 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1873,7 +1873,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
 	else
 	{
 		write_stderr("%s does not know where to find the database system data.\n"
-					 "This can be specified as \"data_directory\" in \"%s\", "
+					 "This can be specified as data_directory in \"%s\", "
 					 "or by the -D invocation option, or by the "
 					 "PGDATA environment variable.\n",
 					 progname, ConfigFileName);
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index b764ef6..67fedb2 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3811,7 +3811,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_command", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the shell command that will be called to archive a WAL file."),
-			gettext_noop("This is used only if \"archive_library\" is not set.")
+			gettext_noop("This is used only if archive_library is not set.")
 		},
 		&XLogArchiveCommand,
 		"",
@@ -3821,7 +3821,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_library", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the library that will be called to archive a WAL file."),
-			gettext_noop("An empty string indicates that \"archive_command\" should be used.")
+			gettext_noop("An empty string indicates that archive_command should be used.")
 		},
 		&XLogArchiveLibrary,
 		"",
diff --git a/src/test/regress/expected/collate.icu.utf8.out b/src/test/regress/expected/collate.icu.utf8.out
index 97bbe53..7a05c75 100644
--- a/src/test/regress/expected/collate.icu.utf8.out
+++ b/src/test/regress/expected/collate.icu.utf8.out
@@ -1042,7 +1042,7 @@ ERROR:  parameter "locale" must be specified
 SET icu_validation_level = ERROR;
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); -- fails
 ERROR:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
+HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
 CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=yes'); -- fails
 ERROR:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 RESET icu_validation_level;
@@ -1050,7 +1050,7 @@ CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=
 WARNING:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); DROP COLLATION testx;
 WARNING:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
+HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
 CREATE COLLATION test4 FROM nonsense;
 ERROR:  collation "nonsense" for encoding "UTF8" does not exist
 CREATE COLLATION test5 FROM test0;
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..99650bf 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index cfb4b20..4aeefd5 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out
index aa29bc5..7cb28f1 100644
--- a/src/test/regress/expected/json.out
+++ b/src/test/regress/expected/json.out
@@ -219,10 +219,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::json;			-- OK
diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out
index f8a7dac..b597d01 100644
--- a/src/test/regress/expected/jsonb.out
+++ b/src/test/regress/expected/jsonb.out
@@ -213,10 +213,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::jsonb;			-- OK
-- 
1.8.3.1

#19Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#18)
Re: GUC names in messages

On Thu, Nov 23, 2023 at 06:27:04PM +1100, Peter Smith wrote:

There may be some changes I've missed, but hopefully, this is a nudge
in the right direction.

Thanks for spending some time on that.

    <para>
+    In messages containing configuration variable names, do not include quotes
+    when the names are visibly not English natural words, such as when they
+    have underscores or are all-uppercase or have mixed case. Otherwise, quotes
+    must be added.  Do include quotes in a message where an arbitrary variable
+    name is to be expanded.
+   </para>

That seems to describe clearly the consensus reached on the thread
(quotes for GUCs that are single terms, no quotes for names that are
obviously parameters).

In terms of messages that have predictible names, 0002 moves in the
needle in the right direction. There seem to be more:
src/backend/postmaster/bgworker.c: errhint("Consider increasing the
configuration parameter \"max_worker_processes\".")));
contrib/pg_prewarm/autoprewarm.c: errhint("Consider increasing
configuration parameter \"max_worker_processes\".")));

Things like parse_and_validate_value() and set_config_option_ext()
include log strings about GUC and these use quotes. Could these areas
be made smarter with a routine to check if quotes are applied
automatically when we have a "simple" GUC name, aka I guess made of
only lower-case characters? This could be done with a islower() on
the string name, for instance.
--
Michael

#20Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Michael Paquier (#19)
Re: GUC names in messages

On 2023-Nov-24, Michael Paquier wrote:

On Thu, Nov 23, 2023 at 06:27:04PM +1100, Peter Smith wrote:

There may be some changes I've missed, but hopefully, this is a nudge
in the right direction.

Thanks for spending some time on that.

+1

<para>
+    In messages containing configuration variable names, do not include quotes
+    when the names are visibly not English natural words, such as when they
+    have underscores or are all-uppercase or have mixed case. Otherwise, quotes
+    must be added.  Do include quotes in a message where an arbitrary variable
+    name is to be expanded.
+   </para>

That seems to describe clearly the consensus reached on the thread
(quotes for GUCs that are single terms, no quotes for names that are
obviously parameters).

Yeah, this is pretty much the patch I proposed earlier.

In terms of messages that have predictible names, 0002 moves in the
needle in the right direction. There seem to be more:
src/backend/postmaster/bgworker.c: errhint("Consider increasing the
configuration parameter \"max_worker_processes\".")));
contrib/pg_prewarm/autoprewarm.c: errhint("Consider increasing
configuration parameter \"max_worker_processes\".")));

Yeah. Also, these could be changed to have the GUC name outside the
message proper, which would reduce the total number of messages. (But
care must be given to the word "the" there.)

Things like parse_and_validate_value() and set_config_option_ext()
include log strings about GUC and these use quotes. Could these areas
be made smarter with a routine to check if quotes are applied
automatically when we have a "simple" GUC name, aka I guess made of
only lower-case characters? This could be done with a islower() on
the string name, for instance.

I think we could leave these improvements for a second round. They
don't need to hold back the improvement we already have.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"You're _really_ hosed if the person doing the hiring doesn't understand
relational systems: you end up with a whole raft of programmers, none of
whom has had a Date with the clue stick." (Andrew Sullivan)
/messages/by-id/20050809113420.GD2768@phlogiston.dyndns.org

#21Michael Paquier
michael@paquier.xyz
In reply to: Alvaro Herrera (#20)
Re: GUC names in messages

On Fri, Nov 24, 2023 at 10:53:40AM +0100, Alvaro Herrera wrote:

I think we could leave these improvements for a second round. They
don't need to hold back the improvement we already have.

Of course, no problem here to do things one step at a time.
--
Michael

#22Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#19)
3 attachment(s)
Re: GUC names in messages

On Fri, Nov 24, 2023 at 2:11 PM Michael Paquier <michael@paquier.xyz> wrote:

On Thu, Nov 23, 2023 at 06:27:04PM +1100, Peter Smith wrote:

There may be some changes I've missed, but hopefully, this is a nudge
in the right direction.

Thanks for spending some time on that.

<para>
+    In messages containing configuration variable names, do not include quotes
+    when the names are visibly not English natural words, such as when they
+    have underscores or are all-uppercase or have mixed case. Otherwise, quotes
+    must be added.  Do include quotes in a message where an arbitrary variable
+    name is to be expanded.
+   </para>

That seems to describe clearly the consensus reached on the thread
(quotes for GUCs that are single terms, no quotes for names that are
obviously parameters).

In terms of messages that have predictible names, 0002 moves in the
needle in the right direction. There seem to be more:
src/backend/postmaster/bgworker.c: errhint("Consider increasing the
configuration parameter \"max_worker_processes\".")));
contrib/pg_prewarm/autoprewarm.c: errhint("Consider increasing
configuration parameter \"max_worker_processes\".")));

Done in patch 0002

Things like parse_and_validate_value() and set_config_option_ext()
include log strings about GUC and these use quotes. Could these areas
be made smarter with a routine to check if quotes are applied
automatically when we have a "simple" GUC name, aka I guess made of
only lower-case characters? This could be done with a islower() on
the string name, for instance.

See what you think of patch 0003

~~

PSA v2 patches.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v2-0001-GUC-names-docs.patchapplication/octet-stream; name=v2-0001-GUC-names-docs.patchDownload
From 4dbee6f4f6a23239c457e1484263b9822dbc13d7 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Fri, 24 Nov 2023 17:16:53 +1100
Subject: [PATCH v2] GUC names - docs

---
 doc/src/sgml/sources.sgml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index 06d995e..45ad706 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -539,6 +539,14 @@ Hint:       The addendum, written as a complete sentence.
    </para>
 
    <para>
+    In messages containing configuration variable names, do not include quotes
+    when the names are visibly not English natural words, such as when they
+    have underscores or are all-uppercase or have mixed case. Otherwise, quotes
+    must be added.  Do include quotes in a message where an arbitrary variable
+    name is to be expanded.
+   </para>
+
+   <para>
     There are functions in the backend that will double-quote their own output
     as needed (for example, <function>format_type_be()</function>).  Do not put
     additional quotes around the output of such functions.
-- 
1.8.3.1

v2-0002-GUC-names-fix-quotes.patchapplication/octet-stream; name=v2-0002-GUC-names-fix-quotes.patchDownload
From b7816d510b59262c8ad5626447340654760d581a Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Mon, 27 Nov 2023 09:27:05 +1100
Subject: [PATCH v2] GUC names - fix quotes

---
 contrib/pg_prewarm/autoprewarm.c               |  2 +-
 src/backend/access/heap/vacuumlazy.c           |  2 +-
 src/backend/access/transam/commit_ts.c         |  4 +-
 src/backend/access/transam/xlog.c              |  4 +-
 src/backend/commands/vacuum.c                  |  2 +-
 src/backend/commands/variable.c                |  4 +-
 src/backend/libpq/be-secure-openssl.c          |  6 +--
 src/backend/postmaster/bgworker.c              |  2 +-
 src/backend/postmaster/checkpointer.c          |  2 +-
 src/backend/postmaster/pgarch.c                |  2 +-
 src/backend/storage/buffer/localbuf.c          |  2 +-
 src/backend/storage/file/fd.c                  |  2 +-
 src/backend/storage/lmgr/predicate.c           |  2 +-
 src/backend/tcop/postgres.c                    | 10 ++---
 src/backend/utils/adt/datetime.c               |  2 +-
 src/backend/utils/adt/pg_locale.c              |  4 +-
 src/backend/utils/fmgr/dfmgr.c                 |  4 +-
 src/backend/utils/misc/guc.c                   |  2 +-
 src/backend/utils/misc/guc_tables.c            |  4 +-
 src/test/regress/expected/collate.icu.utf8.out |  4 +-
 src/test/regress/expected/date.out             | 58 +++++++++++++-------------
 src/test/regress/expected/horology.out         |  2 +-
 src/test/regress/expected/json.out             |  4 +-
 src/test/regress/expected/jsonb.out            |  4 +-
 24 files changed, 67 insertions(+), 67 deletions(-)

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index d0efc9e..0993bd2 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -877,7 +877,7 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing configuration parameter max_worker_processes.")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 59f51f4..3b9299b 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -2658,7 +2658,7 @@ lazy_check_wraparound_failsafe(LVRelState *vacrel)
 						vacrel->dbname, vacrel->relnamespace, vacrel->relname,
 						vacrel->num_index_scans),
 				 errdetail("The table's relfrozenxid or relminmxid is too far in the past."),
-				 errhint("Consider increasing configuration parameter \"maintenance_work_mem\" or \"autovacuum_work_mem\".\n"
+				 errhint("Consider increasing configuration parameter maintenance_work_mem or autovacuum_work_mem.\n"
 						 "You might also need to consider other ways for VACUUM to keep up with the allocation of transaction IDs.")));
 
 		/* Stop applying cost limits from this point on */
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index b897fab..9385790 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -376,9 +376,9 @@ error_commit_ts_disabled(void)
 			(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 			 errmsg("could not get commit timestamp data"),
 			 RecoveryInProgress() ?
-			 errhint("Make sure the configuration parameter \"%s\" is set on the primary server.",
+			 errhint("Make sure the configuration parameter %s is set on the primary server.",
 					 "track_commit_timestamp") :
-			 errhint("Make sure the configuration parameter \"%s\" is set.",
+			 errhint("Make sure the configuration parameter %s is set.",
 					 "track_commit_timestamp")));
 }
 
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 1159dff..32adc63 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4244,11 +4244,11 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("min_wal_size must be at least twice wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("max_wal_size must be at least twice wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 8bdbee6..be43b46 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -134,7 +134,7 @@ check_vacuum_buffer_usage_limit(int *newval, void **extra,
 		return true;
 
 	/* Value does not fall within any allowable range */
-	GUC_check_errdetail("\"vacuum_buffer_usage_limit\" must be 0 or between %d kB and %d kB",
+	GUC_check_errdetail("vacuum_buffer_usage_limit must be 0 or between %d kB and %d kB",
 						MIN_BAS_VAC_RING_SIZE_KB, MAX_BAS_VAC_RING_SIZE_KB);
 
 	return false;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index a88cf5f..2703d2e 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting DateStyle specifications.");
 		return false;
 	}
 
@@ -717,7 +717,7 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change client_encoding now.");
 		}
 		return false;
 	}
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index 31b6a6e..e715fee 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -195,7 +195,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 			/*- translator: first %s is a GUC option name, second %s is its value */
-					(errmsg("\"%s\" setting \"%s\" not supported by this build",
+					(errmsg("%s setting \"%s\" not supported by this build",
 							"ssl_min_protocol_version",
 							GetConfigOption("ssl_min_protocol_version",
 											false, false))));
@@ -218,7 +218,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 			/*- translator: first %s is a GUC option name, second %s is its value */
-					(errmsg("\"%s\" setting \"%s\" not supported by this build",
+					(errmsg("%s setting \"%s\" not supported by this build",
 							"ssl_max_protocol_version",
 							GetConfigOption("ssl_max_protocol_version",
 											false, false))));
@@ -245,7 +245,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 					(errmsg("could not set SSL protocol version range"),
-					 errdetail("\"%s\" cannot be higher than \"%s\"",
+					 errdetail("%s cannot be higher than %s",
 							   "ssl_min_protocol_version",
 							   "ssl_max_protocol_version")));
 			goto error;
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index 48a9924..911bf24 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -944,7 +944,7 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 								  "Up to %d background workers can be registered with the current settings.",
 								  max_worker_processes,
 								  max_worker_processes),
-				 errhint("Consider increasing the configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing the configuration parameter max_worker_processes.")));
 		return;
 	}
 
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 42c807d..dc2da5a 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -423,7 +423,7 @@ CheckpointerMain(void)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"max_wal_size\".")));
+						 errhint("Consider increasing the configuration parameter max_wal_size.")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 46af349..a2555e8 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -807,7 +807,7 @@ HandlePgArchInterrupts(void)
 			 */
 			ereport(LOG,
 					(errmsg("restarting archiver process because value of "
-							"\"archive_library\" was changed")));
+							"archive_library was changed")));
 
 			proc_exit(0);
 		}
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 4efb34b..aebcf14 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -705,7 +705,7 @@ check_temp_buffers(int *newval, void **extra, GucSource source)
 	 */
 	if (source != PGC_S_TEST && NLocBuffer && NLocBuffer != *newval)
 	{
-		GUC_check_errdetail("\"temp_buffers\" cannot be changed after any temporary tables have been accessed in the session.");
+		GUC_check_errdetail("temp_buffers cannot be changed after any temporary tables have been accessed in the session.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index f691ba0..a185fb3 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3931,7 +3931,7 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 
 	if (!SplitGUCList(rawstring, ',', &elemlist))
 	{
-		GUC_check_errdetail("invalid list syntax in parameter \"%s\"",
+		GUC_check_errdetail("invalid list syntax in parameter %s",
 							"debug_io_direct");
 		pfree(rawstring);
 		list_free(elemlist);
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index a794546..f1f6d0c 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1643,7 +1643,7 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
+				 errdetail("default_transaction_isolation is set to \"serializable\"."),
 				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
 
 	/*
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index e415cf1..7298a18 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3524,7 +3524,7 @@ check_stack_depth(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
 				 errmsg("stack depth limit exceeded"),
-				 errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "
+				 errhint("Increase the configuration parameter max_stack_depth (currently %dkB), "
 						 "after ensuring the platform's stack depth limit is adequate.",
 						 max_stack_depth)));
 	}
@@ -3571,7 +3571,7 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("max_stack_depth must not exceed %ldkB.",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3632,9 +3632,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable log_statement_stats when "
+							"log_parser_stats, log_planner_stats, "
+							"or log_executor_stats is true.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index fca9a2a..8ef5bf0 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4022,7 +4022,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different DateStyle setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index d5003da..1dee462 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -2875,7 +2875,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("could not get language from ICU locale \"%s\": %s",
 						loc_str, u_errorName(status)),
-				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
 						 "icu_validation_level", "disabled")));
 		return;
 	}
@@ -2904,7 +2904,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("ICU locale \"%s\" has unknown language \"%s\"",
 						loc_str, lang),
-				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
 						 "icu_validation_level", "disabled")));
 
 	/* check that it can be opened */
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index b85d52c..56724ff 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -555,7 +555,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (piece == p)
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("zero-length component in parameter \"dynamic_library_path\"")));
+					 errmsg("zero-length component in parameter dynamic_library_path")));
 
 		if (piece == NULL)
 			len = strlen(p);
@@ -574,7 +574,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (!is_absolute_path(mangled))
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("component in parameter \"dynamic_library_path\" is not an absolute path")));
+					 errmsg("component in parameter dynamic_library_path is not an absolute path")));
 
 		full = palloc(strlen(mangled) + 1 + baselen + 1);
 		sprintf(full, "%s/%s", mangled, basename);
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 82d8efb..e76c083 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1873,7 +1873,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
 	else
 	{
 		write_stderr("%s does not know where to find the database system data.\n"
-					 "This can be specified as \"data_directory\" in \"%s\", "
+					 "This can be specified as data_directory in \"%s\", "
 					 "or by the -D invocation option, or by the "
 					 "PGDATA environment variable.\n",
 					 progname, ConfigFileName);
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index b764ef6..67fedb2 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3811,7 +3811,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_command", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the shell command that will be called to archive a WAL file."),
-			gettext_noop("This is used only if \"archive_library\" is not set.")
+			gettext_noop("This is used only if archive_library is not set.")
 		},
 		&XLogArchiveCommand,
 		"",
@@ -3821,7 +3821,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_library", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the library that will be called to archive a WAL file."),
-			gettext_noop("An empty string indicates that \"archive_command\" should be used.")
+			gettext_noop("An empty string indicates that archive_command should be used.")
 		},
 		&XLogArchiveLibrary,
 		"",
diff --git a/src/test/regress/expected/collate.icu.utf8.out b/src/test/regress/expected/collate.icu.utf8.out
index 97bbe53..7a05c75 100644
--- a/src/test/regress/expected/collate.icu.utf8.out
+++ b/src/test/regress/expected/collate.icu.utf8.out
@@ -1042,7 +1042,7 @@ ERROR:  parameter "locale" must be specified
 SET icu_validation_level = ERROR;
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); -- fails
 ERROR:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
+HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
 CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=yes'); -- fails
 ERROR:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 RESET icu_validation_level;
@@ -1050,7 +1050,7 @@ CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=
 WARNING:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); DROP COLLATION testx;
 WARNING:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
+HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
 CREATE COLLATION test4 FROM nonsense;
 ERROR:  collation "nonsense" for encoding "UTF8" does not exist
 CREATE COLLATION test5 FROM test0;
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..99650bf 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index cfb4b20..4aeefd5 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out
index aa29bc5..7cb28f1 100644
--- a/src/test/regress/expected/json.out
+++ b/src/test/regress/expected/json.out
@@ -219,10 +219,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::json;			-- OK
diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out
index f8a7dac..b597d01 100644
--- a/src/test/regress/expected/jsonb.out
+++ b/src/test/regress/expected/jsonb.out
@@ -213,10 +213,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::jsonb;			-- OK
-- 
1.8.3.1

v2-0003-GUC-names-maybe-add-quotes.patchapplication/octet-stream; name=v2-0003-GUC-names-maybe-add-quotes.patchDownload
From 7f0c7522731c5ce134311a522be17a9991fd6135 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Mon, 27 Nov 2023 09:35:11 +1100
Subject: [PATCH v2] GUC names - maybe add quotes

---
 src/backend/utils/misc/guc.c                       | 233 +++++++++++++--------
 .../test_oat_hooks/expected/test_oat_hooks.out     |   4 +-
 .../modules/unsafe_tests/expected/guc_privs.out    |  54 ++---
 .../modules/unsafe_tests/expected/rolenames.out    |   2 +-
 src/test/regress/expected/compression.out          |   4 +-
 src/test/regress/expected/compression_1.out        |   6 +-
 src/test/regress/expected/create_am.out            |   4 +-
 src/test/regress/expected/guc.out                  |  10 +-
 src/test/regress/expected/password.out             |   4 +-
 src/test/regress/expected/subscription.out         |   2 +-
 src/test/regress/expected/transactions.out         |   8 +-
 11 files changed, 193 insertions(+), 138 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e76c083..e91aa2d 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -267,6 +267,52 @@ static bool call_enum_check_hook(struct config_enum *conf, int *newval,
 
 
 /*
+ * Return the GUC name, maybe enclosed in double-quotes.
+ *
+ * The purpose is to only quote names which potential could be mistaken for
+ * normal English words.
+ *
+ * - Lowercase alpha needs quotes unless there are underscores.
+ * - Upper/mixed case alpha does not need quotes.
+ * - Anything else needs quotes
+ *
+ * TAKE CARE: The function returns a reference to a static buffer. It is fine
+ * for the intended purpose of single GUC substitions into log messages, but
+ * it might not be suitable for other use cases.
+ */
+static
+char *
+maybe_quote_GUC_name(const char *name)
+{
+	static char buf[64];
+
+	bool need_quotes;
+
+	bool underscore = false;
+	bool lowercase = false;
+	bool uppercase = false;
+	bool special = false;
+
+	for (const char *p = name; *p; p++)
+	{
+		if (*p == '_')
+			underscore = true;
+		else if ('a' <= *p && *p <= 'z')
+			lowercase = true;
+		else if ('A' <= *p && *p <= 'Z')
+			uppercase = true;
+		else
+			special = true;
+	}
+
+	need_quotes = special || (lowercase && !underscore && !uppercase);
+
+	sprintf(buf, need_quotes ? "\"%s\"" : "%s", name);
+	return buf;
+}
+
+
+/*
  * This function handles both actual config file (re)loads and execution of
  * show_all_file_settings() (i.e., the pg_file_settings view).  In the latter
  * case we don't apply any of the settings, but we make all the usual validity
@@ -420,8 +466,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			/* Invalid non-custom variable, so complain */
 			ereport(elevel,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
-					 errmsg("unrecognized configuration parameter \"%s\" in file \"%s\" line %d",
-							item->name,
+					 errmsg("unrecognized configuration parameter %s in file \"%s\" line %d",
+							maybe_quote_GUC_name(item->name),
 							item->filename, item->sourceline)));
 			item->errmsg = pstrdup("unrecognized configuration parameter");
 			error = true;
@@ -460,10 +506,10 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			gconf->status |= GUC_PENDING_RESTART;
 			ereport(elevel,
 					(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-					 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-							gconf->name)));
-			record_config_file_error(psprintf("parameter \"%s\" cannot be changed without restarting the server",
-											  gconf->name),
+					 errmsg("parameter %s cannot be changed without restarting the server",
+							maybe_quote_GUC_name(gconf->name))));
+			record_config_file_error(psprintf("parameter %s cannot be changed without restarting the server",
+											  maybe_quote_GUC_name(gconf->name)),
 									 NULL, 0,
 									 &head, &tail);
 			error = true;
@@ -496,8 +542,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			/* Log the change if appropriate */
 			if (context == PGC_SIGHUP)
 				ereport(elevel,
-						(errmsg("parameter \"%s\" removed from configuration file, reset to default",
-								gconf->name)));
+						(errmsg("parameter %s removed from configuration file, reset to default",
+								maybe_quote_GUC_name(gconf->name))));
 		}
 	}
 
@@ -561,8 +607,9 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 					post_value = "";
 				if (strcmp(pre_value, post_value) != 0)
 					ereport(elevel,
-							(errmsg("parameter \"%s\" changed to \"%s\"",
-									item->name, item->value)));
+							(errmsg("parameter %s changed to \"%s\"",
+									maybe_quote_GUC_name(item->name),
+									item->value)));
 			}
 			item->applied = true;
 		}
@@ -1129,8 +1176,8 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 			if (!skip_errors)
 				ereport(elevel,
 						(errcode(ERRCODE_INVALID_NAME),
-						 errmsg("invalid configuration parameter name \"%s\"",
-								name),
+						 errmsg("invalid configuration parameter name %s",
+								maybe_quote_GUC_name(name)),
 						 errdetail("Custom parameter names must be two or more simple identifiers separated by dots.")));
 			return false;
 		}
@@ -1145,8 +1192,8 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 				if (!skip_errors)
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_NAME),
-							 errmsg("invalid configuration parameter name \"%s\"",
-									name),
+							 errmsg("invalid configuration parameter name %s",
+									maybe_quote_GUC_name(name)),
 							 errdetail("\"%s\" is a reserved prefix.",
 									   rcprefix)));
 				return false;
@@ -1160,8 +1207,8 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 	if (!skip_errors)
 		ereport(elevel,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
-				 errmsg("unrecognized configuration parameter \"%s\"",
-						name)));
+				 errmsg("unrecognized configuration parameter %s",
+						maybe_quote_GUC_name(name))));
 	return false;
 }
 
@@ -1270,8 +1317,8 @@ find_option(const char *name, bool create_placeholders, bool skip_errors,
 	if (!skip_errors)
 		ereport(elevel,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
-				 errmsg("unrecognized configuration parameter \"%s\"",
-						name)));
+				 errmsg("unrecognized configuration parameter %s",
+						maybe_quote_GUC_name(name))));
 	return NULL;
 }
 
@@ -3125,8 +3172,8 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("parameter \"%s\" requires a Boolean value",
-									name)));
+							 errmsg("parameter %s requires a Boolean value",
+									maybe_quote_GUC_name(name))));
 					return false;
 				}
 
@@ -3145,8 +3192,8 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+							 errmsg("invalid value for parameter %s: \"%s\"",
+									maybe_quote_GUC_name(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3157,11 +3204,11 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("%d%s%s is outside the valid range for parameter \"%s\" (%d .. %d)",
+							 errmsg("%d%s%s is outside the valid range for parameter %s (%d .. %d)",
 									newval->intval,
 									unit ? " " : "",
 									unit ? unit : "",
-									name,
+									maybe_quote_GUC_name(name),
 									conf->min, conf->max)));
 					return false;
 				}
@@ -3181,8 +3228,8 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+							 errmsg("invalid value for parameter %s: \"%s\"",
+									maybe_quote_GUC_name(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3193,11 +3240,11 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("%g%s%s is outside the valid range for parameter \"%s\" (%g .. %g)",
+							 errmsg("%g%s%s is outside the valid range for parameter %s (%g .. %g)",
 									newval->realval,
 									unit ? " " : "",
 									unit ? unit : "",
-									name,
+									maybe_quote_GUC_name(name),
 									conf->min, conf->max)));
 					return false;
 				}
@@ -3251,8 +3298,8 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+							 errmsg("invalid value for parameter %s: \"%s\"",
+									maybe_quote_GUC_name(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
@@ -3410,8 +3457,8 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+						 errmsg("parameter %s cannot be changed",
+								maybe_quote_GUC_name(name))));
 				return 0;
 			}
 			break;
@@ -3433,8 +3480,8 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-								name)));
+						 errmsg("parameter %s cannot be changed without restarting the server",
+								maybe_quote_GUC_name(name))));
 				return 0;
 			}
 			break;
@@ -3443,8 +3490,8 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed now",
-								name)));
+						 errmsg("parameter %s cannot be changed now",
+								maybe_quote_GUC_name(name))));
 				return 0;
 			}
 
@@ -3470,8 +3517,8 @@ set_config_option_ext(const char *name, const char *value,
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+							 errmsg("permission denied to set parameter %s",
+									maybe_quote_GUC_name(name))));
 					return 0;
 				}
 			}
@@ -3508,8 +3555,8 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be set after connection start",
-								name)));
+						 errmsg("parameter %s cannot be set after connection start",
+								maybe_quote_GUC_name(name))));
 				return 0;
 			}
 			break;
@@ -3528,8 +3575,8 @@ set_config_option_ext(const char *name, const char *value,
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+							 errmsg("permission denied to set parameter %s",
+									maybe_quote_GUC_name(name))));
 					return 0;
 				}
 			}
@@ -3567,16 +3614,16 @@ set_config_option_ext(const char *name, const char *value,
 			 */
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-					 errmsg("cannot set parameter \"%s\" within security-definer function",
-							name)));
+					 errmsg("cannot set parameter %s within security-definer function",
+							maybe_quote_GUC_name(name))));
 			return 0;
 		}
 		if (InSecurityRestrictedOperation())
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-					 errmsg("cannot set parameter \"%s\" within security-restricted operation",
-							name)));
+					 errmsg("cannot set parameter %s within security-restricted operation",
+							maybe_quote_GUC_name(name))));
 			return 0;
 		}
 	}
@@ -3588,15 +3635,16 @@ set_config_option_ext(const char *name, const char *value,
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be reset", name)));
+					 errmsg("parameter %s cannot be reset",
+							maybe_quote_GUC_name(name))));
 			return 0;
 		}
 		if (action == GUC_ACTION_SAVE)
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be set locally in functions",
-							name)));
+					 errmsg("parameter %s cannot be set locally in functions",
+							maybe_quote_GUC_name(name))));
 			return 0;
 		}
 	}
@@ -3621,8 +3669,8 @@ set_config_option_ext(const char *name, const char *value,
 	{
 		if (changeVal && !makeDefault)
 		{
-			elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority",
-				 name);
+			elog(DEBUG3, "%s: setting ignored because previous source is higher priority",
+				 maybe_quote_GUC_name(name));
 			return -1;
 		}
 		changeVal = false;
@@ -3673,8 +3721,8 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+								 errmsg("parameter %s cannot be changed without restarting the server",
+										maybe_quote_GUC_name(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3771,8 +3819,8 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+								 errmsg("parameter %s cannot be changed without restarting the server",
+										maybe_quote_GUC_name(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3869,8 +3917,8 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+								 errmsg("parameter %s cannot be changed without restarting the server",
+										maybe_quote_GUC_name(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3993,8 +4041,8 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+								 errmsg("parameter %s cannot be changed without restarting the server",
+										maybe_quote_GUC_name(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4096,8 +4144,8 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+								 errmsg("parameter %s cannot be changed without restarting the server",
+										maybe_quote_GUC_name(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4238,7 +4286,8 @@ GetConfigOption(const char *name, bool missing_ok, bool restrict_privileged)
 		!ConfigOptionIsVisible(record))
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to examine \"%s\"", name),
+				 errmsg("permission denied to examine %s",
+						maybe_quote_GUC_name(name)),
 				 errdetail("Only roles with privileges of the \"%s\" role may examine this parameter.",
 						   "pg_read_all_settings")));
 
@@ -4534,8 +4583,8 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 			if (aclresult != ACLCHECK_OK)
 				ereport(ERROR,
 						(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-						 errmsg("permission denied to set parameter \"%s\"",
-								name)));
+						 errmsg("permission denied to set parameter %s",
+								maybe_quote_GUC_name(name))));
 		}
 	}
 
@@ -4559,8 +4608,8 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 				(record->flags & GUC_DISALLOW_IN_AUTO_FILE))
 				ereport(ERROR,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+						 errmsg("parameter %s cannot be changed",
+								maybe_quote_GUC_name(name))));
 
 			/*
 			 * If a value is specified, verify that it's sane.
@@ -4575,8 +4624,8 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 											  &newval, &newextra))
 					ereport(ERROR,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value)));
+							 errmsg("invalid value for parameter %s: \"%s\"",
+									maybe_quote_GUC_name(name), value)));
 
 				if (record->vartype == PGC_STRING && newval.stringval != NULL)
 					guc_free(newval.stringval);
@@ -4830,7 +4879,8 @@ define_custom_variable(struct config_generic *variable)
 	if ((hentry->gucvar->flags & GUC_CUSTOM_PLACEHOLDER) == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_INTERNAL_ERROR),
-				 errmsg("attempt to redefine parameter \"%s\"", name)));
+				 errmsg("attempt to redefine parameter %s",
+						maybe_quote_GUC_name(name))));
 
 	Assert(hentry->gucvar->vartype == PGC_STRING);
 	pHolder = (struct config_string *) hentry->gucvar;
@@ -5169,8 +5219,8 @@ MarkGUCPrefixReserved(const char *className)
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("invalid configuration parameter name \"%s\", removing it",
-							var->name),
+					 errmsg("invalid configuration parameter name %s, removing it",
+							maybe_quote_GUC_name(var->name)),
 					 errdetail("\"%s\" is now a reserved prefix.",
 							   className)));
 			/* Remove it from the hash table */
@@ -5313,7 +5363,8 @@ GetConfigOptionByName(const char *name, const char **varname, bool missing_ok)
 	if (!ConfigOptionIsVisible(record))
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to examine \"%s\"", name),
+				 errmsg("permission denied to examine %s",
+						maybe_quote_GUC_name(name)),
 				 errdetail("Only roles with privileges of the \"%s\" role may examine this parameter.",
 						   "pg_read_all_settings")));
 
@@ -5639,7 +5690,8 @@ read_nondefault_variables(void)
 			break;
 
 		if (find_option(varname, true, false, FATAL) == NULL)
-			elog(FATAL, "failed to locate variable \"%s\" in exec config params file", varname);
+			elog(FATAL, "failed to locate variable %s in exec config params file",
+				 maybe_quote_GUC_name(varname));
 
 		if ((varvalue = read_string_with_null(fp)) == NULL)
 			elog(FATAL, "invalid format of exec config params file");
@@ -6048,8 +6100,8 @@ guc_restore_error_context_callback(void *arg)
 	char	  **error_context_name_and_value = (char **) arg;
 
 	if (error_context_name_and_value)
-		errcontext("while setting parameter \"%s\" to \"%s\"",
-				   error_context_name_and_value[0],
+		errcontext("while setting parameter %s to \"%s\"",
+				   maybe_quote_GUC_name(error_context_name_and_value[0]),
 				   error_context_name_and_value[1]);
 }
 
@@ -6217,7 +6269,8 @@ RestoreGUCState(void *gucstate)
 		if (result <= 0)
 			ereport(ERROR,
 					(errcode(ERRCODE_INTERNAL_ERROR),
-					 errmsg("parameter \"%s\" could not be set", varname)));
+					 errmsg("parameter %s could not be set",
+							maybe_quote_GUC_name(varname))));
 		if (varsourcefile[0])
 			set_config_sourcefile(varname, varsourcefile, varsourceline);
 		error_context_callback.arg = NULL;
@@ -6307,8 +6360,8 @@ TransformGUCArray(ArrayType *array, List **names, List **values)
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_SYNTAX_ERROR),
-					 errmsg("could not parse setting for parameter \"%s\"",
-							name)));
+					 errmsg("could not parse setting for parameter %s",
+							maybe_quote_GUC_name(name))));
 			pfree(name);
 			continue;
 		}
@@ -6625,7 +6678,8 @@ validate_option_array_item(const char *name, const char *value,
 			return false;
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to set parameter \"%s\"", name)));
+				 errmsg("permission denied to set parameter %s",
+						maybe_quote_GUC_name(name))));
 	}
 
 	/* manual permissions check so we can avoid an error being thrown */
@@ -6689,8 +6743,8 @@ call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %d",
-						conf->gen.name, (int) *newval),
+				 errmsg("invalid value for parameter %s: %d",
+						maybe_quote_GUC_name(conf->gen.name), (int) *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6723,8 +6777,8 @@ call_int_check_hook(struct config_int *conf, int *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %d",
-						conf->gen.name, *newval),
+				 errmsg("invalid value for parameter %s: %d",
+						maybe_quote_GUC_name(conf->gen.name), *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6757,8 +6811,8 @@ call_real_check_hook(struct config_real *conf, double *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %g",
-						conf->gen.name, *newval),
+				 errmsg("invalid value for parameter %s: %g",
+						maybe_quote_GUC_name(conf->gen.name), *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6800,8 +6854,9 @@ call_string_check_hook(struct config_string *conf, char **newval, void **extra,
 					(errcode(GUC_check_errcode_value),
 					 GUC_check_errmsg_string ?
 					 errmsg_internal("%s", GUC_check_errmsg_string) :
-					 errmsg("invalid value for parameter \"%s\": \"%s\"",
-							conf->gen.name, *newval ? *newval : ""),
+					 errmsg("invalid value for parameter %s: \"%s\"",
+							maybe_quote_GUC_name(conf->gen.name),
+							*newval ? *newval : ""),
 					 GUC_check_errdetail_string ?
 					 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 					 GUC_check_errhint_string ?
@@ -6841,8 +6896,8 @@ call_enum_check_hook(struct config_enum *conf, int *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": \"%s\"",
-						conf->gen.name,
+				 errmsg("invalid value for parameter %s: \"%s\"",
+						maybe_quote_GUC_name(conf->gen.name),
 						config_enum_lookup_by_value(conf, *newval)),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
diff --git a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
index f80373a..ccaa65e 100644
--- a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
+++ b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
@@ -180,10 +180,10 @@ NOTICE:  in object_access_hook_str: non-superuser finished alter (subId=0x1000,
 NOTICE:  in process utility: non-superuser finished RESET
 ALTER SYSTEM SET work_mem = 8192;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "work_mem"
+ERROR:  permission denied to set parameter work_mem
 ALTER SYSTEM RESET work_mem;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "work_mem"
+ERROR:  permission denied to set parameter work_mem
 SET test_oat_hooks.user_var1 = true;
 NOTICE:  in process utility: non-superuser attempting SET
 NOTICE:  in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var1]
diff --git a/src/test/modules/unsafe_tests/expected/guc_privs.out b/src/test/modules/unsafe_tests/expected/guc_privs.out
index 6c0ad89..5ed2113 100644
--- a/src/test/modules/unsafe_tests/expected/guc_privs.out
+++ b/src/test/modules/unsafe_tests/expected/guc_privs.out
@@ -8,31 +8,31 @@ CREATE ROLE regress_admin SUPERUSER;
 SET SESSION AUTHORIZATION regress_admin;
 -- PGC_BACKEND
 SET ignore_system_indexes = OFF;  -- fail, cannot be set after connection start
-ERROR:  parameter "ignore_system_indexes" cannot be set after connection start
+ERROR:  parameter ignore_system_indexes cannot be set after connection start
 RESET ignore_system_indexes;  -- fail, cannot be set after connection start
-ERROR:  parameter "ignore_system_indexes" cannot be set after connection start
+ERROR:  parameter ignore_system_indexes cannot be set after connection start
 ALTER SYSTEM SET ignore_system_indexes = OFF;  -- ok
 ALTER SYSTEM RESET ignore_system_indexes;  -- ok
 -- PGC_INTERNAL
 SET block_size = 50;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 RESET block_size;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 ALTER SYSTEM SET block_size = 50;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 ALTER SYSTEM RESET block_size;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 -- PGC_POSTMASTER
 SET autovacuum_freeze_max_age = 1000050000;  -- fail, requires restart
-ERROR:  parameter "autovacuum_freeze_max_age" cannot be changed without restarting the server
+ERROR:  parameter autovacuum_freeze_max_age cannot be changed without restarting the server
 RESET autovacuum_freeze_max_age;  -- fail, requires restart
-ERROR:  parameter "autovacuum_freeze_max_age" cannot be changed without restarting the server
+ERROR:  parameter autovacuum_freeze_max_age cannot be changed without restarting the server
 ALTER SYSTEM SET autovacuum_freeze_max_age = 1000050000;  -- ok
 ALTER SYSTEM RESET autovacuum_freeze_max_age;  -- ok
 ALTER SYSTEM SET config_file = '/usr/local/data/postgresql.conf';  -- fail, cannot be changed
-ERROR:  parameter "config_file" cannot be changed
+ERROR:  parameter config_file cannot be changed
 ALTER SYSTEM RESET config_file;  -- fail, cannot be changed
-ERROR:  parameter "config_file" cannot be changed
+ERROR:  parameter config_file cannot be changed
 -- PGC_SIGHUP
 SET autovacuum = OFF;  -- fail, requires reload
 ERROR:  parameter "autovacuum" cannot be changed now
@@ -47,9 +47,9 @@ ALTER SYSTEM SET lc_messages = 'C';  -- ok
 ALTER SYSTEM RESET lc_messages;  -- ok
 -- PGC_SU_BACKEND
 SET jit_debugging_support = OFF;  -- fail, cannot be set after connection start
-ERROR:  parameter "jit_debugging_support" cannot be set after connection start
+ERROR:  parameter jit_debugging_support cannot be set after connection start
 RESET jit_debugging_support;  -- fail, cannot be set after connection start
-ERROR:  parameter "jit_debugging_support" cannot be set after connection start
+ERROR:  parameter jit_debugging_support cannot be set after connection start
 ALTER SYSTEM SET jit_debugging_support = OFF;  -- ok
 ALTER SYSTEM RESET jit_debugging_support;  -- ok
 -- PGC_USERSET
@@ -58,9 +58,9 @@ RESET DateStyle;  -- ok
 ALTER SYSTEM SET DateStyle = 'ISO, MDY';  -- ok
 ALTER SYSTEM RESET DateStyle;  -- ok
 ALTER SYSTEM SET ssl_renegotiation_limit = 0;  -- fail, cannot be changed
-ERROR:  parameter "ssl_renegotiation_limit" cannot be changed
+ERROR:  parameter ssl_renegotiation_limit cannot be changed
 ALTER SYSTEM RESET ssl_renegotiation_limit;  -- fail, cannot be changed
-ERROR:  parameter "ssl_renegotiation_limit" cannot be changed
+ERROR:  parameter ssl_renegotiation_limit cannot be changed
 -- Finished testing superuser
 -- Create non-superuser with privileges to configure host resource usage
 CREATE ROLE regress_host_resource_admin NOSUPERUSER;
@@ -244,7 +244,7 @@ SHOW none.such;
 
 -- Can't grant on a non-existent core GUC.
 GRANT ALL ON PARAMETER no_such_guc TO regress_host_resource_admin;  -- fail
-ERROR:  unrecognized configuration parameter "no_such_guc"
+ERROR:  unrecognized configuration parameter no_such_guc
 -- Initially there are no privileges and no catalog entry for this GUC.
 SELECT has_parameter_privilege('regress_host_resource_admin', 'enable_material', 'SET');
  has_parameter_privilege 
@@ -446,17 +446,17 @@ ALTER ROLE regress_host_resource_admin SET lc_messages = 'C';
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- ok, privileges have been granted
 ALTER SYSTEM SET ignore_system_indexes = OFF;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "ignore_system_indexes"
+ERROR:  permission denied to set parameter ignore_system_indexes
 ALTER SYSTEM RESET autovacuum_multixact_freeze_max_age;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "autovacuum_multixact_freeze_max_age"
+ERROR:  permission denied to set parameter autovacuum_multixact_freeze_max_age
 SET jit_provider = 'llvmjit';  -- fail, insufficient privileges
-ERROR:  parameter "jit_provider" cannot be changed without restarting the server
+ERROR:  parameter jit_provider cannot be changed without restarting the server
 SELECT set_config ('jit_provider', 'llvmjit', true); -- fail, insufficient privileges
-ERROR:  parameter "jit_provider" cannot be changed without restarting the server
+ERROR:  parameter jit_provider cannot be changed without restarting the server
 ALTER SYSTEM SET shared_buffers = 50;  -- ok
 ALTER SYSTEM RESET shared_buffers;  -- ok
 SET autovacuum_work_mem = 50;  -- cannot be changed now
-ERROR:  parameter "autovacuum_work_mem" cannot be changed now
+ERROR:  parameter autovacuum_work_mem cannot be changed now
 ALTER SYSTEM RESET temp_file_limit;  -- ok
 SET TimeZone = 'Europe/Helsinki';  -- ok
 RESET TimeZone;  -- ok
@@ -465,13 +465,13 @@ RESET max_stack_depth;  -- ok, privileges have been granted
 ALTER SYSTEM SET max_stack_depth = '100kB';  -- ok, privileges have been granted
 ALTER SYSTEM RESET max_stack_depth;  -- ok, privileges have been granted
 SET lc_messages = 'C';  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 RESET lc_messages;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER SYSTEM SET lc_messages = 'C';  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER SYSTEM RESET lc_messages;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 SELECT set_config ('temp_buffers', '8192', false); -- ok
  set_config 
 ------------
@@ -484,7 +484,7 @@ ERROR:  permission denied to perform ALTER SYSTEM RESET ALL
 ALTER SYSTEM SET none.such2 = 'whiz bang';  -- fail, not superuser
 ERROR:  permission denied to set parameter "none.such2"
 ALTER ROLE regress_host_resource_admin SET lc_messages = 'POSIX';  -- fail
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER ROLE regress_host_resource_admin SET max_stack_depth = '1MB';  -- ok
 SELECT setconfig FROM pg_db_role_setting
   WHERE setrole = 'regress_host_resource_admin'::regrole;
@@ -537,7 +537,7 @@ DROP ROLE regress_host_resource_admin;  -- ok
 CREATE ROLE regress_host_resource_admin NOSUPERUSER;
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- fail, privileges not yet granted
-ERROR:  permission denied to set parameter "autovacuum_work_mem"
+ERROR:  permission denied to set parameter autovacuum_work_mem
 SET SESSION AUTHORIZATION regress_admin;
 GRANT SET, ALTER SYSTEM ON PARAMETER
     autovacuum_work_mem, hash_mem_multiplier, max_stack_depth,
@@ -554,7 +554,7 @@ privileges for parameter work_mem
 DROP OWNED BY regress_host_resource_admin RESTRICT; -- cascade should not be needed
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- fail, "drop owned" has dropped privileges
-ERROR:  permission denied to set parameter "autovacuum_work_mem"
+ERROR:  permission denied to set parameter autovacuum_work_mem
 SET SESSION AUTHORIZATION regress_admin;
 DROP ROLE regress_host_resource_admin;  -- ok
 -- Check that "reassign owned" doesn't affect privileges
diff --git a/src/test/modules/unsafe_tests/expected/rolenames.out b/src/test/modules/unsafe_tests/expected/rolenames.out
index 61396b2..21d2bac 100644
--- a/src/test/modules/unsafe_tests/expected/rolenames.out
+++ b/src/test/modules/unsafe_tests/expected/rolenames.out
@@ -1077,7 +1077,7 @@ SHOW session_preload_libraries;
 SET SESSION AUTHORIZATION regress_role_nopriv;
 -- fails with role not member of pg_read_all_settings
 SHOW session_preload_libraries;
-ERROR:  permission denied to examine "session_preload_libraries"
+ERROR:  permission denied to examine session_preload_libraries
 DETAIL:  Only roles with privileges of the "pg_read_all_settings" role may examine this parameter.
 RESET SESSION AUTHORIZATION;
 ERROR:  current transaction is aborted, commands ignored until end of transaction block
diff --git a/src/test/regress/expected/compression.out b/src/test/regress/expected/compression.out
index 834b755..7426504 100644
--- a/src/test/regress/expected/compression.out
+++ b/src/test/regress/expected/compression.out
@@ -234,10 +234,10 @@ ERROR:  column "f1" has a compression method conflict
 DETAIL:  pglz versus lz4
 -- test default_toast_compression GUC
 SET default_toast_compression = '';
-ERROR:  invalid value for parameter "default_toast_compression": ""
+ERROR:  invalid value for parameter default_toast_compression: ""
 HINT:  Available values: pglz, lz4.
 SET default_toast_compression = 'I do not exist compression';
-ERROR:  invalid value for parameter "default_toast_compression": "I do not exist compression"
+ERROR:  invalid value for parameter default_toast_compression: "I do not exist compression"
 HINT:  Available values: pglz, lz4.
 SET default_toast_compression = 'lz4';
 SET default_toast_compression = 'pglz';
diff --git a/src/test/regress/expected/compression_1.out b/src/test/regress/expected/compression_1.out
index ddcd137..5234e47 100644
--- a/src/test/regress/expected/compression_1.out
+++ b/src/test/regress/expected/compression_1.out
@@ -225,13 +225,13 @@ ERROR:  column "f1" has a compression method conflict
 DETAIL:  pglz versus lz4
 -- test default_toast_compression GUC
 SET default_toast_compression = '';
-ERROR:  invalid value for parameter "default_toast_compression": ""
+ERROR:  invalid value for parameter default_toast_compression: ""
 HINT:  Available values: pglz.
 SET default_toast_compression = 'I do not exist compression';
-ERROR:  invalid value for parameter "default_toast_compression": "I do not exist compression"
+ERROR:  invalid value for parameter default_toast_compression: "I do not exist compression"
 HINT:  Available values: pglz.
 SET default_toast_compression = 'lz4';
-ERROR:  invalid value for parameter "default_toast_compression": "lz4"
+ERROR:  invalid value for parameter default_toast_compression: "lz4"
 HINT:  Available values: pglz.
 SET default_toast_compression = 'pglz';
 -- test alter compression method
diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out
index b50293d..afa11a6 100644
--- a/src/test/regress/expected/create_am.out
+++ b/src/test/regress/expected/create_am.out
@@ -112,11 +112,11 @@ COMMIT;
 --
 -- prevent empty values
 SET default_table_access_method = '';
-ERROR:  invalid value for parameter "default_table_access_method": ""
+ERROR:  invalid value for parameter default_table_access_method: ""
 DETAIL:  default_table_access_method cannot be empty.
 -- prevent nonexistent values
 SET default_table_access_method = 'I do not exist AM';
-ERROR:  invalid value for parameter "default_table_access_method": "I do not exist AM"
+ERROR:  invalid value for parameter default_table_access_method: "I do not exist AM"
 DETAIL:  Table access method "I do not exist AM" does not exist.
 -- prevent setting it to an index AM
 SET default_table_access_method = 'btree';
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 127c953..cbf4e8f 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -508,11 +508,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
 
 -- Test some simple error cases
 SET seq_page_cost TO 'NaN';
-ERROR:  invalid value for parameter "seq_page_cost": "NaN"
+ERROR:  invalid value for parameter seq_page_cost: "NaN"
 SET vacuum_cost_delay TO '10s';
-ERROR:  10000 ms is outside the valid range for parameter "vacuum_cost_delay" (0 .. 100)
+ERROR:  10000 ms is outside the valid range for parameter vacuum_cost_delay (0 .. 100)
 SET no_such_variable TO 42;
-ERROR:  unrecognized configuration parameter "no_such_variable"
+ERROR:  unrecognized configuration parameter no_such_variable
 -- Test "custom" GUCs created on the fly (which aren't really an
 -- intended feature, but many people use them).
 SHOW custom.my_guc;  -- error, not known yet
@@ -811,14 +811,14 @@ create function func_with_bad_set() returns int as $$ select 1 $$
 language sql
 set default_text_search_config = no_such_config;
 NOTICE:  text search configuration "no_such_config" does not exist
-ERROR:  invalid value for parameter "default_text_search_config": "no_such_config"
+ERROR:  invalid value for parameter default_text_search_config: "no_such_config"
 set check_function_bodies = off;
 create function func_with_bad_set() returns int as $$ select 1 $$
 language sql
 set default_text_search_config = no_such_config;
 NOTICE:  text search configuration "no_such_config" does not exist
 select func_with_bad_set();
-ERROR:  invalid value for parameter "default_text_search_config": "no_such_config"
+ERROR:  invalid value for parameter default_text_search_config: "no_such_config"
 reset check_function_bodies;
 set default_with_oids to f;
 -- Should not allow to set it to true.
diff --git a/src/test/regress/expected/password.out b/src/test/regress/expected/password.out
index 924d6e0..752cffc 100644
--- a/src/test/regress/expected/password.out
+++ b/src/test/regress/expected/password.out
@@ -3,10 +3,10 @@
 --
 -- Tests for GUC password_encryption
 SET password_encryption = 'novalue'; -- error
-ERROR:  invalid value for parameter "password_encryption": "novalue"
+ERROR:  invalid value for parameter password_encryption: "novalue"
 HINT:  Available values: md5, scram-sha-256.
 SET password_encryption = true; -- error
-ERROR:  invalid value for parameter "password_encryption": "true"
+ERROR:  invalid value for parameter password_encryption: "true"
 HINT:  Available values: md5, scram-sha-256.
 SET password_encryption = 'md5'; -- ok
 SET password_encryption = 'scram-sha-256'; -- ok
diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out
index b15eddb..8d9229a 100644
--- a/src/test/regress/expected/subscription.out
+++ b/src/test/regress/expected/subscription.out
@@ -220,7 +220,7 @@ RESET ROLE;
 ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo;
 ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
 ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
-ERROR:  invalid value for parameter "synchronous_commit": "foobar"
+ERROR:  invalid value for parameter synchronous_commit: "foobar"
 HINT:  Available values: local, remote_write, remote_apply, on, off.
 \dRs+
                                                                                                                  List of subscriptions
diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out
index 7f5757e..5939ad4 100644
--- a/src/test/regress/expected/transactions.out
+++ b/src/test/regress/expected/transactions.out
@@ -53,7 +53,7 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_isolation; -- error
-ERROR:  parameter "transaction_isolation" cannot be reset
+ERROR:  parameter transaction_isolation cannot be reset
 END;
 BEGIN TRANSACTION READ ONLY;
 SELECT COUNT(*) FROM xacttest;
@@ -63,7 +63,7 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_read_only; -- error
-ERROR:  parameter "transaction_read_only" cannot be reset
+ERROR:  parameter transaction_read_only cannot be reset
 END;
 BEGIN TRANSACTION DEFERRABLE;
 SELECT COUNT(*) FROM xacttest;
@@ -73,11 +73,11 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_deferrable; -- error
-ERROR:  parameter "transaction_deferrable" cannot be reset
+ERROR:  parameter transaction_deferrable cannot be reset
 END;
 CREATE FUNCTION errfunc() RETURNS int LANGUAGE SQL AS 'SELECT 1'
 SET transaction_read_only = on; -- error
-ERROR:  parameter "transaction_read_only" cannot be set locally in functions
+ERROR:  parameter transaction_read_only cannot be set locally in functions
 -- Read-only tests
 CREATE TABLE writetest (a int);
 CREATE TEMPORARY TABLE temptest (a int);
-- 
1.8.3.1

#23Peter Smith
smithpb2250@gmail.com
In reply to: Alvaro Herrera (#20)
Re: GUC names in messages

On Fri, Nov 24, 2023 at 8:53 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

On 2023-Nov-24, Michael Paquier wrote:

On Thu, Nov 23, 2023 at 06:27:04PM +1100, Peter Smith wrote:

There may be some changes I've missed, but hopefully, this is a nudge
in the right direction.

Thanks for spending some time on that.

+1

<para>
+    In messages containing configuration variable names, do not include quotes
+    when the names are visibly not English natural words, such as when they
+    have underscores or are all-uppercase or have mixed case. Otherwise, quotes
+    must be added.  Do include quotes in a message where an arbitrary variable
+    name is to be expanded.
+   </para>

That seems to describe clearly the consensus reached on the thread
(quotes for GUCs that are single terms, no quotes for names that are
obviously parameters).

Yeah, this is pretty much the patch I proposed earlier.

In terms of messages that have predictible names, 0002 moves in the
needle in the right direction. There seem to be more:
src/backend/postmaster/bgworker.c: errhint("Consider increasing the
configuration parameter \"max_worker_processes\".")));
contrib/pg_prewarm/autoprewarm.c: errhint("Consider increasing
configuration parameter \"max_worker_processes\".")));

Yeah. Also, these could be changed to have the GUC name outside the
message proper, which would reduce the total number of messages. (But
care must be given to the word "the" there.)

I had posted something similar a few posts back [1]/messages/by-id/CAHut+Pv8VG7fvXzg5PNeQuUhJG17xwCWNpZSUUkN11ArV==Cdg@mail.gmail.com, but it just
caused more questions unrelated to GUC name quotes so I abandoned that
temporarily.

So for now, I hope this thread can be only about quotes on GUC names,
otherwise, I thought it may become stuck debating dozens of individual
messages. Certainly later, or in another thread, we can revisit all
messages again to try to identify/extract any "common" ones.

Things like parse_and_validate_value() and set_config_option_ext()
include log strings about GUC and these use quotes. Could these areas
be made smarter with a routine to check if quotes are applied
automatically when we have a "simple" GUC name, aka I guess made of
only lower-case characters? This could be done with a islower() on
the string name, for instance.

I think we could leave these improvements for a second round. They
don't need to hold back the improvement we already have.

I tried something for this already but kept it in a separate patch. See v2-0003

======
[1]: /messages/by-id/CAHut+Pv8VG7fvXzg5PNeQuUhJG17xwCWNpZSUUkN11ArV==Cdg@mail.gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia

#24Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#23)
Re: GUC names in messages

On Mon, Nov 27, 2023 at 10:04:35AM +1100, Peter Smith wrote:

On Fri, Nov 24, 2023 at 8:53 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

Yeah. Also, these could be changed to have the GUC name outside the
message proper, which would reduce the total number of messages. (But
care must be given to the word "the" there.)

I had posted something similar a few posts back [1], but it just
caused more questions unrelated to GUC name quotes so I abandoned that
temporarily.

Yes, I kind of agree to let that out of the picture for the moment.
It would be good to reduce the translation chunks.

So for now, I hope this thread can be only about quotes on GUC names,
otherwise, I thought it may become stuck debating dozens of individual
messages. Certainly later, or in another thread, we can revisit all
messages again to try to identify/extract any "common" ones.

-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting. 

Is the change for "datestyle" really required? It does not betray the
GUC quoting policy added by 0001.

I think we could leave these improvements for a second round. They
don't need to hold back the improvement we already have.

I tried something for this already but kept it in a separate patch. See v2-0003

+               if (*p == '_')
+                       underscore = true;

Is there a reason why we don't just use islower() or is that just to
get something entirely local independent? I am not sure that it needs
to be that complicated. We should just check that all the characters
are lower-case and apply quotes.
--
Michael

#25Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#24)
Re: GUC names in messages

Michael Paquier <michael@paquier.xyz> writes:

Is there a reason why we don't just use islower() or is that just to
get something entirely local independent?

islower() and related functions are not to be trusted for this
purpose. They will certainly give locale-dependent results,
and they might give entirely wrong ones if there's any inconsistency
between the database encoding and what libc thinks the locale is.

regards, tom lane

#26Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#24)
Re: GUC names in messages

On Mon, Nov 27, 2023 at 12:44 PM Michael Paquier <michael@paquier.xyz> wrote:

On Mon, Nov 27, 2023 at 10:04:35AM +1100, Peter Smith wrote:

On Fri, Nov 24, 2023 at 8:53 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

Yeah. Also, these could be changed to have the GUC name outside the
message proper, which would reduce the total number of messages. (But
care must be given to the word "the" there.)

I had posted something similar a few posts back [1], but it just
caused more questions unrelated to GUC name quotes so I abandoned that
temporarily.

Yes, I kind of agree to let that out of the picture for the moment.
It would be good to reduce the translation chunks.

So for now, I hope this thread can be only about quotes on GUC names,
otherwise, I thought it may become stuck debating dozens of individual
messages. Certainly later, or in another thread, we can revisit all
messages again to try to identify/extract any "common" ones.

-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.

Is the change for "datestyle" really required? It does not betray the
GUC quoting policy added by 0001.

TBH, I suspect something fishy about these mixed-case GUCs.

In the documentation and in the guc_tables.c they are all described in
MixedCase (e.g. "DateStyle" instead of "datestyle"), so I felt the
messages should use the same case the documentation, which is why I
changed all the ones you are referring to.

I know the code is doing a case-insensitive hashtable lookup but I
suspect some of the string passing still in the code for those
particular GUCs ought to be using the same mixed case string literal
as in the guc_tables.c. Currently, I have seen a few quirks where the
case is inconsistent with the MixedCase docs. It needs some more
investigation to understand the reason. For example,

2023-11-27 11:03:48.565 AEDT [15303] STATEMENT: set intervalstyle=123;
ERROR: invalid value for parameter "intervalstyle": "123"

versus

2023-11-27 11:13:56.018 AEDT [15303] STATEMENT: set datestyle=123;
ERROR: invalid value for parameter DateStyle: "123"

I think we could leave these improvements for a second round. They
don't need to hold back the improvement we already have.

I tried something for this already but kept it in a separate patch. See v2-0003

+               if (*p == '_')
+                       underscore = true;

Is there a reason why we don't just use islower() or is that just to
get something entirely local independent? I am not sure that it needs
to be that complicated. We should just check that all the characters
are lower-case and apply quotes.

Thanks for the feedback. Probably I have overcomplicated it. I'll revisit it.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#27Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#26)
Re: GUC names in messages[

On Mon, Nov 27, 2023 at 01:41:18PM +1100, Peter Smith wrote:

TBH, I suspect something fishy about these mixed-case GUCs.

In the documentation and in the guc_tables.c they are all described in
MixedCase (e.g. "DateStyle" instead of "datestyle"), so I felt the
messages should use the same case the documentation, which is why I
changed all the ones you are referring to.

FWIW, I've been tempted for a few years to propose that we should keep
the parsers as they behave now, but format the name of these
parameters in the code and the docs to just be lower-case all the
time.

Is there a reason why we don't just use islower() or is that just to
get something entirely local independent? I am not sure that it needs
to be that complicated. We should just check that all the characters
are lower-case and apply quotes.

Thanks for the feedback. Probably I have overcomplicated it. I'll revisit it.

The use of a static variable with a fixed size was itching me a bit as
well.. I was wondering if it would be cleaner to use %s%s%s in the
strings adding a note that these are GUC names that may be optionally
quoted, then hide what gets assigned in a macro with a result rather
similar to LSN_FORMAT_ARGS (GUC_FORMAT?). The routine checking if
quotes should be applied would only need to return a boolean to tell
what to do, and could be hidden in the macro.
--
Michael

#28Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Peter Smith (#26)
Re: GUC names in messages

On Mon, 2023-11-27 at 13:41 +1100, Peter Smith wrote:

TBH, I suspect something fishy about these mixed-case GUCs.

In the documentation and in the guc_tables.c they are all described in
MixedCase (e.g. "DateStyle" instead of "datestyle"), so I felt the
messages should use the same case the documentation, which is why I
changed all the ones you are referring to.

I agree with that decision; we should use mixed case for these parameters.

Otherwise we might get complaints that the following query does not return
any results:

SELECT * FROM pg_settings WHERE name = 'timezone';

Yours,
Laurenz Albe

#29Tom Lane
tgl@sss.pgh.pa.us
In reply to: Laurenz Albe (#28)
Re: GUC names in messages

Laurenz Albe <laurenz.albe@cybertec.at> writes:

On Mon, 2023-11-27 at 13:41 +1100, Peter Smith wrote:

In the documentation and in the guc_tables.c they are all described in
MixedCase (e.g. "DateStyle" instead of "datestyle"), so I felt the
messages should use the same case the documentation, which is why I
changed all the ones you are referring to.

I agree with that decision; we should use mixed case for these parameters.
Otherwise we might get complaints that the following query does not return
any results:
SELECT * FROM pg_settings WHERE name = 'timezone';

Yeah. Like Michael upthread, I've wondered occasionally about changing
these names to all-lower-case. It'd surely be nicer if we'd done it
like that to begin with. But I can't convince myself that the ensuing
user pain would be justified.

regards, tom lane

#30Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#29)
Re: GUC names in messages

On Mon, Nov 27, 2023 at 01:35:44AM -0500, Tom Lane wrote:

Laurenz Albe <laurenz.albe@cybertec.at> writes:

On Mon, 2023-11-27 at 13:41 +1100, Peter Smith wrote:

In the documentation and in the guc_tables.c they are all described in
MixedCase (e.g. "DateStyle" instead of "datestyle"), so I felt the
messages should use the same case the documentation, which is why I
changed all the ones you are referring to.

I agree with that decision; we should use mixed case for these parameters.
Otherwise we might get complaints that the following query does not return
any results:
SELECT * FROM pg_settings WHERE name = 'timezone';

(I'm sure that you mean the opposite. This query does not return any
results on HEAD, but it would with "TimeZone".)

Yeah. Like Michael upthread, I've wondered occasionally about changing
these names to all-lower-case. It'd surely be nicer if we'd done it
like that to begin with. But I can't convince myself that the ensuing
user pain would be justified.

Perhaps not. I'd like to think that a lot of queries on pg_settings
have the wisdom to apply a lower() or upper(), but that's very
unlikely.

-    errhint("Perhaps you need a different \"datestyle\" setting.")));
+    errhint("Perhaps you need a different DateStyle setting.")));

Saying that, I'd let this one be in 0002. It causes a log of diff
churn in the tests and quoting it based on Alvaro's suggestion would
still be correct because it's fully lower-case. (Yeah, I'm perhaps
nit-ing here, so feel free to counter-argue if you prefer what the
patch does.)
--
Michael

#31Peter Smith
smithpb2250@gmail.com
In reply to: Peter Smith (#22)
3 attachment(s)
Re: GUC names in messages

Here is patch set v3.

Patches 0001 and 0002 are unchanged from v2.

Patch 0003 now uses a "%s%s%s" format specifier with GUC_FORMAT macro
in guc.c, as recently suggested by Michael [1]/messages/by-id/ZWQVxu8zWIx64V7l@paquier.xyz.

~

(Meanwhile, the MixedCase stuff is still an open question, to be
addressed in a later patch version)

======
[1]: /messages/by-id/ZWQVxu8zWIx64V7l@paquier.xyz

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v3-0001-GUC-names-docs.patchapplication/octet-stream; name=v3-0001-GUC-names-docs.patchDownload
From 7306abf3fc40f841c252778e7e10009f16c6e16a Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 Nov 2023 09:32:24 +1100
Subject: [PATCH v3] GUC names - docs

---
 doc/src/sgml/sources.sgml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index 06d995e..45ad706 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -539,6 +539,14 @@ Hint:       The addendum, written as a complete sentence.
    </para>
 
    <para>
+    In messages containing configuration variable names, do not include quotes
+    when the names are visibly not English natural words, such as when they
+    have underscores or are all-uppercase or have mixed case. Otherwise, quotes
+    must be added.  Do include quotes in a message where an arbitrary variable
+    name is to be expanded.
+   </para>
+
+   <para>
     There are functions in the backend that will double-quote their own output
     as needed (for example, <function>format_type_be()</function>).  Do not put
     additional quotes around the output of such functions.
-- 
1.8.3.1

v3-0003-GUC-names-maybe-add-quotes.patchapplication/octet-stream; name=v3-0003-GUC-names-maybe-add-quotes.patchDownload
From 255eeb624d6d3493d82cbd152c9c714cc68dad4b Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 Nov 2023 11:49:04 +1100
Subject: [PATCH v3] GUC names - maybe add quotes

---
 src/backend/utils/misc/guc.c                       | 273 ++++++++++++++-------
 .../test_oat_hooks/expected/test_oat_hooks.out     |   4 +-
 .../modules/unsafe_tests/expected/guc_privs.out    |  54 ++--
 .../modules/unsafe_tests/expected/rolenames.out    |   2 +-
 src/test/regress/expected/compression.out          |   4 +-
 src/test/regress/expected/compression_1.out        |   6 +-
 src/test/regress/expected/create_am.out            |   4 +-
 src/test/regress/expected/guc.out                  |  10 +-
 src/test/regress/expected/password.out             |   4 +-
 src/test/regress/expected/subscription.out         |   2 +-
 src/test/regress/expected/transactions.out         |   8 +-
 11 files changed, 233 insertions(+), 138 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e76c083..248d2cb 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -265,6 +265,45 @@ static bool call_string_check_hook(struct config_string *conf, char **newval,
 static bool call_enum_check_hook(struct config_enum *conf, int *newval,
 								 void **extra, GucSource source, int elevel);
 
+/* Handy macro for adding optional quotes to GUC names during substitution. */
+#define GUC_FORMAT(s)\
+	quotes_needed_for_GUC_name(s) ? "\"" : "",\
+	s,\
+	quotes_needed_for_GUC_name(s) ? "\"" : ""
+
+/*
+ * Return whether the GUC name should be enclosed in double-quotes.
+ *
+ * Quoting is intended for names which potential could be mistaken for
+ * normal English words.
+ *
+ * - Lowercase alpha needs quotes unless there are underscores
+ * - Upper/mixed case alpha does not need quotes
+ * - Anything else needs quotes
+ */
+static
+bool
+quotes_needed_for_GUC_name(const char *name)
+{
+	bool underscore = false;
+	bool lowercase = false;
+	bool uppercase = false;
+	bool other = false;
+
+	for (const char *p = name; *p; p++)
+	{
+		if (*p == '_')
+			underscore = true;
+		else if ('a' <= *p && *p <= 'z')
+			lowercase = true;
+		else if ('A' <= *p && *p <= 'Z')
+			uppercase = true;
+		else
+			other = true;
+	}
+
+	return other || (lowercase && !underscore && !uppercase);
+}
 
 /*
  * This function handles both actual config file (re)loads and execution of
@@ -420,8 +459,9 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			/* Invalid non-custom variable, so complain */
 			ereport(elevel,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
-					 errmsg("unrecognized configuration parameter \"%s\" in file \"%s\" line %d",
-							item->name,
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("unrecognized configuration parameter %s%s%s in file \"%s\" line %d",
+							GUC_FORMAT(item->name),
 							item->filename, item->sourceline)));
 			item->errmsg = pstrdup("unrecognized configuration parameter");
 			error = true;
@@ -460,10 +500,13 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			gconf->status |= GUC_PENDING_RESTART;
 			ereport(elevel,
 					(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-					 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-							gconf->name)));
-			record_config_file_error(psprintf("parameter \"%s\" cannot be changed without restarting the server",
-											  gconf->name),
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+							GUC_FORMAT(gconf->name))));
+			record_config_file_error(
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+									 psprintf("parameter %s%s%s cannot be changed without restarting the server",
+											  GUC_FORMAT(gconf->name)),
 									 NULL, 0,
 									 &head, &tail);
 			error = true;
@@ -496,8 +539,9 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			/* Log the change if appropriate */
 			if (context == PGC_SIGHUP)
 				ereport(elevel,
-						(errmsg("parameter \"%s\" removed from configuration file, reset to default",
-								gconf->name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						(errmsg("parameter %s%s%s removed from configuration file, reset to default",
+								GUC_FORMAT(gconf->name))));
 		}
 	}
 
@@ -561,8 +605,10 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 					post_value = "";
 				if (strcmp(pre_value, post_value) != 0)
 					ereport(elevel,
-							(errmsg("parameter \"%s\" changed to \"%s\"",
-									item->name, item->value)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							(errmsg("parameter %s%s%s changed to \"%s\"",
+									GUC_FORMAT(item->name),
+									item->value)));
 			}
 			item->applied = true;
 		}
@@ -1129,8 +1175,9 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 			if (!skip_errors)
 				ereport(elevel,
 						(errcode(ERRCODE_INVALID_NAME),
-						 errmsg("invalid configuration parameter name \"%s\"",
-								name),
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("invalid configuration parameter name %s%s%s",
+								GUC_FORMAT(name)),
 						 errdetail("Custom parameter names must be two or more simple identifiers separated by dots.")));
 			return false;
 		}
@@ -1145,8 +1192,9 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 				if (!skip_errors)
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_NAME),
-							 errmsg("invalid configuration parameter name \"%s\"",
-									name),
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid configuration parameter name %s%s%s",
+									GUC_FORMAT(name)),
 							 errdetail("\"%s\" is a reserved prefix.",
 									   rcprefix)));
 				return false;
@@ -1160,8 +1208,9 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 	if (!skip_errors)
 		ereport(elevel,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
-				 errmsg("unrecognized configuration parameter \"%s\"",
-						name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("unrecognized configuration parameter %s%s%s",
+						GUC_FORMAT(name))));
 	return false;
 }
 
@@ -1270,8 +1319,9 @@ find_option(const char *name, bool create_placeholders, bool skip_errors,
 	if (!skip_errors)
 		ereport(elevel,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
-				 errmsg("unrecognized configuration parameter \"%s\"",
-						name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("unrecognized configuration parameter %s%s%s",
+						GUC_FORMAT(name))));
 	return NULL;
 }
 
@@ -3125,8 +3175,9 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("parameter \"%s\" requires a Boolean value",
-									name)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("parameter %s%s%s requires a Boolean value",
+									GUC_FORMAT(name))));
 					return false;
 				}
 
@@ -3145,8 +3196,9 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3157,11 +3209,12 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("%d%s%s is outside the valid range for parameter \"%s\" (%d .. %d)",
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("%d%s%s is outside the valid range for parameter %s%s%s (%d .. %d)",
 									newval->intval,
 									unit ? " " : "",
 									unit ? unit : "",
-									name,
+									GUC_FORMAT(name),
 									conf->min, conf->max)));
 					return false;
 				}
@@ -3181,8 +3234,9 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3193,11 +3247,12 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("%g%s%s is outside the valid range for parameter \"%s\" (%g .. %g)",
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("%g%s%s is outside the valid range for parameter %s%s%s (%g .. %g)",
 									newval->realval,
 									unit ? " " : "",
 									unit ? unit : "",
-									name,
+									GUC_FORMAT(name),
 									conf->min, conf->max)));
 					return false;
 				}
@@ -3251,8 +3306,9 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
@@ -3410,8 +3466,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 			break;
@@ -3433,8 +3490,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 			break;
@@ -3443,8 +3501,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed now",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed now",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 
@@ -3470,8 +3529,9 @@ set_config_option_ext(const char *name, const char *value,
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("permission denied to set parameter %s%s%s",
+									GUC_FORMAT(name))));
 					return 0;
 				}
 			}
@@ -3508,8 +3568,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be set after connection start",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be set after connection start",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 			break;
@@ -3528,8 +3589,9 @@ set_config_option_ext(const char *name, const char *value,
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("permission denied to set parameter %s%s%s",
+									GUC_FORMAT(name))));
 					return 0;
 				}
 			}
@@ -3567,16 +3629,18 @@ set_config_option_ext(const char *name, const char *value,
 			 */
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-					 errmsg("cannot set parameter \"%s\" within security-definer function",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("cannot set parameter %s%s%s within security-definer function",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 		if (InSecurityRestrictedOperation())
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-					 errmsg("cannot set parameter \"%s\" within security-restricted operation",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("cannot set parameter %s%s%s within security-restricted operation",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 	}
@@ -3588,15 +3652,18 @@ set_config_option_ext(const char *name, const char *value,
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be reset", name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s cannot be reset",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 		if (action == GUC_ACTION_SAVE)
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be set locally in functions",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s cannot be set locally in functions",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 	}
@@ -3621,8 +3688,8 @@ set_config_option_ext(const char *name, const char *value,
 	{
 		if (changeVal && !makeDefault)
 		{
-			elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority",
-				 name);
+			elog(DEBUG3, "%s%s%s: setting ignored because previous source is higher priority",
+				 GUC_FORMAT(name));
 			return -1;
 		}
 		changeVal = false;
@@ -3673,8 +3740,9 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+						/* translator: %s%s%s is for an optionally quoted GUC name */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3771,8 +3839,9 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+						/* translator: %s%s%s is for an optionally quoted GUC name */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3869,8 +3938,9 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+						/* translator: %s%s%s is for an optionally quoted GUC name */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3993,8 +4063,9 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+						/* translator: %s%s%s is for an optionally quoted GUC name */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4096,8 +4167,9 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+						/* translator: %s%s%s is for an optionally quoted GUC name */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4238,7 +4310,9 @@ GetConfigOption(const char *name, bool missing_ok, bool restrict_privileged)
 		!ConfigOptionIsVisible(record))
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to examine \"%s\"", name),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("permission denied to examine %s%s%s",
+						GUC_FORMAT(name)),
 				 errdetail("Only roles with privileges of the \"%s\" role may examine this parameter.",
 						   "pg_read_all_settings")));
 
@@ -4534,8 +4608,9 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 			if (aclresult != ACLCHECK_OK)
 				ereport(ERROR,
 						(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-						 errmsg("permission denied to set parameter \"%s\"",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("permission denied to set parameter %s%s%s",
+								GUC_FORMAT(name))));
 		}
 	}
 
@@ -4559,8 +4634,9 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 				(record->flags & GUC_DISALLOW_IN_AUTO_FILE))
 				ereport(ERROR,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed",
+								GUC_FORMAT(name))));
 
 			/*
 			 * If a value is specified, verify that it's sane.
@@ -4575,8 +4651,9 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 											  &newval, &newextra))
 					ereport(ERROR,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value)));
 
 				if (record->vartype == PGC_STRING && newval.stringval != NULL)
 					guc_free(newval.stringval);
@@ -4830,7 +4907,9 @@ define_custom_variable(struct config_generic *variable)
 	if ((hentry->gucvar->flags & GUC_CUSTOM_PLACEHOLDER) == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_INTERNAL_ERROR),
-				 errmsg("attempt to redefine parameter \"%s\"", name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("attempt to redefine parameter %s%s%s",
+						GUC_FORMAT(name))));
 
 	Assert(hentry->gucvar->vartype == PGC_STRING);
 	pHolder = (struct config_string *) hentry->gucvar;
@@ -5169,8 +5248,9 @@ MarkGUCPrefixReserved(const char *className)
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("invalid configuration parameter name \"%s\", removing it",
-							var->name),
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("invalid configuration parameter name %s%s%s, removing it",
+							GUC_FORMAT(var->name)),
 					 errdetail("\"%s\" is now a reserved prefix.",
 							   className)));
 			/* Remove it from the hash table */
@@ -5313,7 +5393,9 @@ GetConfigOptionByName(const char *name, const char **varname, bool missing_ok)
 	if (!ConfigOptionIsVisible(record))
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to examine \"%s\"", name),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("permission denied to examine %s%s%s",
+						GUC_FORMAT(name)),
 				 errdetail("Only roles with privileges of the \"%s\" role may examine this parameter.",
 						   "pg_read_all_settings")));
 
@@ -5639,7 +5721,8 @@ read_nondefault_variables(void)
 			break;
 
 		if (find_option(varname, true, false, FATAL) == NULL)
-			elog(FATAL, "failed to locate variable \"%s\" in exec config params file", varname);
+			elog(FATAL, "failed to locate variable %s%s%s in exec config params file",
+				 GUC_FORMAT(varname));
 
 		if ((varvalue = read_string_with_null(fp)) == NULL)
 			elog(FATAL, "invalid format of exec config params file");
@@ -6048,8 +6131,9 @@ guc_restore_error_context_callback(void *arg)
 	char	  **error_context_name_and_value = (char **) arg;
 
 	if (error_context_name_and_value)
-		errcontext("while setting parameter \"%s\" to \"%s\"",
-				   error_context_name_and_value[0],
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+		errcontext("while setting parameter %s%s%s to \"%s\"",
+				   GUC_FORMAT(error_context_name_and_value[0]),
 				   error_context_name_and_value[1]);
 }
 
@@ -6217,7 +6301,9 @@ RestoreGUCState(void *gucstate)
 		if (result <= 0)
 			ereport(ERROR,
 					(errcode(ERRCODE_INTERNAL_ERROR),
-					 errmsg("parameter \"%s\" could not be set", varname)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s could not be set",
+							GUC_FORMAT(varname))));
 		if (varsourcefile[0])
 			set_config_sourcefile(varname, varsourcefile, varsourceline);
 		error_context_callback.arg = NULL;
@@ -6307,8 +6393,9 @@ TransformGUCArray(ArrayType *array, List **names, List **values)
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_SYNTAX_ERROR),
-					 errmsg("could not parse setting for parameter \"%s\"",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("could not parse setting for parameter %s%s%s",
+							GUC_FORMAT(name))));
 			pfree(name);
 			continue;
 		}
@@ -6625,7 +6712,9 @@ validate_option_array_item(const char *name, const char *value,
 			return false;
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to set parameter \"%s\"", name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("permission denied to set parameter %s%s%s",
+						GUC_FORMAT(name))));
 	}
 
 	/* manual permissions check so we can avoid an error being thrown */
@@ -6689,8 +6778,9 @@ call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %d",
-						conf->gen.name, (int) *newval),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: %d",
+						GUC_FORMAT(conf->gen.name), (int) *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6723,8 +6813,9 @@ call_int_check_hook(struct config_int *conf, int *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %d",
-						conf->gen.name, *newval),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: %d",
+						GUC_FORMAT(conf->gen.name), *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6757,8 +6848,9 @@ call_real_check_hook(struct config_real *conf, double *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %g",
-						conf->gen.name, *newval),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: %g",
+						GUC_FORMAT(conf->gen.name), *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6800,8 +6892,10 @@ call_string_check_hook(struct config_string *conf, char **newval, void **extra,
 					(errcode(GUC_check_errcode_value),
 					 GUC_check_errmsg_string ?
 					 errmsg_internal("%s", GUC_check_errmsg_string) :
-					 errmsg("invalid value for parameter \"%s\": \"%s\"",
-							conf->gen.name, *newval ? *newval : ""),
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+							GUC_FORMAT(conf->gen.name),
+							*newval ? *newval : ""),
 					 GUC_check_errdetail_string ?
 					 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 					 GUC_check_errhint_string ?
@@ -6841,8 +6935,9 @@ call_enum_check_hook(struct config_enum *conf, int *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": \"%s\"",
-						conf->gen.name,
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+						GUC_FORMAT(conf->gen.name),
 						config_enum_lookup_by_value(conf, *newval)),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
diff --git a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
index f80373a..ccaa65e 100644
--- a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
+++ b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
@@ -180,10 +180,10 @@ NOTICE:  in object_access_hook_str: non-superuser finished alter (subId=0x1000,
 NOTICE:  in process utility: non-superuser finished RESET
 ALTER SYSTEM SET work_mem = 8192;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "work_mem"
+ERROR:  permission denied to set parameter work_mem
 ALTER SYSTEM RESET work_mem;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "work_mem"
+ERROR:  permission denied to set parameter work_mem
 SET test_oat_hooks.user_var1 = true;
 NOTICE:  in process utility: non-superuser attempting SET
 NOTICE:  in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var1]
diff --git a/src/test/modules/unsafe_tests/expected/guc_privs.out b/src/test/modules/unsafe_tests/expected/guc_privs.out
index 6c0ad89..5ed2113 100644
--- a/src/test/modules/unsafe_tests/expected/guc_privs.out
+++ b/src/test/modules/unsafe_tests/expected/guc_privs.out
@@ -8,31 +8,31 @@ CREATE ROLE regress_admin SUPERUSER;
 SET SESSION AUTHORIZATION regress_admin;
 -- PGC_BACKEND
 SET ignore_system_indexes = OFF;  -- fail, cannot be set after connection start
-ERROR:  parameter "ignore_system_indexes" cannot be set after connection start
+ERROR:  parameter ignore_system_indexes cannot be set after connection start
 RESET ignore_system_indexes;  -- fail, cannot be set after connection start
-ERROR:  parameter "ignore_system_indexes" cannot be set after connection start
+ERROR:  parameter ignore_system_indexes cannot be set after connection start
 ALTER SYSTEM SET ignore_system_indexes = OFF;  -- ok
 ALTER SYSTEM RESET ignore_system_indexes;  -- ok
 -- PGC_INTERNAL
 SET block_size = 50;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 RESET block_size;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 ALTER SYSTEM SET block_size = 50;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 ALTER SYSTEM RESET block_size;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 -- PGC_POSTMASTER
 SET autovacuum_freeze_max_age = 1000050000;  -- fail, requires restart
-ERROR:  parameter "autovacuum_freeze_max_age" cannot be changed without restarting the server
+ERROR:  parameter autovacuum_freeze_max_age cannot be changed without restarting the server
 RESET autovacuum_freeze_max_age;  -- fail, requires restart
-ERROR:  parameter "autovacuum_freeze_max_age" cannot be changed without restarting the server
+ERROR:  parameter autovacuum_freeze_max_age cannot be changed without restarting the server
 ALTER SYSTEM SET autovacuum_freeze_max_age = 1000050000;  -- ok
 ALTER SYSTEM RESET autovacuum_freeze_max_age;  -- ok
 ALTER SYSTEM SET config_file = '/usr/local/data/postgresql.conf';  -- fail, cannot be changed
-ERROR:  parameter "config_file" cannot be changed
+ERROR:  parameter config_file cannot be changed
 ALTER SYSTEM RESET config_file;  -- fail, cannot be changed
-ERROR:  parameter "config_file" cannot be changed
+ERROR:  parameter config_file cannot be changed
 -- PGC_SIGHUP
 SET autovacuum = OFF;  -- fail, requires reload
 ERROR:  parameter "autovacuum" cannot be changed now
@@ -47,9 +47,9 @@ ALTER SYSTEM SET lc_messages = 'C';  -- ok
 ALTER SYSTEM RESET lc_messages;  -- ok
 -- PGC_SU_BACKEND
 SET jit_debugging_support = OFF;  -- fail, cannot be set after connection start
-ERROR:  parameter "jit_debugging_support" cannot be set after connection start
+ERROR:  parameter jit_debugging_support cannot be set after connection start
 RESET jit_debugging_support;  -- fail, cannot be set after connection start
-ERROR:  parameter "jit_debugging_support" cannot be set after connection start
+ERROR:  parameter jit_debugging_support cannot be set after connection start
 ALTER SYSTEM SET jit_debugging_support = OFF;  -- ok
 ALTER SYSTEM RESET jit_debugging_support;  -- ok
 -- PGC_USERSET
@@ -58,9 +58,9 @@ RESET DateStyle;  -- ok
 ALTER SYSTEM SET DateStyle = 'ISO, MDY';  -- ok
 ALTER SYSTEM RESET DateStyle;  -- ok
 ALTER SYSTEM SET ssl_renegotiation_limit = 0;  -- fail, cannot be changed
-ERROR:  parameter "ssl_renegotiation_limit" cannot be changed
+ERROR:  parameter ssl_renegotiation_limit cannot be changed
 ALTER SYSTEM RESET ssl_renegotiation_limit;  -- fail, cannot be changed
-ERROR:  parameter "ssl_renegotiation_limit" cannot be changed
+ERROR:  parameter ssl_renegotiation_limit cannot be changed
 -- Finished testing superuser
 -- Create non-superuser with privileges to configure host resource usage
 CREATE ROLE regress_host_resource_admin NOSUPERUSER;
@@ -244,7 +244,7 @@ SHOW none.such;
 
 -- Can't grant on a non-existent core GUC.
 GRANT ALL ON PARAMETER no_such_guc TO regress_host_resource_admin;  -- fail
-ERROR:  unrecognized configuration parameter "no_such_guc"
+ERROR:  unrecognized configuration parameter no_such_guc
 -- Initially there are no privileges and no catalog entry for this GUC.
 SELECT has_parameter_privilege('regress_host_resource_admin', 'enable_material', 'SET');
  has_parameter_privilege 
@@ -446,17 +446,17 @@ ALTER ROLE regress_host_resource_admin SET lc_messages = 'C';
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- ok, privileges have been granted
 ALTER SYSTEM SET ignore_system_indexes = OFF;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "ignore_system_indexes"
+ERROR:  permission denied to set parameter ignore_system_indexes
 ALTER SYSTEM RESET autovacuum_multixact_freeze_max_age;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "autovacuum_multixact_freeze_max_age"
+ERROR:  permission denied to set parameter autovacuum_multixact_freeze_max_age
 SET jit_provider = 'llvmjit';  -- fail, insufficient privileges
-ERROR:  parameter "jit_provider" cannot be changed without restarting the server
+ERROR:  parameter jit_provider cannot be changed without restarting the server
 SELECT set_config ('jit_provider', 'llvmjit', true); -- fail, insufficient privileges
-ERROR:  parameter "jit_provider" cannot be changed without restarting the server
+ERROR:  parameter jit_provider cannot be changed without restarting the server
 ALTER SYSTEM SET shared_buffers = 50;  -- ok
 ALTER SYSTEM RESET shared_buffers;  -- ok
 SET autovacuum_work_mem = 50;  -- cannot be changed now
-ERROR:  parameter "autovacuum_work_mem" cannot be changed now
+ERROR:  parameter autovacuum_work_mem cannot be changed now
 ALTER SYSTEM RESET temp_file_limit;  -- ok
 SET TimeZone = 'Europe/Helsinki';  -- ok
 RESET TimeZone;  -- ok
@@ -465,13 +465,13 @@ RESET max_stack_depth;  -- ok, privileges have been granted
 ALTER SYSTEM SET max_stack_depth = '100kB';  -- ok, privileges have been granted
 ALTER SYSTEM RESET max_stack_depth;  -- ok, privileges have been granted
 SET lc_messages = 'C';  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 RESET lc_messages;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER SYSTEM SET lc_messages = 'C';  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER SYSTEM RESET lc_messages;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 SELECT set_config ('temp_buffers', '8192', false); -- ok
  set_config 
 ------------
@@ -484,7 +484,7 @@ ERROR:  permission denied to perform ALTER SYSTEM RESET ALL
 ALTER SYSTEM SET none.such2 = 'whiz bang';  -- fail, not superuser
 ERROR:  permission denied to set parameter "none.such2"
 ALTER ROLE regress_host_resource_admin SET lc_messages = 'POSIX';  -- fail
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER ROLE regress_host_resource_admin SET max_stack_depth = '1MB';  -- ok
 SELECT setconfig FROM pg_db_role_setting
   WHERE setrole = 'regress_host_resource_admin'::regrole;
@@ -537,7 +537,7 @@ DROP ROLE regress_host_resource_admin;  -- ok
 CREATE ROLE regress_host_resource_admin NOSUPERUSER;
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- fail, privileges not yet granted
-ERROR:  permission denied to set parameter "autovacuum_work_mem"
+ERROR:  permission denied to set parameter autovacuum_work_mem
 SET SESSION AUTHORIZATION regress_admin;
 GRANT SET, ALTER SYSTEM ON PARAMETER
     autovacuum_work_mem, hash_mem_multiplier, max_stack_depth,
@@ -554,7 +554,7 @@ privileges for parameter work_mem
 DROP OWNED BY regress_host_resource_admin RESTRICT; -- cascade should not be needed
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- fail, "drop owned" has dropped privileges
-ERROR:  permission denied to set parameter "autovacuum_work_mem"
+ERROR:  permission denied to set parameter autovacuum_work_mem
 SET SESSION AUTHORIZATION regress_admin;
 DROP ROLE regress_host_resource_admin;  -- ok
 -- Check that "reassign owned" doesn't affect privileges
diff --git a/src/test/modules/unsafe_tests/expected/rolenames.out b/src/test/modules/unsafe_tests/expected/rolenames.out
index 61396b2..21d2bac 100644
--- a/src/test/modules/unsafe_tests/expected/rolenames.out
+++ b/src/test/modules/unsafe_tests/expected/rolenames.out
@@ -1077,7 +1077,7 @@ SHOW session_preload_libraries;
 SET SESSION AUTHORIZATION regress_role_nopriv;
 -- fails with role not member of pg_read_all_settings
 SHOW session_preload_libraries;
-ERROR:  permission denied to examine "session_preload_libraries"
+ERROR:  permission denied to examine session_preload_libraries
 DETAIL:  Only roles with privileges of the "pg_read_all_settings" role may examine this parameter.
 RESET SESSION AUTHORIZATION;
 ERROR:  current transaction is aborted, commands ignored until end of transaction block
diff --git a/src/test/regress/expected/compression.out b/src/test/regress/expected/compression.out
index 834b755..7426504 100644
--- a/src/test/regress/expected/compression.out
+++ b/src/test/regress/expected/compression.out
@@ -234,10 +234,10 @@ ERROR:  column "f1" has a compression method conflict
 DETAIL:  pglz versus lz4
 -- test default_toast_compression GUC
 SET default_toast_compression = '';
-ERROR:  invalid value for parameter "default_toast_compression": ""
+ERROR:  invalid value for parameter default_toast_compression: ""
 HINT:  Available values: pglz, lz4.
 SET default_toast_compression = 'I do not exist compression';
-ERROR:  invalid value for parameter "default_toast_compression": "I do not exist compression"
+ERROR:  invalid value for parameter default_toast_compression: "I do not exist compression"
 HINT:  Available values: pglz, lz4.
 SET default_toast_compression = 'lz4';
 SET default_toast_compression = 'pglz';
diff --git a/src/test/regress/expected/compression_1.out b/src/test/regress/expected/compression_1.out
index ddcd137..5234e47 100644
--- a/src/test/regress/expected/compression_1.out
+++ b/src/test/regress/expected/compression_1.out
@@ -225,13 +225,13 @@ ERROR:  column "f1" has a compression method conflict
 DETAIL:  pglz versus lz4
 -- test default_toast_compression GUC
 SET default_toast_compression = '';
-ERROR:  invalid value for parameter "default_toast_compression": ""
+ERROR:  invalid value for parameter default_toast_compression: ""
 HINT:  Available values: pglz.
 SET default_toast_compression = 'I do not exist compression';
-ERROR:  invalid value for parameter "default_toast_compression": "I do not exist compression"
+ERROR:  invalid value for parameter default_toast_compression: "I do not exist compression"
 HINT:  Available values: pglz.
 SET default_toast_compression = 'lz4';
-ERROR:  invalid value for parameter "default_toast_compression": "lz4"
+ERROR:  invalid value for parameter default_toast_compression: "lz4"
 HINT:  Available values: pglz.
 SET default_toast_compression = 'pglz';
 -- test alter compression method
diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out
index b50293d..afa11a6 100644
--- a/src/test/regress/expected/create_am.out
+++ b/src/test/regress/expected/create_am.out
@@ -112,11 +112,11 @@ COMMIT;
 --
 -- prevent empty values
 SET default_table_access_method = '';
-ERROR:  invalid value for parameter "default_table_access_method": ""
+ERROR:  invalid value for parameter default_table_access_method: ""
 DETAIL:  default_table_access_method cannot be empty.
 -- prevent nonexistent values
 SET default_table_access_method = 'I do not exist AM';
-ERROR:  invalid value for parameter "default_table_access_method": "I do not exist AM"
+ERROR:  invalid value for parameter default_table_access_method: "I do not exist AM"
 DETAIL:  Table access method "I do not exist AM" does not exist.
 -- prevent setting it to an index AM
 SET default_table_access_method = 'btree';
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 127c953..cbf4e8f 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -508,11 +508,11 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
 
 -- Test some simple error cases
 SET seq_page_cost TO 'NaN';
-ERROR:  invalid value for parameter "seq_page_cost": "NaN"
+ERROR:  invalid value for parameter seq_page_cost: "NaN"
 SET vacuum_cost_delay TO '10s';
-ERROR:  10000 ms is outside the valid range for parameter "vacuum_cost_delay" (0 .. 100)
+ERROR:  10000 ms is outside the valid range for parameter vacuum_cost_delay (0 .. 100)
 SET no_such_variable TO 42;
-ERROR:  unrecognized configuration parameter "no_such_variable"
+ERROR:  unrecognized configuration parameter no_such_variable
 -- Test "custom" GUCs created on the fly (which aren't really an
 -- intended feature, but many people use them).
 SHOW custom.my_guc;  -- error, not known yet
@@ -811,14 +811,14 @@ create function func_with_bad_set() returns int as $$ select 1 $$
 language sql
 set default_text_search_config = no_such_config;
 NOTICE:  text search configuration "no_such_config" does not exist
-ERROR:  invalid value for parameter "default_text_search_config": "no_such_config"
+ERROR:  invalid value for parameter default_text_search_config: "no_such_config"
 set check_function_bodies = off;
 create function func_with_bad_set() returns int as $$ select 1 $$
 language sql
 set default_text_search_config = no_such_config;
 NOTICE:  text search configuration "no_such_config" does not exist
 select func_with_bad_set();
-ERROR:  invalid value for parameter "default_text_search_config": "no_such_config"
+ERROR:  invalid value for parameter default_text_search_config: "no_such_config"
 reset check_function_bodies;
 set default_with_oids to f;
 -- Should not allow to set it to true.
diff --git a/src/test/regress/expected/password.out b/src/test/regress/expected/password.out
index 924d6e0..752cffc 100644
--- a/src/test/regress/expected/password.out
+++ b/src/test/regress/expected/password.out
@@ -3,10 +3,10 @@
 --
 -- Tests for GUC password_encryption
 SET password_encryption = 'novalue'; -- error
-ERROR:  invalid value for parameter "password_encryption": "novalue"
+ERROR:  invalid value for parameter password_encryption: "novalue"
 HINT:  Available values: md5, scram-sha-256.
 SET password_encryption = true; -- error
-ERROR:  invalid value for parameter "password_encryption": "true"
+ERROR:  invalid value for parameter password_encryption: "true"
 HINT:  Available values: md5, scram-sha-256.
 SET password_encryption = 'md5'; -- ok
 SET password_encryption = 'scram-sha-256'; -- ok
diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out
index b15eddb..8d9229a 100644
--- a/src/test/regress/expected/subscription.out
+++ b/src/test/regress/expected/subscription.out
@@ -220,7 +220,7 @@ RESET ROLE;
 ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo;
 ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
 ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
-ERROR:  invalid value for parameter "synchronous_commit": "foobar"
+ERROR:  invalid value for parameter synchronous_commit: "foobar"
 HINT:  Available values: local, remote_write, remote_apply, on, off.
 \dRs+
                                                                                                                  List of subscriptions
diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out
index 7f5757e..5939ad4 100644
--- a/src/test/regress/expected/transactions.out
+++ b/src/test/regress/expected/transactions.out
@@ -53,7 +53,7 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_isolation; -- error
-ERROR:  parameter "transaction_isolation" cannot be reset
+ERROR:  parameter transaction_isolation cannot be reset
 END;
 BEGIN TRANSACTION READ ONLY;
 SELECT COUNT(*) FROM xacttest;
@@ -63,7 +63,7 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_read_only; -- error
-ERROR:  parameter "transaction_read_only" cannot be reset
+ERROR:  parameter transaction_read_only cannot be reset
 END;
 BEGIN TRANSACTION DEFERRABLE;
 SELECT COUNT(*) FROM xacttest;
@@ -73,11 +73,11 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_deferrable; -- error
-ERROR:  parameter "transaction_deferrable" cannot be reset
+ERROR:  parameter transaction_deferrable cannot be reset
 END;
 CREATE FUNCTION errfunc() RETURNS int LANGUAGE SQL AS 'SELECT 1'
 SET transaction_read_only = on; -- error
-ERROR:  parameter "transaction_read_only" cannot be set locally in functions
+ERROR:  parameter transaction_read_only cannot be set locally in functions
 -- Read-only tests
 CREATE TABLE writetest (a int);
 CREATE TEMPORARY TABLE temptest (a int);
-- 
1.8.3.1

v3-0002-GUC-names-fix-quotes.patchapplication/octet-stream; name=v3-0002-GUC-names-fix-quotes.patchDownload
From 8e67473089e2e3b914aced9763924fbb83c9edc4 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 Nov 2023 09:32:49 +1100
Subject: [PATCH v3] GUC names - fix quotes

---
 contrib/pg_prewarm/autoprewarm.c               |  2 +-
 src/backend/access/heap/vacuumlazy.c           |  2 +-
 src/backend/access/transam/commit_ts.c         |  4 +-
 src/backend/access/transam/xlog.c              |  4 +-
 src/backend/commands/vacuum.c                  |  2 +-
 src/backend/commands/variable.c                |  4 +-
 src/backend/libpq/be-secure-openssl.c          |  6 +--
 src/backend/postmaster/bgworker.c              |  2 +-
 src/backend/postmaster/checkpointer.c          |  2 +-
 src/backend/postmaster/pgarch.c                |  2 +-
 src/backend/storage/buffer/localbuf.c          |  2 +-
 src/backend/storage/file/fd.c                  |  2 +-
 src/backend/storage/lmgr/predicate.c           |  2 +-
 src/backend/tcop/postgres.c                    | 10 ++---
 src/backend/utils/adt/datetime.c               |  2 +-
 src/backend/utils/adt/pg_locale.c              |  4 +-
 src/backend/utils/fmgr/dfmgr.c                 |  4 +-
 src/backend/utils/misc/guc.c                   |  2 +-
 src/backend/utils/misc/guc_tables.c            |  4 +-
 src/test/regress/expected/collate.icu.utf8.out |  4 +-
 src/test/regress/expected/date.out             | 58 +++++++++++++-------------
 src/test/regress/expected/horology.out         |  2 +-
 src/test/regress/expected/json.out             |  4 +-
 src/test/regress/expected/jsonb.out            |  4 +-
 24 files changed, 67 insertions(+), 67 deletions(-)

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index d0efc9e..0993bd2 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -877,7 +877,7 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing configuration parameter max_worker_processes.")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 59f51f4..3b9299b 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -2658,7 +2658,7 @@ lazy_check_wraparound_failsafe(LVRelState *vacrel)
 						vacrel->dbname, vacrel->relnamespace, vacrel->relname,
 						vacrel->num_index_scans),
 				 errdetail("The table's relfrozenxid or relminmxid is too far in the past."),
-				 errhint("Consider increasing configuration parameter \"maintenance_work_mem\" or \"autovacuum_work_mem\".\n"
+				 errhint("Consider increasing configuration parameter maintenance_work_mem or autovacuum_work_mem.\n"
 						 "You might also need to consider other ways for VACUUM to keep up with the allocation of transaction IDs.")));
 
 		/* Stop applying cost limits from this point on */
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index b897fab..9385790 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -376,9 +376,9 @@ error_commit_ts_disabled(void)
 			(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 			 errmsg("could not get commit timestamp data"),
 			 RecoveryInProgress() ?
-			 errhint("Make sure the configuration parameter \"%s\" is set on the primary server.",
+			 errhint("Make sure the configuration parameter %s is set on the primary server.",
 					 "track_commit_timestamp") :
-			 errhint("Make sure the configuration parameter \"%s\" is set.",
+			 errhint("Make sure the configuration parameter %s is set.",
 					 "track_commit_timestamp")));
 }
 
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ef9b8e4..b0d4ae3 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4245,11 +4245,11 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("min_wal_size must be at least twice wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("max_wal_size must be at least twice wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 8bdbee6..be43b46 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -134,7 +134,7 @@ check_vacuum_buffer_usage_limit(int *newval, void **extra,
 		return true;
 
 	/* Value does not fall within any allowable range */
-	GUC_check_errdetail("\"vacuum_buffer_usage_limit\" must be 0 or between %d kB and %d kB",
+	GUC_check_errdetail("vacuum_buffer_usage_limit must be 0 or between %d kB and %d kB",
 						MIN_BAS_VAC_RING_SIZE_KB, MAX_BAS_VAC_RING_SIZE_KB);
 
 	return false;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index a88cf5f..2703d2e 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting DateStyle specifications.");
 		return false;
 	}
 
@@ -717,7 +717,7 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change client_encoding now.");
 		}
 		return false;
 	}
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index 31b6a6e..e715fee 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -195,7 +195,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 			/*- translator: first %s is a GUC option name, second %s is its value */
-					(errmsg("\"%s\" setting \"%s\" not supported by this build",
+					(errmsg("%s setting \"%s\" not supported by this build",
 							"ssl_min_protocol_version",
 							GetConfigOption("ssl_min_protocol_version",
 											false, false))));
@@ -218,7 +218,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 			/*- translator: first %s is a GUC option name, second %s is its value */
-					(errmsg("\"%s\" setting \"%s\" not supported by this build",
+					(errmsg("%s setting \"%s\" not supported by this build",
 							"ssl_max_protocol_version",
 							GetConfigOption("ssl_max_protocol_version",
 											false, false))));
@@ -245,7 +245,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 					(errmsg("could not set SSL protocol version range"),
-					 errdetail("\"%s\" cannot be higher than \"%s\"",
+					 errdetail("%s cannot be higher than %s",
 							   "ssl_min_protocol_version",
 							   "ssl_max_protocol_version")));
 			goto error;
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index 48a9924..911bf24 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -944,7 +944,7 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 								  "Up to %d background workers can be registered with the current settings.",
 								  max_worker_processes,
 								  max_worker_processes),
-				 errhint("Consider increasing the configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing the configuration parameter max_worker_processes.")));
 		return;
 	}
 
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 42c807d..dc2da5a 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -423,7 +423,7 @@ CheckpointerMain(void)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"max_wal_size\".")));
+						 errhint("Consider increasing the configuration parameter max_wal_size.")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 46af349..a2555e8 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -807,7 +807,7 @@ HandlePgArchInterrupts(void)
 			 */
 			ereport(LOG,
 					(errmsg("restarting archiver process because value of "
-							"\"archive_library\" was changed")));
+							"archive_library was changed")));
 
 			proc_exit(0);
 		}
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 4efb34b..aebcf14 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -705,7 +705,7 @@ check_temp_buffers(int *newval, void **extra, GucSource source)
 	 */
 	if (source != PGC_S_TEST && NLocBuffer && NLocBuffer != *newval)
 	{
-		GUC_check_errdetail("\"temp_buffers\" cannot be changed after any temporary tables have been accessed in the session.");
+		GUC_check_errdetail("temp_buffers cannot be changed after any temporary tables have been accessed in the session.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index f691ba0..a185fb3 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3931,7 +3931,7 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 
 	if (!SplitGUCList(rawstring, ',', &elemlist))
 	{
-		GUC_check_errdetail("invalid list syntax in parameter \"%s\"",
+		GUC_check_errdetail("invalid list syntax in parameter %s",
 							"debug_io_direct");
 		pfree(rawstring);
 		list_free(elemlist);
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index a794546..f1f6d0c 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1643,7 +1643,7 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
+				 errdetail("default_transaction_isolation is set to \"serializable\"."),
 				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
 
 	/*
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index e415cf1..7298a18 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3524,7 +3524,7 @@ check_stack_depth(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
 				 errmsg("stack depth limit exceeded"),
-				 errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "
+				 errhint("Increase the configuration parameter max_stack_depth (currently %dkB), "
 						 "after ensuring the platform's stack depth limit is adequate.",
 						 max_stack_depth)));
 	}
@@ -3571,7 +3571,7 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("max_stack_depth must not exceed %ldkB.",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3632,9 +3632,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable log_statement_stats when "
+							"log_parser_stats, log_planner_stats, "
+							"or log_executor_stats is true.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index fca9a2a..8ef5bf0 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4022,7 +4022,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different DateStyle setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index d5003da..1dee462 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -2875,7 +2875,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("could not get language from ICU locale \"%s\": %s",
 						loc_str, u_errorName(status)),
-				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
 						 "icu_validation_level", "disabled")));
 		return;
 	}
@@ -2904,7 +2904,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("ICU locale \"%s\" has unknown language \"%s\"",
 						loc_str, lang),
-				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
 						 "icu_validation_level", "disabled")));
 
 	/* check that it can be opened */
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index b85d52c..56724ff 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -555,7 +555,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (piece == p)
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("zero-length component in parameter \"dynamic_library_path\"")));
+					 errmsg("zero-length component in parameter dynamic_library_path")));
 
 		if (piece == NULL)
 			len = strlen(p);
@@ -574,7 +574,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (!is_absolute_path(mangled))
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("component in parameter \"dynamic_library_path\" is not an absolute path")));
+					 errmsg("component in parameter dynamic_library_path is not an absolute path")));
 
 		full = palloc(strlen(mangled) + 1 + baselen + 1);
 		sprintf(full, "%s/%s", mangled, basename);
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 82d8efb..e76c083 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1873,7 +1873,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
 	else
 	{
 		write_stderr("%s does not know where to find the database system data.\n"
-					 "This can be specified as \"data_directory\" in \"%s\", "
+					 "This can be specified as data_directory in \"%s\", "
 					 "or by the -D invocation option, or by the "
 					 "PGDATA environment variable.\n",
 					 progname, ConfigFileName);
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index b764ef6..67fedb2 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3811,7 +3811,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_command", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the shell command that will be called to archive a WAL file."),
-			gettext_noop("This is used only if \"archive_library\" is not set.")
+			gettext_noop("This is used only if archive_library is not set.")
 		},
 		&XLogArchiveCommand,
 		"",
@@ -3821,7 +3821,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_library", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the library that will be called to archive a WAL file."),
-			gettext_noop("An empty string indicates that \"archive_command\" should be used.")
+			gettext_noop("An empty string indicates that archive_command should be used.")
 		},
 		&XLogArchiveLibrary,
 		"",
diff --git a/src/test/regress/expected/collate.icu.utf8.out b/src/test/regress/expected/collate.icu.utf8.out
index 97bbe53..7a05c75 100644
--- a/src/test/regress/expected/collate.icu.utf8.out
+++ b/src/test/regress/expected/collate.icu.utf8.out
@@ -1042,7 +1042,7 @@ ERROR:  parameter "locale" must be specified
 SET icu_validation_level = ERROR;
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); -- fails
 ERROR:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
+HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
 CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=yes'); -- fails
 ERROR:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 RESET icu_validation_level;
@@ -1050,7 +1050,7 @@ CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=
 WARNING:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); DROP COLLATION testx;
 WARNING:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
+HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
 CREATE COLLATION test4 FROM nonsense;
 ERROR:  collation "nonsense" for encoding "UTF8" does not exist
 CREATE COLLATION test5 FROM test0;
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..99650bf 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index cfb4b20..4aeefd5 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out
index aa29bc5..7cb28f1 100644
--- a/src/test/regress/expected/json.out
+++ b/src/test/regress/expected/json.out
@@ -219,10 +219,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::json;			-- OK
diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out
index f8a7dac..b597d01 100644
--- a/src/test/regress/expected/jsonb.out
+++ b/src/test/regress/expected/jsonb.out
@@ -213,10 +213,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::jsonb;			-- OK
-- 
1.8.3.1

#32Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Michael Paquier (#30)
Re: GUC names in messages

On Tue, 2023-11-28 at 07:53 +0900, Michael Paquier wrote:

On Mon, Nov 27, 2023 at 01:35:44AM -0500, Tom Lane wrote:

Laurenz Albe <laurenz.albe@cybertec.at> writes:

On Mon, 2023-11-27 at 13:41 +1100, Peter Smith wrote:

In the documentation and in the guc_tables.c they are all described in
MixedCase (e.g. "DateStyle" instead of "datestyle"), so I felt the
messages should use the same case the documentation, which is why I
changed all the ones you are referring to.

I agree with that decision; we should use mixed case for these parameters.
Otherwise we might get complaints that the following query does not return
any results:
SELECT * FROM pg_settings WHERE name = 'timezone';

(I'm sure that you mean the opposite. This query does not return any
results on HEAD, but it would with "TimeZone".)

No, I meant it just like I said. If all messages suggest that the parameter
is called "timezone", and not "TimeZone" (because we convert the name to lower
case), then it is surprising that the above query does not return results.

It would be better to call the parameter "TimeZone" everywhere.

(It would be best to convert the parameter to lower case, but I am worried
about the compatibility-pain-to-benefit ratio.)

Yours,
Laurenz Albe

#33Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#31)
1 attachment(s)
Re: GUC names in messages

On Tue, Nov 28, 2023 at 11:54:33AM +1100, Peter Smith wrote:

Here is patch set v3.

Patches 0001 and 0002 are unchanged from v2.

After some grepping, I've noticed that 0002 had a mistake with
track_commit_timestamp: some alternate output of modules/commit_ts/
was not updated. meson was able to reproduce the failure as well.

I am not sure regarding what we should do a mixed cases as well, so I
have discarded DateStyle for now, and applied the rest.

Also applied 0001 from Alvaro.

Patch 0003 now uses a "%s%s%s" format specifier with GUC_FORMAT macro
in guc.c, as recently suggested by Michael [1].

I cannot think about a better idea as these strings need to be
translated so they need three %s.

+		if (*p == '_')
+			underscore = true;
+		else if ('a' <= *p && *p <= 'z')
+			lowercase = true;

An issue with this code is that it would forget to quote GUCs that use
dots, like the ones from an extension. I don't really see why we
cannot just make the macro return true only if all the characters of a
GUC name is made of lower-case alpha characters?

With an extra indentation applied, I finish with the attached for
0003.
--
Michael

Attachments:

v4-0003-GUC-names-maybe-add-quotes.patchtext/x-diff; charset=us-asciiDownload
From 77bd6b6f58ab1b0671f6afa12dc4e00900b456a8 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Thu, 30 Nov 2023 14:58:32 +0900
Subject: [PATCH v4] GUC names - maybe add quotes

---
 src/backend/utils/misc/guc.c                  | 278 ++++++++++++------
 .../expected/test_oat_hooks.out               |  16 +-
 .../unsafe_tests/expected/guc_privs.out       |  58 ++--
 .../unsafe_tests/expected/rolenames.out       |   2 +-
 src/test/regress/expected/compression.out     |   4 +-
 src/test/regress/expected/compression_1.out   |   6 +-
 src/test/regress/expected/create_am.out       |   4 +-
 src/test/regress/expected/guc.out             |  30 +-
 src/test/regress/expected/password.out        |   4 +-
 src/test/regress/expected/subscription.out    |   2 +-
 src/test/regress/expected/transactions.out    |   8 +-
 contrib/auto_explain/t/001_auto_explain.pl    |   2 +-
 src/pl/plperl/expected/plperl_init.out        |   4 +-
 13 files changed, 259 insertions(+), 159 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e76c083003..aad72db9e5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -265,6 +265,30 @@ static bool call_string_check_hook(struct config_string *conf, char **newval,
 static bool call_enum_check_hook(struct config_enum *conf, int *newval,
 								 void **extra, GucSource source, int elevel);
 
+/* Macro for handling optional quotes around GUC names */
+#define GUC_FORMAT(s)\
+	quotes_needed_for_GUC_name(s) ? "\"" : "",\
+	s,\
+	quotes_needed_for_GUC_name(s) ? "\"" : ""
+
+/*
+ * Return whether the GUC name should be enclosed in double-quotes.
+ *
+ * Quoting is intended for names which could be mistaken for normal English
+ * words.  Quotes are only applied to GUC names that are written entirely with
+ * lower-case alphabetical characters.
+ */
+static bool
+quotes_needed_for_GUC_name(const char *name)
+{
+	for (const char *p = name; *p; p++)
+	{
+		if ('a' > *p || *p > 'z')
+			return false;
+	}
+
+	return true;
+}
 
 /*
  * This function handles both actual config file (re)loads and execution of
@@ -420,8 +444,9 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			/* Invalid non-custom variable, so complain */
 			ereport(elevel,
 					(errcode(ERRCODE_UNDEFINED_OBJECT),
-					 errmsg("unrecognized configuration parameter \"%s\" in file \"%s\" line %d",
-							item->name,
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("unrecognized configuration parameter %s%s%s in file \"%s\" line %d",
+							GUC_FORMAT(item->name),
 							item->filename, item->sourceline)));
 			item->errmsg = pstrdup("unrecognized configuration parameter");
 			error = true;
@@ -460,10 +485,13 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			gconf->status |= GUC_PENDING_RESTART;
 			ereport(elevel,
 					(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-					 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-							gconf->name)));
-			record_config_file_error(psprintf("parameter \"%s\" cannot be changed without restarting the server",
-											  gconf->name),
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+							GUC_FORMAT(gconf->name))));
+			record_config_file_error(
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+									 psprintf("parameter %s%s%s cannot be changed without restarting the server",
+											  GUC_FORMAT(gconf->name)),
 									 NULL, 0,
 									 &head, &tail);
 			error = true;
@@ -496,8 +524,9 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 			/* Log the change if appropriate */
 			if (context == PGC_SIGHUP)
 				ereport(elevel,
-						(errmsg("parameter \"%s\" removed from configuration file, reset to default",
-								gconf->name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						(errmsg("parameter %s%s%s removed from configuration file, reset to default",
+								GUC_FORMAT(gconf->name))));
 		}
 	}
 
@@ -561,8 +590,10 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
 					post_value = "";
 				if (strcmp(pre_value, post_value) != 0)
 					ereport(elevel,
-							(errmsg("parameter \"%s\" changed to \"%s\"",
-									item->name, item->value)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							(errmsg("parameter %s%s%s changed to \"%s\"",
+									GUC_FORMAT(item->name),
+									item->value)));
 			}
 			item->applied = true;
 		}
@@ -1129,8 +1160,9 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 			if (!skip_errors)
 				ereport(elevel,
 						(errcode(ERRCODE_INVALID_NAME),
-						 errmsg("invalid configuration parameter name \"%s\"",
-								name),
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("invalid configuration parameter name %s%s%s",
+								GUC_FORMAT(name)),
 						 errdetail("Custom parameter names must be two or more simple identifiers separated by dots.")));
 			return false;
 		}
@@ -1145,8 +1177,9 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 				if (!skip_errors)
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_NAME),
-							 errmsg("invalid configuration parameter name \"%s\"",
-									name),
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid configuration parameter name %s%s%s",
+									GUC_FORMAT(name)),
 							 errdetail("\"%s\" is a reserved prefix.",
 									   rcprefix)));
 				return false;
@@ -1160,8 +1193,9 @@ assignable_custom_variable_name(const char *name, bool skip_errors, int elevel)
 	if (!skip_errors)
 		ereport(elevel,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
-				 errmsg("unrecognized configuration parameter \"%s\"",
-						name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("unrecognized configuration parameter %s%s%s",
+						GUC_FORMAT(name))));
 	return false;
 }
 
@@ -1270,8 +1304,9 @@ find_option(const char *name, bool create_placeholders, bool skip_errors,
 	if (!skip_errors)
 		ereport(elevel,
 				(errcode(ERRCODE_UNDEFINED_OBJECT),
-				 errmsg("unrecognized configuration parameter \"%s\"",
-						name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("unrecognized configuration parameter %s%s%s",
+						GUC_FORMAT(name))));
 	return NULL;
 }
 
@@ -3125,8 +3160,9 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("parameter \"%s\" requires a Boolean value",
-									name)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("parameter %s%s%s requires a Boolean value",
+									GUC_FORMAT(name))));
 					return false;
 				}
 
@@ -3145,8 +3181,9 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3157,11 +3194,12 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("%d%s%s is outside the valid range for parameter \"%s\" (%d .. %d)",
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("%d%s%s is outside the valid range for parameter %s%s%s (%d .. %d)",
 									newval->intval,
 									unit ? " " : "",
 									unit ? unit : "",
-									name,
+									GUC_FORMAT(name),
 									conf->min, conf->max)));
 					return false;
 				}
@@ -3181,8 +3219,9 @@ parse_and_validate_value(struct config_generic *record,
 				{
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3193,11 +3232,12 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("%g%s%s is outside the valid range for parameter \"%s\" (%g .. %g)",
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("%g%s%s is outside the valid range for parameter %s%s%s (%g .. %g)",
 									newval->realval,
 									unit ? " " : "",
 									unit ? unit : "",
-									name,
+									GUC_FORMAT(name),
 									conf->min, conf->max)));
 					return false;
 				}
@@ -3251,8 +3291,9 @@ parse_and_validate_value(struct config_generic *record,
 
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
@@ -3410,8 +3451,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 			break;
@@ -3433,8 +3475,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 			break;
@@ -3443,8 +3486,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed now",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed now",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 
@@ -3470,8 +3514,9 @@ set_config_option_ext(const char *name, const char *value,
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("permission denied to set parameter %s%s%s",
+									GUC_FORMAT(name))));
 					return 0;
 				}
 			}
@@ -3508,8 +3553,9 @@ set_config_option_ext(const char *name, const char *value,
 			{
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be set after connection start",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be set after connection start",
+								GUC_FORMAT(name))));
 				return 0;
 			}
 			break;
@@ -3528,8 +3574,9 @@ set_config_option_ext(const char *name, const char *value,
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("permission denied to set parameter %s%s%s",
+									GUC_FORMAT(name))));
 					return 0;
 				}
 			}
@@ -3567,16 +3614,18 @@ set_config_option_ext(const char *name, const char *value,
 			 */
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-					 errmsg("cannot set parameter \"%s\" within security-definer function",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("cannot set parameter %s%s%s within security-definer function",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 		if (InSecurityRestrictedOperation())
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-					 errmsg("cannot set parameter \"%s\" within security-restricted operation",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("cannot set parameter %s%s%s within security-restricted operation",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 	}
@@ -3588,15 +3637,18 @@ set_config_option_ext(const char *name, const char *value,
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be reset", name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s cannot be reset",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 		if (action == GUC_ACTION_SAVE)
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be set locally in functions",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s cannot be set locally in functions",
+							GUC_FORMAT(name))));
 			return 0;
 		}
 	}
@@ -3621,8 +3673,8 @@ set_config_option_ext(const char *name, const char *value,
 	{
 		if (changeVal && !makeDefault)
 		{
-			elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority",
-				 name);
+			elog(DEBUG3, "%s%s%s: setting ignored because previous source is higher priority",
+				 GUC_FORMAT(name));
 			return -1;
 		}
 		changeVal = false;
@@ -3673,8 +3725,13 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+
+						/*
+						 * translator: %s%s%s is for an optionally quoted GUC
+						 * name
+						 */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3771,8 +3828,13 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+
+						/*
+						 * translator: %s%s%s is for an optionally quoted GUC
+						 * name
+						 */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3869,8 +3931,13 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+
+						/*
+						 * translator: %s%s%s is for an optionally quoted GUC
+						 * name
+						 */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3993,8 +4060,13 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+
+						/*
+						 * translator: %s%s%s is for an optionally quoted GUC
+						 * name
+						 */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4096,8 +4168,13 @@ set_config_option_ext(const char *name, const char *value,
 						record->status |= GUC_PENDING_RESTART;
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+
+						/*
+						 * translator: %s%s%s is for an optionally quoted GUC
+						 * name
+						 */
+								 errmsg("parameter %s%s%s cannot be changed without restarting the server",
+										GUC_FORMAT(name))));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4238,7 +4315,9 @@ GetConfigOption(const char *name, bool missing_ok, bool restrict_privileged)
 		!ConfigOptionIsVisible(record))
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to examine \"%s\"", name),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("permission denied to examine %s%s%s",
+						GUC_FORMAT(name)),
 				 errdetail("Only roles with privileges of the \"%s\" role may examine this parameter.",
 						   "pg_read_all_settings")));
 
@@ -4534,8 +4613,9 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 			if (aclresult != ACLCHECK_OK)
 				ereport(ERROR,
 						(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-						 errmsg("permission denied to set parameter \"%s\"",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("permission denied to set parameter %s%s%s",
+								GUC_FORMAT(name))));
 		}
 	}
 
@@ -4559,8 +4639,9 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 				(record->flags & GUC_DISALLOW_IN_AUTO_FILE))
 				ereport(ERROR,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
-						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+				/* translator: %s%s%s is for an optionally quoted GUC name */
+						 errmsg("parameter %s%s%s cannot be changed",
+								GUC_FORMAT(name))));
 
 			/*
 			 * If a value is specified, verify that it's sane.
@@ -4575,8 +4656,9 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 											  &newval, &newextra))
 					ereport(ERROR,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value)));
+					/* translator: %s%s%s is for an optionally quoted GUC name */
+							 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+									GUC_FORMAT(name), value)));
 
 				if (record->vartype == PGC_STRING && newval.stringval != NULL)
 					guc_free(newval.stringval);
@@ -4830,7 +4912,9 @@ define_custom_variable(struct config_generic *variable)
 	if ((hentry->gucvar->flags & GUC_CUSTOM_PLACEHOLDER) == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_INTERNAL_ERROR),
-				 errmsg("attempt to redefine parameter \"%s\"", name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("attempt to redefine parameter %s%s%s",
+						GUC_FORMAT(name))));
 
 	Assert(hentry->gucvar->vartype == PGC_STRING);
 	pHolder = (struct config_string *) hentry->gucvar;
@@ -5169,8 +5253,9 @@ MarkGUCPrefixReserved(const char *className)
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("invalid configuration parameter name \"%s\", removing it",
-							var->name),
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("invalid configuration parameter name %s%s%s, removing it",
+							GUC_FORMAT(var->name)),
 					 errdetail("\"%s\" is now a reserved prefix.",
 							   className)));
 			/* Remove it from the hash table */
@@ -5313,7 +5398,9 @@ GetConfigOptionByName(const char *name, const char **varname, bool missing_ok)
 	if (!ConfigOptionIsVisible(record))
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to examine \"%s\"", name),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("permission denied to examine %s%s%s",
+						GUC_FORMAT(name)),
 				 errdetail("Only roles with privileges of the \"%s\" role may examine this parameter.",
 						   "pg_read_all_settings")));
 
@@ -5639,7 +5726,8 @@ read_nondefault_variables(void)
 			break;
 
 		if (find_option(varname, true, false, FATAL) == NULL)
-			elog(FATAL, "failed to locate variable \"%s\" in exec config params file", varname);
+			elog(FATAL, "failed to locate variable %s%s%s in exec config params file",
+				 GUC_FORMAT(varname));
 
 		if ((varvalue = read_string_with_null(fp)) == NULL)
 			elog(FATAL, "invalid format of exec config params file");
@@ -6048,8 +6136,9 @@ guc_restore_error_context_callback(void *arg)
 	char	  **error_context_name_and_value = (char **) arg;
 
 	if (error_context_name_and_value)
-		errcontext("while setting parameter \"%s\" to \"%s\"",
-				   error_context_name_and_value[0],
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+		errcontext("while setting parameter %s%s%s to \"%s\"",
+				   GUC_FORMAT(error_context_name_and_value[0]),
 				   error_context_name_and_value[1]);
 }
 
@@ -6217,7 +6306,9 @@ RestoreGUCState(void *gucstate)
 		if (result <= 0)
 			ereport(ERROR,
 					(errcode(ERRCODE_INTERNAL_ERROR),
-					 errmsg("parameter \"%s\" could not be set", varname)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("parameter %s%s%s could not be set",
+							GUC_FORMAT(varname))));
 		if (varsourcefile[0])
 			set_config_sourcefile(varname, varsourcefile, varsourceline);
 		error_context_callback.arg = NULL;
@@ -6307,8 +6398,9 @@ TransformGUCArray(ArrayType *array, List **names, List **values)
 		{
 			ereport(WARNING,
 					(errcode(ERRCODE_SYNTAX_ERROR),
-					 errmsg("could not parse setting for parameter \"%s\"",
-							name)));
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("could not parse setting for parameter %s%s%s",
+							GUC_FORMAT(name))));
 			pfree(name);
 			continue;
 		}
@@ -6625,7 +6717,9 @@ validate_option_array_item(const char *name, const char *value,
 			return false;
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-				 errmsg("permission denied to set parameter \"%s\"", name)));
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("permission denied to set parameter %s%s%s",
+						GUC_FORMAT(name))));
 	}
 
 	/* manual permissions check so we can avoid an error being thrown */
@@ -6689,8 +6783,9 @@ call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %d",
-						conf->gen.name, (int) *newval),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: %d",
+						GUC_FORMAT(conf->gen.name), (int) *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6723,8 +6818,9 @@ call_int_check_hook(struct config_int *conf, int *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %d",
-						conf->gen.name, *newval),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: %d",
+						GUC_FORMAT(conf->gen.name), *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6757,8 +6853,9 @@ call_real_check_hook(struct config_real *conf, double *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": %g",
-						conf->gen.name, *newval),
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: %g",
+						GUC_FORMAT(conf->gen.name), *newval),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 				 GUC_check_errhint_string ?
@@ -6800,8 +6897,10 @@ call_string_check_hook(struct config_string *conf, char **newval, void **extra,
 					(errcode(GUC_check_errcode_value),
 					 GUC_check_errmsg_string ?
 					 errmsg_internal("%s", GUC_check_errmsg_string) :
-					 errmsg("invalid value for parameter \"%s\": \"%s\"",
-							conf->gen.name, *newval ? *newval : ""),
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+							GUC_FORMAT(conf->gen.name),
+							*newval ? *newval : ""),
 					 GUC_check_errdetail_string ?
 					 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
 					 GUC_check_errhint_string ?
@@ -6841,8 +6940,9 @@ call_enum_check_hook(struct config_enum *conf, int *newval, void **extra,
 				(errcode(GUC_check_errcode_value),
 				 GUC_check_errmsg_string ?
 				 errmsg_internal("%s", GUC_check_errmsg_string) :
-				 errmsg("invalid value for parameter \"%s\": \"%s\"",
-						conf->gen.name,
+		/* translator: %s%s%s is for an optionally quoted GUC name */
+				 errmsg("invalid value for parameter %s%s%s: \"%s\"",
+						GUC_FORMAT(conf->gen.name),
 						config_enum_lookup_by_value(conf, *newval)),
 				 GUC_check_errdetail_string ?
 				 errdetail_internal("%s", GUC_check_errdetail_string) : 0,
diff --git a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
index f80373aecc..042569d27a 100644
--- a/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
+++ b/src/test/modules/test_oat_hooks/expected/test_oat_hooks.out
@@ -180,10 +180,10 @@ NOTICE:  in object_access_hook_str: non-superuser finished alter (subId=0x1000,
 NOTICE:  in process utility: non-superuser finished RESET
 ALTER SYSTEM SET work_mem = 8192;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "work_mem"
+ERROR:  permission denied to set parameter work_mem
 ALTER SYSTEM RESET work_mem;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "work_mem"
+ERROR:  permission denied to set parameter work_mem
 SET test_oat_hooks.user_var1 = true;
 NOTICE:  in process utility: non-superuser attempting SET
 NOTICE:  in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var1]
@@ -191,13 +191,13 @@ NOTICE:  in object_access_hook_str: non-superuser finished alter (subId=0x1000,
 NOTICE:  in process utility: non-superuser finished SET
 SET test_oat_hooks.super_var1 = true;
 NOTICE:  in process utility: non-superuser attempting SET
-ERROR:  permission denied to set parameter "test_oat_hooks.super_var1"
+ERROR:  permission denied to set parameter test_oat_hooks.super_var1
 ALTER SYSTEM SET test_oat_hooks.user_var1 = true;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "test_oat_hooks.user_var1"
+ERROR:  permission denied to set parameter test_oat_hooks.user_var1
 ALTER SYSTEM SET test_oat_hooks.super_var1 = true;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "test_oat_hooks.super_var1"
+ERROR:  permission denied to set parameter test_oat_hooks.super_var1
 SET test_oat_hooks.user_var2 = true;
 NOTICE:  in process utility: non-superuser attempting SET
 NOTICE:  in object_access_hook_str: non-superuser attempting alter (subId=0x1000, set) [test_oat_hooks.user_var2]
@@ -205,13 +205,13 @@ NOTICE:  in object_access_hook_str: non-superuser finished alter (subId=0x1000,
 NOTICE:  in process utility: non-superuser finished SET
 SET test_oat_hooks.super_var2 = true;
 NOTICE:  in process utility: non-superuser attempting SET
-ERROR:  permission denied to set parameter "test_oat_hooks.super_var2"
+ERROR:  permission denied to set parameter test_oat_hooks.super_var2
 ALTER SYSTEM SET test_oat_hooks.user_var2 = true;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "test_oat_hooks.user_var2"
+ERROR:  permission denied to set parameter test_oat_hooks.user_var2
 ALTER SYSTEM SET test_oat_hooks.super_var2 = true;
 NOTICE:  in process utility: non-superuser attempting ALTER SYSTEM
-ERROR:  permission denied to set parameter "test_oat_hooks.super_var2"
+ERROR:  permission denied to set parameter test_oat_hooks.super_var2
 RESET SESSION AUTHORIZATION;
 NOTICE:  in process utility: non-superuser attempting RESET
 NOTICE:  in object_access_hook_str: superuser attempting alter (subId=0x1000, set) [session_authorization]
diff --git a/src/test/modules/unsafe_tests/expected/guc_privs.out b/src/test/modules/unsafe_tests/expected/guc_privs.out
index 6c0ad89834..6c594a4b40 100644
--- a/src/test/modules/unsafe_tests/expected/guc_privs.out
+++ b/src/test/modules/unsafe_tests/expected/guc_privs.out
@@ -8,31 +8,31 @@ CREATE ROLE regress_admin SUPERUSER;
 SET SESSION AUTHORIZATION regress_admin;
 -- PGC_BACKEND
 SET ignore_system_indexes = OFF;  -- fail, cannot be set after connection start
-ERROR:  parameter "ignore_system_indexes" cannot be set after connection start
+ERROR:  parameter ignore_system_indexes cannot be set after connection start
 RESET ignore_system_indexes;  -- fail, cannot be set after connection start
-ERROR:  parameter "ignore_system_indexes" cannot be set after connection start
+ERROR:  parameter ignore_system_indexes cannot be set after connection start
 ALTER SYSTEM SET ignore_system_indexes = OFF;  -- ok
 ALTER SYSTEM RESET ignore_system_indexes;  -- ok
 -- PGC_INTERNAL
 SET block_size = 50;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 RESET block_size;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 ALTER SYSTEM SET block_size = 50;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 ALTER SYSTEM RESET block_size;  -- fail, cannot be changed
-ERROR:  parameter "block_size" cannot be changed
+ERROR:  parameter block_size cannot be changed
 -- PGC_POSTMASTER
 SET autovacuum_freeze_max_age = 1000050000;  -- fail, requires restart
-ERROR:  parameter "autovacuum_freeze_max_age" cannot be changed without restarting the server
+ERROR:  parameter autovacuum_freeze_max_age cannot be changed without restarting the server
 RESET autovacuum_freeze_max_age;  -- fail, requires restart
-ERROR:  parameter "autovacuum_freeze_max_age" cannot be changed without restarting the server
+ERROR:  parameter autovacuum_freeze_max_age cannot be changed without restarting the server
 ALTER SYSTEM SET autovacuum_freeze_max_age = 1000050000;  -- ok
 ALTER SYSTEM RESET autovacuum_freeze_max_age;  -- ok
 ALTER SYSTEM SET config_file = '/usr/local/data/postgresql.conf';  -- fail, cannot be changed
-ERROR:  parameter "config_file" cannot be changed
+ERROR:  parameter config_file cannot be changed
 ALTER SYSTEM RESET config_file;  -- fail, cannot be changed
-ERROR:  parameter "config_file" cannot be changed
+ERROR:  parameter config_file cannot be changed
 -- PGC_SIGHUP
 SET autovacuum = OFF;  -- fail, requires reload
 ERROR:  parameter "autovacuum" cannot be changed now
@@ -47,9 +47,9 @@ ALTER SYSTEM SET lc_messages = 'C';  -- ok
 ALTER SYSTEM RESET lc_messages;  -- ok
 -- PGC_SU_BACKEND
 SET jit_debugging_support = OFF;  -- fail, cannot be set after connection start
-ERROR:  parameter "jit_debugging_support" cannot be set after connection start
+ERROR:  parameter jit_debugging_support cannot be set after connection start
 RESET jit_debugging_support;  -- fail, cannot be set after connection start
-ERROR:  parameter "jit_debugging_support" cannot be set after connection start
+ERROR:  parameter jit_debugging_support cannot be set after connection start
 ALTER SYSTEM SET jit_debugging_support = OFF;  -- ok
 ALTER SYSTEM RESET jit_debugging_support;  -- ok
 -- PGC_USERSET
@@ -58,9 +58,9 @@ RESET DateStyle;  -- ok
 ALTER SYSTEM SET DateStyle = 'ISO, MDY';  -- ok
 ALTER SYSTEM RESET DateStyle;  -- ok
 ALTER SYSTEM SET ssl_renegotiation_limit = 0;  -- fail, cannot be changed
-ERROR:  parameter "ssl_renegotiation_limit" cannot be changed
+ERROR:  parameter ssl_renegotiation_limit cannot be changed
 ALTER SYSTEM RESET ssl_renegotiation_limit;  -- fail, cannot be changed
-ERROR:  parameter "ssl_renegotiation_limit" cannot be changed
+ERROR:  parameter ssl_renegotiation_limit cannot be changed
 -- Finished testing superuser
 -- Create non-superuser with privileges to configure host resource usage
 CREATE ROLE regress_host_resource_admin NOSUPERUSER;
@@ -224,7 +224,7 @@ SELECT 1 FROM pg_parameter_acl WHERE parname = 'none.such';
 ALTER SYSTEM SET none.such = 'whiz bang';
 -- None of the above should have created a placeholder GUC for none.such.
 SHOW none.such;  -- error
-ERROR:  unrecognized configuration parameter "none.such"
+ERROR:  unrecognized configuration parameter none.such
 -- However, if we reload ...
 SELECT pg_reload_conf();
  pg_reload_conf 
@@ -244,7 +244,7 @@ SHOW none.such;
 
 -- Can't grant on a non-existent core GUC.
 GRANT ALL ON PARAMETER no_such_guc TO regress_host_resource_admin;  -- fail
-ERROR:  unrecognized configuration parameter "no_such_guc"
+ERROR:  unrecognized configuration parameter no_such_guc
 -- Initially there are no privileges and no catalog entry for this GUC.
 SELECT has_parameter_privilege('regress_host_resource_admin', 'enable_material', 'SET');
  has_parameter_privilege 
@@ -446,17 +446,17 @@ ALTER ROLE regress_host_resource_admin SET lc_messages = 'C';
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- ok, privileges have been granted
 ALTER SYSTEM SET ignore_system_indexes = OFF;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "ignore_system_indexes"
+ERROR:  permission denied to set parameter ignore_system_indexes
 ALTER SYSTEM RESET autovacuum_multixact_freeze_max_age;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "autovacuum_multixact_freeze_max_age"
+ERROR:  permission denied to set parameter autovacuum_multixact_freeze_max_age
 SET jit_provider = 'llvmjit';  -- fail, insufficient privileges
-ERROR:  parameter "jit_provider" cannot be changed without restarting the server
+ERROR:  parameter jit_provider cannot be changed without restarting the server
 SELECT set_config ('jit_provider', 'llvmjit', true); -- fail, insufficient privileges
-ERROR:  parameter "jit_provider" cannot be changed without restarting the server
+ERROR:  parameter jit_provider cannot be changed without restarting the server
 ALTER SYSTEM SET shared_buffers = 50;  -- ok
 ALTER SYSTEM RESET shared_buffers;  -- ok
 SET autovacuum_work_mem = 50;  -- cannot be changed now
-ERROR:  parameter "autovacuum_work_mem" cannot be changed now
+ERROR:  parameter autovacuum_work_mem cannot be changed now
 ALTER SYSTEM RESET temp_file_limit;  -- ok
 SET TimeZone = 'Europe/Helsinki';  -- ok
 RESET TimeZone;  -- ok
@@ -465,13 +465,13 @@ RESET max_stack_depth;  -- ok, privileges have been granted
 ALTER SYSTEM SET max_stack_depth = '100kB';  -- ok, privileges have been granted
 ALTER SYSTEM RESET max_stack_depth;  -- ok, privileges have been granted
 SET lc_messages = 'C';  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 RESET lc_messages;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER SYSTEM SET lc_messages = 'C';  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER SYSTEM RESET lc_messages;  -- fail, insufficient privileges
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 SELECT set_config ('temp_buffers', '8192', false); -- ok
  set_config 
 ------------
@@ -482,9 +482,9 @@ ALTER SYSTEM RESET autovacuum_work_mem;  -- ok, privileges have been granted
 ALTER SYSTEM RESET ALL;  -- fail, insufficient privileges
 ERROR:  permission denied to perform ALTER SYSTEM RESET ALL
 ALTER SYSTEM SET none.such2 = 'whiz bang';  -- fail, not superuser
-ERROR:  permission denied to set parameter "none.such2"
+ERROR:  permission denied to set parameter none.such2
 ALTER ROLE regress_host_resource_admin SET lc_messages = 'POSIX';  -- fail
-ERROR:  permission denied to set parameter "lc_messages"
+ERROR:  permission denied to set parameter lc_messages
 ALTER ROLE regress_host_resource_admin SET max_stack_depth = '1MB';  -- ok
 SELECT setconfig FROM pg_db_role_setting
   WHERE setrole = 'regress_host_resource_admin'::regrole;
@@ -537,7 +537,7 @@ DROP ROLE regress_host_resource_admin;  -- ok
 CREATE ROLE regress_host_resource_admin NOSUPERUSER;
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- fail, privileges not yet granted
-ERROR:  permission denied to set parameter "autovacuum_work_mem"
+ERROR:  permission denied to set parameter autovacuum_work_mem
 SET SESSION AUTHORIZATION regress_admin;
 GRANT SET, ALTER SYSTEM ON PARAMETER
     autovacuum_work_mem, hash_mem_multiplier, max_stack_depth,
@@ -554,7 +554,7 @@ privileges for parameter work_mem
 DROP OWNED BY regress_host_resource_admin RESTRICT; -- cascade should not be needed
 SET SESSION AUTHORIZATION regress_host_resource_admin;
 ALTER SYSTEM SET autovacuum_work_mem = 32;  -- fail, "drop owned" has dropped privileges
-ERROR:  permission denied to set parameter "autovacuum_work_mem"
+ERROR:  permission denied to set parameter autovacuum_work_mem
 SET SESSION AUTHORIZATION regress_admin;
 DROP ROLE regress_host_resource_admin;  -- ok
 -- Check that "reassign owned" doesn't affect privileges
diff --git a/src/test/modules/unsafe_tests/expected/rolenames.out b/src/test/modules/unsafe_tests/expected/rolenames.out
index 61396b2a80..21d2bac322 100644
--- a/src/test/modules/unsafe_tests/expected/rolenames.out
+++ b/src/test/modules/unsafe_tests/expected/rolenames.out
@@ -1077,7 +1077,7 @@ SHOW session_preload_libraries;
 SET SESSION AUTHORIZATION regress_role_nopriv;
 -- fails with role not member of pg_read_all_settings
 SHOW session_preload_libraries;
-ERROR:  permission denied to examine "session_preload_libraries"
+ERROR:  permission denied to examine session_preload_libraries
 DETAIL:  Only roles with privileges of the "pg_read_all_settings" role may examine this parameter.
 RESET SESSION AUTHORIZATION;
 ERROR:  current transaction is aborted, commands ignored until end of transaction block
diff --git a/src/test/regress/expected/compression.out b/src/test/regress/expected/compression.out
index 834b7555cb..7426504e20 100644
--- a/src/test/regress/expected/compression.out
+++ b/src/test/regress/expected/compression.out
@@ -234,10 +234,10 @@ ERROR:  column "f1" has a compression method conflict
 DETAIL:  pglz versus lz4
 -- test default_toast_compression GUC
 SET default_toast_compression = '';
-ERROR:  invalid value for parameter "default_toast_compression": ""
+ERROR:  invalid value for parameter default_toast_compression: ""
 HINT:  Available values: pglz, lz4.
 SET default_toast_compression = 'I do not exist compression';
-ERROR:  invalid value for parameter "default_toast_compression": "I do not exist compression"
+ERROR:  invalid value for parameter default_toast_compression: "I do not exist compression"
 HINT:  Available values: pglz, lz4.
 SET default_toast_compression = 'lz4';
 SET default_toast_compression = 'pglz';
diff --git a/src/test/regress/expected/compression_1.out b/src/test/regress/expected/compression_1.out
index ddcd137c49..5234e47b44 100644
--- a/src/test/regress/expected/compression_1.out
+++ b/src/test/regress/expected/compression_1.out
@@ -225,13 +225,13 @@ ERROR:  column "f1" has a compression method conflict
 DETAIL:  pglz versus lz4
 -- test default_toast_compression GUC
 SET default_toast_compression = '';
-ERROR:  invalid value for parameter "default_toast_compression": ""
+ERROR:  invalid value for parameter default_toast_compression: ""
 HINT:  Available values: pglz.
 SET default_toast_compression = 'I do not exist compression';
-ERROR:  invalid value for parameter "default_toast_compression": "I do not exist compression"
+ERROR:  invalid value for parameter default_toast_compression: "I do not exist compression"
 HINT:  Available values: pglz.
 SET default_toast_compression = 'lz4';
-ERROR:  invalid value for parameter "default_toast_compression": "lz4"
+ERROR:  invalid value for parameter default_toast_compression: "lz4"
 HINT:  Available values: pglz.
 SET default_toast_compression = 'pglz';
 -- test alter compression method
diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out
index b50293d514..afa11a6dc9 100644
--- a/src/test/regress/expected/create_am.out
+++ b/src/test/regress/expected/create_am.out
@@ -112,11 +112,11 @@ COMMIT;
 --
 -- prevent empty values
 SET default_table_access_method = '';
-ERROR:  invalid value for parameter "default_table_access_method": ""
+ERROR:  invalid value for parameter default_table_access_method: ""
 DETAIL:  default_table_access_method cannot be empty.
 -- prevent nonexistent values
 SET default_table_access_method = 'I do not exist AM';
-ERROR:  invalid value for parameter "default_table_access_method": "I do not exist AM"
+ERROR:  invalid value for parameter default_table_access_method: "I do not exist AM"
 DETAIL:  Table access method "I do not exist AM" does not exist.
 -- prevent setting it to an index AM
 SET default_table_access_method = 'btree';
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 127c953297..95b2414bd1 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -508,15 +508,15 @@ SELECT '2006-08-13 12:34:56'::timestamptz;
 
 -- Test some simple error cases
 SET seq_page_cost TO 'NaN';
-ERROR:  invalid value for parameter "seq_page_cost": "NaN"
+ERROR:  invalid value for parameter seq_page_cost: "NaN"
 SET vacuum_cost_delay TO '10s';
-ERROR:  10000 ms is outside the valid range for parameter "vacuum_cost_delay" (0 .. 100)
+ERROR:  10000 ms is outside the valid range for parameter vacuum_cost_delay (0 .. 100)
 SET no_such_variable TO 42;
-ERROR:  unrecognized configuration parameter "no_such_variable"
+ERROR:  unrecognized configuration parameter no_such_variable
 -- Test "custom" GUCs created on the fly (which aren't really an
 -- intended feature, but many people use them).
 SHOW custom.my_guc;  -- error, not known yet
-ERROR:  unrecognized configuration parameter "custom.my_guc"
+ERROR:  unrecognized configuration parameter custom.my_guc
 SET custom.my_guc = 42;
 SHOW custom.my_guc;
  custom.my_guc 
@@ -539,26 +539,26 @@ SHOW custom.my.qualified.guc;
 (1 row)
 
 SET custom."bad-guc" = 42;  -- disallowed because -c cannot set this name
-ERROR:  invalid configuration parameter name "custom.bad-guc"
+ERROR:  invalid configuration parameter name custom.bad-guc
 DETAIL:  Custom parameter names must be two or more simple identifiers separated by dots.
 SHOW custom."bad-guc";
-ERROR:  unrecognized configuration parameter "custom.bad-guc"
+ERROR:  unrecognized configuration parameter custom.bad-guc
 SET special."weird name" = 'foo';  -- could be allowed, but we choose not to
-ERROR:  invalid configuration parameter name "special.weird name"
+ERROR:  invalid configuration parameter name special.weird name
 DETAIL:  Custom parameter names must be two or more simple identifiers separated by dots.
 SHOW special."weird name";
-ERROR:  unrecognized configuration parameter "special.weird name"
+ERROR:  unrecognized configuration parameter special.weird name
 -- Check what happens when you try to set a "custom" GUC within the
 -- namespace of an extension.
 SET plpgsql.extra_foo_warnings = true;  -- allowed if plpgsql is not loaded yet
 LOAD 'plpgsql';  -- this will throw a warning and delete the variable
-WARNING:  invalid configuration parameter name "plpgsql.extra_foo_warnings", removing it
+WARNING:  invalid configuration parameter name plpgsql.extra_foo_warnings, removing it
 DETAIL:  "plpgsql" is now a reserved prefix.
 SET plpgsql.extra_foo_warnings = true;  -- now, it's an error
-ERROR:  invalid configuration parameter name "plpgsql.extra_foo_warnings"
+ERROR:  invalid configuration parameter name plpgsql.extra_foo_warnings
 DETAIL:  "plpgsql" is a reserved prefix.
 SHOW plpgsql.extra_foo_warnings;
-ERROR:  unrecognized configuration parameter "plpgsql.extra_foo_warnings"
+ERROR:  unrecognized configuration parameter plpgsql.extra_foo_warnings
 --
 -- Test DISCARD TEMP
 --
@@ -775,9 +775,9 @@ select myfunc(1), current_setting('work_mem');
 
 -- check current_setting()'s behavior with invalid setting name
 select current_setting('nosuch.setting');  -- FAIL
-ERROR:  unrecognized configuration parameter "nosuch.setting"
+ERROR:  unrecognized configuration parameter nosuch.setting
 select current_setting('nosuch.setting', false);  -- FAIL
-ERROR:  unrecognized configuration parameter "nosuch.setting"
+ERROR:  unrecognized configuration parameter nosuch.setting
 select current_setting('nosuch.setting', true) is null;
  ?column? 
 ----------
@@ -811,14 +811,14 @@ create function func_with_bad_set() returns int as $$ select 1 $$
 language sql
 set default_text_search_config = no_such_config;
 NOTICE:  text search configuration "no_such_config" does not exist
-ERROR:  invalid value for parameter "default_text_search_config": "no_such_config"
+ERROR:  invalid value for parameter default_text_search_config: "no_such_config"
 set check_function_bodies = off;
 create function func_with_bad_set() returns int as $$ select 1 $$
 language sql
 set default_text_search_config = no_such_config;
 NOTICE:  text search configuration "no_such_config" does not exist
 select func_with_bad_set();
-ERROR:  invalid value for parameter "default_text_search_config": "no_such_config"
+ERROR:  invalid value for parameter default_text_search_config: "no_such_config"
 reset check_function_bodies;
 set default_with_oids to f;
 -- Should not allow to set it to true.
diff --git a/src/test/regress/expected/password.out b/src/test/regress/expected/password.out
index 924d6e001d..752cffcda0 100644
--- a/src/test/regress/expected/password.out
+++ b/src/test/regress/expected/password.out
@@ -3,10 +3,10 @@
 --
 -- Tests for GUC password_encryption
 SET password_encryption = 'novalue'; -- error
-ERROR:  invalid value for parameter "password_encryption": "novalue"
+ERROR:  invalid value for parameter password_encryption: "novalue"
 HINT:  Available values: md5, scram-sha-256.
 SET password_encryption = true; -- error
-ERROR:  invalid value for parameter "password_encryption": "true"
+ERROR:  invalid value for parameter password_encryption: "true"
 HINT:  Available values: md5, scram-sha-256.
 SET password_encryption = 'md5'; -- ok
 SET password_encryption = 'scram-sha-256'; -- ok
diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out
index b15eddbff3..8d9229a932 100644
--- a/src/test/regress/expected/subscription.out
+++ b/src/test/regress/expected/subscription.out
@@ -220,7 +220,7 @@ RESET ROLE;
 ALTER SUBSCRIPTION regress_testsub RENAME TO regress_testsub_foo;
 ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = local);
 ALTER SUBSCRIPTION regress_testsub_foo SET (synchronous_commit = foobar);
-ERROR:  invalid value for parameter "synchronous_commit": "foobar"
+ERROR:  invalid value for parameter synchronous_commit: "foobar"
 HINT:  Available values: local, remote_write, remote_apply, on, off.
 \dRs+
                                                                                                                  List of subscriptions
diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out
index 7f5757e89c..5939ad4d2e 100644
--- a/src/test/regress/expected/transactions.out
+++ b/src/test/regress/expected/transactions.out
@@ -53,7 +53,7 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_isolation; -- error
-ERROR:  parameter "transaction_isolation" cannot be reset
+ERROR:  parameter transaction_isolation cannot be reset
 END;
 BEGIN TRANSACTION READ ONLY;
 SELECT COUNT(*) FROM xacttest;
@@ -63,7 +63,7 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_read_only; -- error
-ERROR:  parameter "transaction_read_only" cannot be reset
+ERROR:  parameter transaction_read_only cannot be reset
 END;
 BEGIN TRANSACTION DEFERRABLE;
 SELECT COUNT(*) FROM xacttest;
@@ -73,11 +73,11 @@ SELECT COUNT(*) FROM xacttest;
 (1 row)
 
 RESET transaction_deferrable; -- error
-ERROR:  parameter "transaction_deferrable" cannot be reset
+ERROR:  parameter transaction_deferrable cannot be reset
 END;
 CREATE FUNCTION errfunc() RETURNS int LANGUAGE SQL AS 'SELECT 1'
 SET transaction_read_only = on; -- error
-ERROR:  parameter "transaction_read_only" cannot be set locally in functions
+ERROR:  parameter transaction_read_only cannot be set locally in functions
 -- Read-only tests
 CREATE TABLE writetest (a int);
 CREATE TEMPORARY TABLE temptest (a int);
diff --git a/contrib/auto_explain/t/001_auto_explain.pl b/contrib/auto_explain/t/001_auto_explain.pl
index abb422f8de..056001a0d6 100644
--- a/contrib/auto_explain/t/001_auto_explain.pl
+++ b/contrib/auto_explain/t/001_auto_explain.pl
@@ -201,7 +201,7 @@ GRANT SET ON PARAMETER auto_explain.log_format TO regress_user1;
 
 	like(
 		$log_contents,
-		qr/WARNING: ( 42501:)? permission denied to set parameter "auto_explain\.log_level"/,
+		qr/WARNING: ( 42501:)? permission denied to set parameter auto_explain\.log_level/,
 		"permission failure logged");
 
 }    # end queries run as regress_user1
diff --git a/src/pl/plperl/expected/plperl_init.out b/src/pl/plperl/expected/plperl_init.out
index 4b7e925419..6d6825cfed 100644
--- a/src/pl/plperl/expected/plperl_init.out
+++ b/src/pl/plperl/expected/plperl_init.out
@@ -23,7 +23,7 @@ SET ROLE regress_plperl_user;
 SET SESSION plperl.on_plperl_init = 'test';
 RESET ROLE;
 LOAD 'plperl';
-WARNING:  permission denied to set parameter "plperl.on_plperl_init"
+WARNING:  permission denied to set parameter plperl.on_plperl_init
 SHOW plperl.on_plperl_init;
  plperl.on_plperl_init 
 -----------------------
@@ -35,6 +35,6 @@ WARNING:  42 at line 1.
 -- now we won't be allowed to set it in the first place
 SET ROLE regress_plperl_user;
 SET SESSION plperl.on_plperl_init = 'test';
-ERROR:  permission denied to set parameter "plperl.on_plperl_init"
+ERROR:  permission denied to set parameter plperl.on_plperl_init
 RESET ROLE;
 DROP ROLE regress_plperl_user;
-- 
2.42.0

#34Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Michael Paquier (#33)
Re: GUC names in messages

At Thu, 30 Nov 2023 14:59:21 +0900, Michael Paquier <michael@paquier.xyz> wrote in

Patch 0003 now uses a "%s%s%s" format specifier with GUC_FORMAT macro
in guc.c, as recently suggested by Michael [1].

I cannot think about a better idea as these strings need to be
translated so they need three %s.

In this patch, the quotation marks cannot be changed from double
quotes.

After a brief review of the use of quotation marks in various
languages, it's observed that French uses guillemets (« »), German
uses lower qutation marks („ “), Spanish uses angular quotation marks
(« ») or alternatively, lower quotetaion marks. Japanese commonly uses
corner brackets (「」), but can also adopt double or single quotation
marks in certain contexts. I took a look at the backend's fr.po file
for a trial, and it indeed seems that guillemets are being used.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

#35Michael Paquier
michael@paquier.xyz
In reply to: Kyotaro Horiguchi (#34)
Re: GUC names in messages

On Thu, Nov 30, 2023 at 03:29:49PM +0900, Kyotaro Horiguchi wrote:

In this patch, the quotation marks cannot be changed from double
quotes.

Indeed, that's a good point. I completely forgot about that.
--
Michael

#36Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#33)
Re: GUC names in messages

On Thu, Nov 30, 2023 at 4:59 PM Michael Paquier <michael@paquier.xyz> wrote:

On Tue, Nov 28, 2023 at 11:54:33AM +1100, Peter Smith wrote:

Here is patch set v3.

Patches 0001 and 0002 are unchanged from v2.

After some grepping, I've noticed that 0002 had a mistake with
track_commit_timestamp: some alternate output of modules/commit_ts/
was not updated. meson was able to reproduce the failure as well.

I am not sure regarding what we should do a mixed cases as well, so I
have discarded DateStyle for now, and applied the rest.

Also applied 0001 from Alvaro.

Thanks for pushing those parts.

Patch 0003 now uses a "%s%s%s" format specifier with GUC_FORMAT macro
in guc.c, as recently suggested by Michael [1].

I cannot think about a better idea as these strings need to be
translated so they need three %s.

+               if (*p == '_')
+                       underscore = true;
+               else if ('a' <= *p && *p <= 'z')
+                       lowercase = true;

An issue with this code is that it would forget to quote GUCs that use
dots, like the ones from an extension. I don't really see why we
cannot just make the macro return true only if all the characters of a
GUC name is made of lower-case alpha characters?

Not forgotten. I felt the dot separator in such names might be
mistaken for a period in a sentence which is why I left quotes for
those ones. YMMV.

======
Kind Regards,
Peter. Smith.
Fujitsu Australia

#37Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Michael Paquier (#33)
Re: GUC names in messages
+/*
+ * Return whether the GUC name should be enclosed in double-quotes.
+ *
+ * Quoting is intended for names which could be mistaken for normal English
+ * words.  Quotes are only applied to GUC names that are written entirely with
+ * lower-case alphabetical characters.
+ */
+static bool
+quotes_needed_for_GUC_name(const char *name)
+{
+	for (const char *p = name; *p; p++)
+	{
+		if ('a' > *p || *p > 'z')
+			return false;
+	}
+
+	return true;
+}

I think you need a function that the name possibly quoted, in a way that
lets the translator handle the quoting:

static char buffer[SOMEMAXLEN];

quotes_needed = ...;

if (quotes_needed)
/* translator: a quoted configuration parameter name */
snprintf(buffer, _("\"%s\""), name);
return buffer
else
/* no translation needed in this case */
return name;

then the calling code just does a single %s that prints the string
returned by this function. (Do note that the function is not reentrant,
like pg_dump's fmtId. Shouldn't be a problem ...)

@@ -3621,8 +3673,8 @@ set_config_option_ext(const char *name, const char *value,
{
if (changeVal && !makeDefault)
{
-			elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority",
-				 name);
+			elog(DEBUG3, "%s%s%s: setting ignored because previous source is higher priority",
+				 GUC_FORMAT(name));

Note that elog() doesn't do translation, and DEBUG doesn't really need
to worry too much about style anyway. I'd leave these as-is.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"La primera ley de las demostraciones en vivo es: no trate de usar el sistema.
Escriba un guión que no toque nada para no causar daños." (Jakob Nielsen)

#38Peter Eisentraut
peter@eisentraut.org
In reply to: Michael Paquier (#33)
Re: GUC names in messages

On 30.11.23 06:59, Michael Paquier wrote:

ereport(elevel,
(errcode(ERRCODE_UNDEFINED_OBJECT),
-					 errmsg("unrecognized configuration parameter \"%s\" in file \"%s\" line %d",
-							item->name,
+			/* translator: %s%s%s is for an optionally quoted GUC name */
+					 errmsg("unrecognized configuration parameter %s%s%s in file \"%s\" line %d",
+							GUC_FORMAT(item->name),
item->filename, item->sourceline)));

I think this is completely over-engineered and wrong. If we start down
this road, then the next person is going to start engineering some rules
by which we should quote file names and other things. Which will lead
to more confusion, not less. The whole point of this quoting thing is
that you do it all the time or not, not dynamically based on what's
inside of it.

The original version of this string (and similar ones) seems the most
correct, simple, and useful one to me.

#39Peter Smith
smithpb2250@gmail.com
In reply to: Peter Eisentraut (#38)
2 attachment(s)
Re: GUC names in messages

On Fri, Dec 1, 2023 at 7:38 AM Peter Eisentraut <peter@eisentraut.org> wrote:

On 30.11.23 06:59, Michael Paquier wrote:

ereport(elevel,
(errcode(ERRCODE_UNDEFINED_OBJECT),
-                                      errmsg("unrecognized configuration parameter \"%s\" in file \"%s\" line %d",
-                                                     item->name,
+                     /* translator: %s%s%s is for an optionally quoted GUC name */
+                                      errmsg("unrecognized configuration parameter %s%s%s in file \"%s\" line %d",
+                                                     GUC_FORMAT(item->name),
item->filename, item->sourceline)));

I think this is completely over-engineered and wrong. If we start down
this road, then the next person is going to start engineering some rules
by which we should quote file names and other things. Which will lead
to more confusion, not less. The whole point of this quoting thing is
that you do it all the time or not, not dynamically based on what's
inside of it.

The original version of this string (and similar ones) seems the most
correct, simple, and useful one to me.

Yeah, trying to manipulate the quoting dynamically seems like it was
an overreach...

Removing that still leaves some other changes needed to "fix" the
messages using MixedCase GUCs.

PSA v4

======
Details:

Patch 0001 -- "datestyle" becomes DateStyle in messages
Rebased this again, which was part of an earlier patch set
- I think any GUC names documented as MixedCase should keep that same
case in messages; this also obeys the guidelines recently pushed [1]GUC quoting guidelines - https://github.com/postgres/postgres/commit/a243569bf65c5664436e8f63d870b7ee9c014dcb.
- Some others agreed, expecting the exact GUC name (in the message)
can be found in pg_settings [2]The case should match pg_settings - /messages/by-id/db3e4290ced77111c17e7a2adfb1d660734f5f78.camel@cybertec.at.
- OTOH, Michael didn't like the diff churn [3]Dislike of diff churn - /messages/by-id/ZWUd8dYYA9v83KvI@paquier.xyz caused by this patch.

~~~

Patch 0002 -- use mixed case for intervalstyle error message
I found that the GUC name substituted to the error message was coming
from the statement, not from the original name in the guc_tables, so
there was a case mismatch:

BEFORE Patch 0002 (see the lowercase in the error message)
2023-12-08 13:21:32.897 AEDT [32609] STATEMENT: set intervalstyle = 1234;
ERROR: invalid value for parameter "intervalstyle": "1234"
HINT: Available values: postgres, postgres_verbose, sql_standard, iso_8601.

AFTER Patch 0002
2023-12-08 13:38:48.638 AEDT [29684] STATEMENT: set intervalstyle = 1234;
ERROR: invalid value for parameter "IntervalStyle": "1234"
HINT: Available values: postgres, postgres_verbose, sql_standard, iso_8601.

======
[1]: GUC quoting guidelines - https://github.com/postgres/postgres/commit/a243569bf65c5664436e8f63d870b7ee9c014dcb
https://github.com/postgres/postgres/commit/a243569bf65c5664436e8f63d870b7ee9c014dcb
[2]: The case should match pg_settings - /messages/by-id/db3e4290ced77111c17e7a2adfb1d660734f5f78.camel@cybertec.at
/messages/by-id/db3e4290ced77111c17e7a2adfb1d660734f5f78.camel@cybertec.at
[3]: Dislike of diff churn - /messages/by-id/ZWUd8dYYA9v83KvI@paquier.xyz
/messages/by-id/ZWUd8dYYA9v83KvI@paquier.xyz

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v4-0002-GUC-names-use-mixed-case-for-intervalstyle-error-.patchapplication/octet-stream; name=v4-0002-GUC-names-use-mixed-case-for-intervalstyle-error-.patchDownload
From f2755db57e375bc07226438faac83ea789ecf9fd Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Fri, 8 Dec 2023 14:41:02 +1100
Subject: [PATCH v4] GUC names - use mixed case for intervalstyle error message

---
 src/backend/utils/misc/guc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e76c083..c134024 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3252,7 +3252,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
-- 
1.8.3.1

v4-0001-GUC-names-use-mixed-case-for-datestyle-in-message.patchapplication/octet-stream; name=v4-0001-GUC-names-use-mixed-case-for-datestyle-in-message.patchDownload
From 663701868262f892f42ccbe2c10c9c42ff25d998 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Fri, 8 Dec 2023 12:59:20 +1100
Subject: [PATCH v4] GUC names - use mixed case for datestyle in messages

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index c361bb2..2703d2e 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting DateStyle specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index fca9a2a..8ef5bf0 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4022,7 +4022,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different DateStyle setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..99650bf 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index cfb4b20..4aeefd5 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

#40Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Peter Smith (#39)
3 attachment(s)
Re: GUC names in messages

On 2023-Dec-08, Peter Smith wrote:

Patch 0001 -- "datestyle" becomes DateStyle in messages
Rebased this again, which was part of an earlier patch set
- I think any GUC names documented as MixedCase should keep that same
case in messages; this also obeys the guidelines recently pushed [1].

I agree.

Patch 0002 -- use mixed case for intervalstyle error message
I found that the GUC name substituted to the error message was coming
from the statement, not from the original name in the guc_tables, so
there was a case mismatch:

I agree. Let's also add a test that shows this difference (my 0002
here).

I'm annoyed that this saga has transiently created a few untranslated
strings by removing unnecessary quotes but failing to move the variable
names outside the translatable part of the string. I change a few of
those in 0003 -- mostly the ones in strings already touched by commit
8d9978a7176a, but also a few others. Didn't go out of my way to grep
for other possible messages to fix, though. (I feel like this is
missing some "translator:" comments.)

--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"We’ve narrowed the problem down to the customer’s pants being in a situation
of vigorous combustion" (Robert Haas, Postgres expert extraordinaire)

Attachments:

v5-0001-GUC-names-use-mixed-case-for-datestyle-in-message.patchtext/x-diff; charset=utf-8Download
From 0ccf4f8342d49d42116a1b1b872b15aeeddaf568 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Fri, 8 Dec 2023 12:59:20 +1100
Subject: [PATCH v5 1/3] GUC names - use mixed case for datestyle in messages

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++-------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index c361bb2079..2703d2edc4 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting DateStyle specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index fca9a2a6e9..8ef5bf0076 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4022,7 +4022,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different DateStyle setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3d17..99650bf231 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index cfb4b205e4..4aeefd53bd 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different DateStyle setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
2.39.2

v5-0002-Ensure-we-use-documented-CamelCase-in-error-messa.patchtext/x-diff; charset=utf-8Download
From 8b5bd09c818590afd858b9c8159887339db8e456 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Fri, 8 Dec 2023 14:41:02 +1100
Subject: [PATCH v5 2/3] Ensure we use documented CamelCase in error messages

Author: Peter Smith
---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e76c083003..c134024fd5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3252,7 +3252,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 127c953297..66ddc4c938 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761955..e540495fc1 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,6 +2,9 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
-- 
2.39.2

v5-0003-move-variable-names-out-of-translatable-message-s.patchtext/x-diff; charset=utf-8Download
From 86402523bc1783d8cc508418bb4be796d3aa7dae Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Fri, 8 Dec 2023 13:46:41 +0100
Subject: [PATCH v5 3/3] move variable names out of translatable message string

---
 contrib/pg_prewarm/autoprewarm.c          |  3 +-
 src/backend/access/transam/xlog.c         | 75 +++++++++++++----------
 src/backend/access/transam/xlogrecovery.c |  2 +-
 src/backend/commands/vacuum.c             | 10 +--
 src/backend/commands/variable.c           | 11 ++--
 src/backend/port/sysv_shmem.c             |  3 +-
 src/backend/postmaster/bgworker.c         |  3 +-
 src/backend/postmaster/checkpointer.c     |  3 +-
 src/backend/replication/syncrep.c         |  3 +-
 src/backend/storage/buffer/localbuf.c     |  3 +-
 src/backend/storage/file/fd.c             |  9 ++-
 src/backend/storage/lmgr/predicate.c      |  6 +-
 src/backend/tcop/postgres.c               | 15 +++--
 src/backend/utils/fmgr/dfmgr.c            | 16 ++---
 14 files changed, 97 insertions(+), 65 deletions(-)

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 0993bd2453..fcc8debb0b 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -877,7 +877,8 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter max_worker_processes.")));
+				 errhint("Consider increasing the configuration parameter %s.",
+						 "max_worker_processes")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index daed1a7a49..d3831ea978 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4161,16 +4161,21 @@ ReadControlFile(void)
 	if (ControlFile->catalog_version_no != CATALOG_VERSION_NO)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-						   " but the server was compiled with CATALOG_VERSION_NO %d.",
-						   ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "CATALOG_VERSION_NO",
+						   ControlFile->catalog_version_no,
+						   "CATALOG_VERSION_NO",
+						   CATALOG_VERSION_NO),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with MAXALIGN %d,"
-						   " but the server was compiled with MAXALIGN %d.",
-						   ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "MAXALIGN", ControlFile->maxAlign,
+						   "MAXALIGN", MAXIMUM_ALIGNOF),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
 		ereport(FATAL,
@@ -4180,51 +4185,57 @@ ReadControlFile(void)
 	if (ControlFile->blcksz != BLCKSZ)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with BLCKSZ %d,"
-						   " but the server was compiled with BLCKSZ %d.",
-						   ControlFile->blcksz, BLCKSZ),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "BLCKSZ", ControlFile->blcksz, "BLCKSZ", BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->relseg_size != RELSEG_SIZE)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with RELSEG_SIZE %d,"
-						   " but the server was compiled with RELSEG_SIZE %d.",
-						   ControlFile->relseg_size, RELSEG_SIZE),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "RELSEG_SIZE", ControlFile->relseg_size,
+						   "RELSEG_SIZE", RELSEG_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->xlog_blcksz != XLOG_BLCKSZ)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with XLOG_BLCKSZ %d,"
-						   " but the server was compiled with XLOG_BLCKSZ %d.",
-						   ControlFile->xlog_blcksz, XLOG_BLCKSZ),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "XLOG_BLCKSZ", ControlFile->xlog_blcksz,
+						   "XLOG_BLCKSZ", XLOG_BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->nameDataLen != NAMEDATALEN)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with NAMEDATALEN %d,"
-						   " but the server was compiled with NAMEDATALEN %d.",
-						   ControlFile->nameDataLen, NAMEDATALEN),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "NAMEDATALEN", ControlFile->nameDataLen,
+						   "NAMEDATALEN", NAMEDATALEN),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
-						   " but the server was compiled with INDEX_MAX_KEYS %d.",
-						   ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "INDEX_MAX_KEYS", ControlFile->indexMaxKeys,
+						   "INDEX_MAX_KEYS", INDEX_MAX_KEYS),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
-						   " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
-						   ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "TOAST_MAX_CHUNK_SIZE", ControlFile->toast_max_chunk_size,
+						   "TOAST_MAX_CHUNK_SIZE", (int) TOAST_MAX_CHUNK_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->loblksize != LOBLKSIZE)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with LOBLKSIZE %d,"
-						   " but the server was compiled with LOBLKSIZE %d.",
-						   ControlFile->loblksize, (int) LOBLKSIZE),
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "LOBLKSIZE", ControlFile->loblksize,
+						   "LOBLKSIZE", (int) LOBLKSIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef USE_FLOAT8_BYVAL
@@ -4259,12 +4270,14 @@ ReadControlFile(void)
 
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
-		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("min_wal_size must be at least twice wal_segment_size")));
+		ereport(ERROR, errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("%s must be at least twice %s",
+					   "min_wal_size", "wal_segment_size"));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
-		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("max_wal_size must be at least twice wal_segment_size")));
+		ereport(ERROR, errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+				errmsg("%s must be at least twice %s",
+					   "max_wal_size", "wal_segment_size"));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 4bc4d3e323..524d792ae9 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -4726,7 +4726,7 @@ check_recovery_target(char **newval, void **extra, GucSource source)
 {
 	if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("The only allowed value is \"immediate\".");
+		GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");
 		return false;
 	}
 	return true;
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index be43b46c04..a80438f30b 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -134,8 +134,9 @@ check_vacuum_buffer_usage_limit(int *newval, void **extra,
 		return true;
 
 	/* Value does not fall within any allowable range */
-	GUC_check_errdetail("vacuum_buffer_usage_limit must be 0 or between %d kB and %d kB",
-						MIN_BAS_VAC_RING_SIZE_KB, MAX_BAS_VAC_RING_SIZE_KB);
+	GUC_check_errdetail("%s must be 0 or between %d kB and %d kB.",
+						"vacuum_buffer_usage_limit", MIN_BAS_VAC_RING_SIZE_KB,
+						MAX_BAS_VAC_RING_SIZE_KB);
 
 	return false;
 }
@@ -206,8 +207,9 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel)
 			{
 				ereport(ERROR,
 						(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						 errmsg("BUFFER_USAGE_LIMIT option must be 0 or between %d kB and %d kB",
-								MIN_BAS_VAC_RING_SIZE_KB, MAX_BAS_VAC_RING_SIZE_KB),
+						 errmsg("%s option must be 0 or between %d kB and %d kB",
+								"BUFFER_USAGE_LIMIT", MIN_BAS_VAC_RING_SIZE_KB,
+								MAX_BAS_VAC_RING_SIZE_KB),
 						 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 			}
 
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 2703d2edc4..da5e2de310 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting DateStyle specifications.");
+		GUC_check_errdetail("Conflicting %s specifications.", "DateStyle");
 		return false;
 	}
 
@@ -717,7 +717,8 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change client_encoding now.");
+			GUC_check_errdetail("Cannot change %s now.",
+								"client_encoding");
 		}
 		return false;
 	}
@@ -1202,7 +1203,8 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("effective_io_concurrency must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("%s must be set to 0 on platforms that lack posix_fadvise().",
+							"effective_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1215,7 +1217,8 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("maintenance_io_concurrency must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("%s must be set to 0 on platforms that lack posix_fadvise().",
+							"maintenance_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 2de280ecb6..88c39f577d 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -580,7 +580,8 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("huge_page_size must be 0 on this platform.");
+		GUC_check_errdetail("%s must be 0 on this platform.",
+							"huge_page_size");
 		return false;
 	}
 #endif
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index c345639086..f2dc53ac85 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -919,7 +919,8 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 								  "Up to %d background workers can be registered with the current settings.",
 								  max_worker_processes,
 								  max_worker_processes),
-				 errhint("Consider increasing the configuration parameter max_worker_processes.")));
+				 errhint("Consider increasing the configuration parameter %s.",
+						 "max_worker_processes")));
 		return;
 	}
 
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index dc2da5a2cd..9060eeea67 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -423,7 +423,8 @@ CheckpointerMain(void)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter max_wal_size.")));
+						 errhint("Consider increasing the configuration parameter %s.",
+								 "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 0ea71b5c43..7d1fecb607 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1016,7 +1016,8 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("synchronous_standby_names parser failed");
+				GUC_check_errdetail("%s parser failed",
+									"synchronous_standby_names");
 			return false;
 		}
 
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index aebcf146b4..5b9cc850a2 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -705,7 +705,8 @@ check_temp_buffers(int *newval, void **extra, GucSource source)
 	 */
 	if (source != PGC_S_TEST && NLocBuffer && NLocBuffer != *newval)
 	{
-		GUC_check_errdetail("temp_buffers cannot be changed after any temporary tables have been accessed in the session.");
+		GUC_check_errdetail("%s cannot be changed after any temporary tables have been accessed in the session.",
+							"temp_buffers");
 		return false;
 	}
 	return true;
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index a185fb3d08..3b5d395a0f 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3917,7 +3917,8 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("debug_io_direct is not supported on this platform.");
+		GUC_check_errdetail("%s is not supported on this platform.",
+							"debug_io_direct");
 		result = false;
 	}
 	flags = 0;
@@ -3964,14 +3965,16 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("debug_io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("%s is not supported for WAL because %s is too small",
+							"debug_io_direct", "XLOG_BLCKSZ");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("debug_io_direct is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("%s is not supported for data because %s is too small",
+							"debug_io_direct", "BLCKSZ");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 1129b8e4f2..b8d3df1a3b 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1644,8 +1644,10 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("default_transaction_isolation is set to \"serializable\"."),
-				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
+				 errdetail("%s is set to \"%s\".",
+						   "default_transaction_isolation", "serializable"),
+				 errhint("You can use \"%s\" to change the default.",
+						 "SET default_transaction_isolation = 'repeatable read'")));
 
 	/*
 	 * A special optimization is available for SERIALIZABLE READ ONLY
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 7298a187d1..9b55a584ed 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3571,7 +3571,8 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("max_stack_depth must not exceed %ldkB.",
+		GUC_check_errdetail("%s must not exceed %ldkB.",
+							"max_stack_depth",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3596,7 +3597,8 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("client_connection_check_interval must be set to 0 on this platform.");
+		GUC_check_errdetail("%s must be set to 0 on this platform.",
+							"client_connection_check_interval");
 		return false;
 	}
 	return true;
@@ -3617,7 +3619,8 @@ check_stage_log_stats(bool *newval, void **extra, GucSource source)
 {
 	if (*newval && log_statement_stats)
 	{
-		GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
+		GUC_check_errdetail("Cannot enable parameter when %s is true.",
+							"log_statement_stats");
 		return false;
 	}
 	return true;
@@ -3632,9 +3635,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable log_statement_stats when "
-							"log_parser_stats, log_planner_stats, "
-							"or log_executor_stats is true.");
+		GUC_check_errdetail("Cannot enable %s when %s, %s, or %s is true.",
+							"log_statement_stats", "log_parser_stats",
+							"log_planner_stats", "log_executor_stats");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 56724ff815..60469e6258 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -358,8 +358,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FUNC_MAX_ARGS = %d, library has %d."),
-						 magic_data.funcmaxargs,
+						 _("Server has %s = %d, library has %d."),
+						 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
 						 module_magic_data->funcmaxargs);
 	}
 	if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
@@ -367,8 +367,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has INDEX_MAX_KEYS = %d, library has %d."),
-						 magic_data.indexmaxkeys,
+						 _("Server has %s = %d, library has %d."),
+						 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
 						 module_magic_data->indexmaxkeys);
 	}
 	if (module_magic_data->namedatalen != magic_data.namedatalen)
@@ -376,8 +376,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has NAMEDATALEN = %d, library has %d."),
-						 magic_data.namedatalen,
+						 _("Server has %s = %d, library has %d."),
+						 "NAMEDATALEN", magic_data.namedatalen,
 						 module_magic_data->namedatalen);
 	}
 	if (module_magic_data->float8byval != magic_data.float8byval)
@@ -385,8 +385,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FLOAT8PASSBYVAL = %s, library has %s."),
-						 magic_data.float8byval ? "true" : "false",
+						 _("Server has %s = %s, library has %s."),
+						 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
 						 module_magic_data->float8byval ? "true" : "false");
 	}
 
-- 
2.39.2

#41Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Smith (#39)
Re: GUC names in messages

On 08.12.23 05:10, Peter Smith wrote:

Patch 0001 -- "datestyle" becomes DateStyle in messages
Rebased this again, which was part of an earlier patch set
- I think any GUC names documented as MixedCase should keep that same
case in messages; this also obeys the guidelines recently pushed [1].
- Some others agreed, expecting the exact GUC name (in the message)
can be found in pg_settings [2].
- OTOH, Michael didn't like the diff churn [3] caused by this patch.

I'm fine with adjusting the mixed-case stuff, but intuitively, I don't
think removing the quotes in this is an improvement:

- GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+ GUC_check_errdetail("Conflicting DateStyle specifications.");
#42Peter Smith
smithpb2250@gmail.com
In reply to: Peter Eisentraut (#41)
Re: GUC names in messages

On Sat, Dec 9, 2023 at 1:48 AM Peter Eisentraut <peter@eisentraut.org> wrote:

On 08.12.23 05:10, Peter Smith wrote:

Patch 0001 -- "datestyle" becomes DateStyle in messages
Rebased this again, which was part of an earlier patch set
- I think any GUC names documented as MixedCase should keep that same
case in messages; this also obeys the guidelines recently pushed [1].
- Some others agreed, expecting the exact GUC name (in the message)
can be found in pg_settings [2].
- OTOH, Michael didn't like the diff churn [3] caused by this patch.

I'm fine with adjusting the mixed-case stuff, but intuitively, I don't
think removing the quotes in this is an improvement:

- GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+ GUC_check_errdetail("Conflicting DateStyle specifications.");

My original intention of this thread was only to document the GUC name
quoting guidelines and then apply those consistently in the code.

I'm happy either way for the MixedCase names to be quoted or not
quoted, whatever is the consensus.

If the rule is changed to quote those MixedCase GUCs then the docs
will require minor tweaking

CURRENT
<para>
In messages containing configuration variable names, do not include quotes
when the names are visibly not natural English words, such as when they
have underscores, are all-uppercase or have mixed case. Otherwise, quotes
must be added. Do include quotes in a message where an arbitrary variable
name is to be expanded.
</para>

"are all-uppercase or have mixed case." --> "or are all-uppercase."

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#43Peter Smith
smithpb2250@gmail.com
In reply to: Alvaro Herrera (#40)
Re: GUC names in messages

This v5* looks good to me, except it will need some further
modification if PeterE's suggestion [1]/messages/by-id/9e7802b2-2cf2-4c2d-b680-b2ccb9db1d2f@eisentraut.org to keep quotes for the
MixedCase GUCs is adopted.

======
[1]: /messages/by-id/9e7802b2-2cf2-4c2d-b680-b2ccb9db1d2f@eisentraut.org

Kind Regards,
Peter Smith.
Futjisu Australia.

#44Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#43)
Re: GUC names in messages

On Mon, Dec 11, 2023 at 10:14:11AM +1100, Peter Smith wrote:

This v5* looks good to me, except it will need some further
modification if PeterE's suggestion [1] to keep quotes for the
MixedCase GUCs is adopted.

-                errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-                          " but the server was compiled with CATALOG_VERSION_NO %d.",
-                          ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+                /*- translator: %s is a variable name and %d is its value */
+                errdetail("The database cluster was initialized with %s %d,"
+                          " but the server was compiled with %s %d.",
+                          "CATALOG_VERSION_NO",

Good point. There are a lot of strings that can be shaved from the
translations here.

src/backend/access/transam/xlog.c: errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d (0x%08x),"
src/backend/access/transam/xlog.c: errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d,"
src/backend/access/transam/xlog.c: errdetail("The database cluster was initialized without USE_FLOAT8_BYVAL"
src/backend/access/transam/xlog.c: errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL"

I think that you should apply the same conversion for these ones.
There is no gain with the 1st and 3rd ones, but the 2nd and 4th one
can be grouped together.

FWIW, if we don't convert MixedCase GUCs to become mixedcase, I don't
think that there is any need to apply quotes to them because they
don't really look like natural English words. That's as far as my
opinion goes, so feel free to ignore me if the consensus is different.
--
Michael

#45Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Smith (#42)
Re: GUC names in messages

On 11.12.23 00:07, Peter Smith wrote:

If the rule is changed to quote those MixedCase GUCs then the docs
will require minor tweaking

CURRENT
<para>
In messages containing configuration variable names, do not include quotes
when the names are visibly not natural English words, such as when they
have underscores, are all-uppercase or have mixed case. Otherwise, quotes
must be added. Do include quotes in a message where an arbitrary variable
name is to be expanded.
</para>

"are all-uppercase or have mixed case." --> "or are all-uppercase."

After these discussions, I think this rule change was not a good idea.
It effectively enforces these kinds of inconsistencies. For example, if
you ever refactored

"DateStyle is wrong"

to

"%s is wrong"

you'd need to adjust the quotes, and thus user-visible behavior, for
entirely internal reasons. This is not good. And then came the idea to
determine the quoting dynamically, which I think everyone agreed was too
much. So I don't see a way to make this work well.

#46Michael Paquier
michael@paquier.xyz
In reply to: Peter Eisentraut (#45)
Re: GUC names in messages

On Thu, Dec 14, 2023 at 09:38:40AM +0100, Peter Eisentraut wrote:

After these discussions, I think this rule change was not a good idea. It
effectively enforces these kinds of inconsistencies. For example, if you
ever refactored

"DateStyle is wrong"

to

"%s is wrong"

you'd need to adjust the quotes, and thus user-visible behavior, for
entirely internal reasons. This is not good.

So, what are you suggesting? Should the encouraged rule be removed
from the docs? Or do you object to some of the changes done in the
latest patch series v5?

FWIW, I am a bit meh with v5-0001, because I don't see the benefits.
On the contrary v5-0003 is useful, because it reduces a bit the number
of strings to translate. That's always good to take. I don't have a
problem with v5-0002, either, where we'd begin using the name of the
GUC as stored in the static tables rather than the name provided in
the SET query, particularly for the reason that it makes the GUC name
a bit more consistent even when using double-quotes around the
parameter name in the query, where the error messages would not force
a lower-case conversion. The patch would, AFAIU, change HEAD from
that:
=# SET "intervalstylE" to popo;
ERROR: 22023: invalid value for parameter "intervalstylE": "popo"
To that:
=# SET "intervalstylE" to popo;
ERROR: 22023: invalid value for parameter "IntervalStyle": "popo"

And then came the idea to
determine the quoting dynamically, which I think everyone agreed was too
much. So I don't see a way to make this work well.

Yeah, with the quotes being language-dependent, any idea I can think
of is as good as unreliable and dead.
--
Michael

#47Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#46)
Re: GUC names in messages

Hi,

This thread seems to be a bit stuck, so I thought I would try to
summarize my understanding to hopefully get it moving again...

The original intent of the thread was just to introduce some
guidelines for quoting or not quoting GUC names in messages because
previously it seemed quite ad-hoc. Along the way, there was some scope
creep. IIUC, now there are 3 main topics in this thread:

1. GUC name quoting
2. GUC name case
3. Using common messages

======

#1. GUC name quoting.

Some basic guidelines were decided and a patch is already pushed [1]GUC quoting guidelines -- https://www.postgresql.org/docs/devel/error-style-guide.html.

<para>
In messages containing configuration variable names, do not include quotes
when the names are visibly not natural English words, such as when they
have underscores, are all-uppercase or have mixed case. Otherwise, quotes
must be added. Do include quotes in a message where an arbitrary variable
name is to be expanded.
</para>

AFAIK there is nothing controversial there, although maybe the
guideline for 'mixed case' needs revisiting depending on objections
about point #2.

~~~

#2. GUC name case.

GUC names defined in guc_tables.c are either lowercase (xxxx),
lowercase with underscores (xxxx_yyyy) or mixed case (XxxxYyyy).

There are only a few examples of mixed case. They are a bit
problematic, but IIUC they are not going to change away so we need to
deal with them:
- TimeZone
- DateStyle
- IntervalStyle

It was proposed (e.g. [2]Case in messages should be same as pg_settings -- /messages/by-id/db3e4290ced77111c17e7a2adfb1d660734f5f78.camel@cybertec.at) that it would be better/intuitive if the
GUC name of the error message would be the same case as in the
guc_table.c. In other words, other words you should be able to find
the same name from the message in pg_settings.

So mesages with "datestyle" should become DateStyle because:
SELECT * FROM pg_settings WHERE name = 'DateStyle'; ==> found
SELECT * FROM pg_settings WHERE name = 'datestlye'; ==> not found

That latest v5 patches make those adjustments
- Patch v5-0001 fixes case for DateStyle. Yeah, there is some diff
churn because there are a lot of DateStyle tests, but IMO that's too
bad.
- Patch v5-0002 fixed case for IntervalStyle.

~~~

#3. Using common messages

Any message with a non-translatable component to them (e.g. the GUC
name) can be restructured in a way so there is a common translatable
errmsg part with the non-translatable parameters substituted.

e.g.
- GUC_check_errdetail("The only allowed value is \"immediate\".");
+ GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");

AFAIK think there is no disagreement that this is a good idea,
although IMO it deserved to be in a separate thread.

I think there will be many messages that qualify to be modified, and
probably there will be some discussion about whether certain common
messages that can be merged -- (e.g. Is "You might need to increase
%s." same as "Consider increasing %s." or not?).

Anyway, this part is a WIP. Currently, patch v5-0003 makes a start for
this task.

//////

I think patches v5-0002, v5-0003 are uncontroversial.

So the sticking point seems to be the MixedCase GUC (e.g. patch
v5-0001). I agree, that the churn is not ideal (it's only because
there are lots of DateStyle messages in test output), but OTOH that's
just what happens if a rule is applied when previously there were no
rules.

Also, PeterE wrote [4]PeterE concerna about DateStyle -- /messages/by-id/6d66eb1a-290d-4aaa-972a-0a06a1af02af@eisentraut.org

On Thu, Dec 14, 2023 at 09:38:40AM +0100, Peter Eisentraut wrote:

After these discussions, I think this rule change was not a good idea. It
effectively enforces these kinds of inconsistencies. For example, if you
ever refactored

"DateStyle is wrong"

to

"%s is wrong"

you'd need to adjust the quotes, and thus user-visible behavior, for
entirely internal reasons. This is not good.

I didn't understand the problem. By the current guidelines the mixed
case GUC won't quoted in the message (see patch v5-0001)

So whether it is:
errmsg("DateStyle is wrong"), OR
errmsg("%s is wrong", "DateStyle")

where is the "you'd need to adjust the quotes" problem there?

======
[1]: GUC quoting guidelines -- https://www.postgresql.org/docs/devel/error-style-guide.html
https://www.postgresql.org/docs/devel/error-style-guide.html
[2]: Case in messages should be same as pg_settings -- /messages/by-id/db3e4290ced77111c17e7a2adfb1d660734f5f78.camel@cybertec.at
/messages/by-id/db3e4290ced77111c17e7a2adfb1d660734f5f78.camel@cybertec.at
[3]: v5 patches -- /messages/by-id/202312081255.wlsfmhe2sri7@alvherre.pgsql
/messages/by-id/202312081255.wlsfmhe2sri7@alvherre.pgsql
[4]: PeterE concerna about DateStyle -- /messages/by-id/6d66eb1a-290d-4aaa-972a-0a06a1af02af@eisentraut.org
/messages/by-id/6d66eb1a-290d-4aaa-972a-0a06a1af02af@eisentraut.org

Kind Regards,
Peter Smith.
Fujitsu Australia

#48Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Smith (#47)
Re: GUC names in messages

On 21.12.23 07:24, Peter Smith wrote:

#1. GUC name quoting.

Some basic guidelines were decided and a patch is already pushed [1].

<para>
In messages containing configuration variable names, do not include quotes
when the names are visibly not natural English words, such as when they
have underscores, are all-uppercase or have mixed case. Otherwise, quotes
must be added. Do include quotes in a message where an arbitrary variable
name is to be expanded.
</para>

AFAIK there is nothing controversial there, although maybe the
guideline for 'mixed case' needs revisiting depending on objections
about point #2.

Now that I read this again, I think this is wrong.

We should decide the quoting for a category, not the actual content.
Like, quote all file names; do not quote keywords.

This led to the attempted patch to decide the quoting of GUC parameter
names dynamically based on the actual content, which no one really
liked. But then, to preserve consistency, we also need to be uniform in
quoting GUC parameter names where the name is hardcoded.

#49Peter Smith
smithpb2250@gmail.com
In reply to: Peter Eisentraut (#48)
5 attachment(s)
Re: GUC names in messages

On Fri, Dec 22, 2023 at 12:24 AM Peter Eisentraut <peter@eisentraut.org> wrote:

On 21.12.23 07:24, Peter Smith wrote:

#1. GUC name quoting.

Some basic guidelines were decided and a patch is already pushed [1].

<para>
In messages containing configuration variable names, do not include quotes
when the names are visibly not natural English words, such as when they
have underscores, are all-uppercase or have mixed case. Otherwise, quotes
must be added. Do include quotes in a message where an arbitrary variable
name is to be expanded.
</para>

AFAIK there is nothing controversial there, although maybe the
guideline for 'mixed case' needs revisiting depending on objections
about point #2.

Now that I read this again, I think this is wrong.

We should decide the quoting for a category, not the actual content.
Like, quote all file names; do not quote keywords.

This led to the attempted patch to decide the quoting of GUC parameter
names dynamically based on the actual content, which no one really
liked. But then, to preserve consistency, we also need to be uniform in
quoting GUC parameter names where the name is hardcoded.

I agree. By attempting to define when to and when not to use quotes it
has become overcomplicated.

Earlier in the thread, I counted how quotes were used in the existing
messages [5]/messages/by-id/CAHut+PtqTao+OKRxGcCzUxt9h9d0=TQZZoRjMYe3xe0-O7_hsQ@mail.gmail.com; there were ~39 quoted and 164 not quoted. Based on that
we chose to stay with the majority, and leave all the unquoted ones so
only adding quotes "when necessary". In hindsight, that was probably
the wrong choice because it opened a can of worms about what "when
necessary" even means (e.g. what about underscores, mixed case etc).

Certainly one simple rule "just quote everything" is easiest to follow.

~~~

OPTION#1. DO quote hardcoded GUC names everywhere
- pro: consistent with the dynamic names, which are always quoted
- pro: no risk of mistaking GUC names for normal words in the message
- con: more patch changes than not quoting

Laurenz [2]/messages/by-id/4b83f9888428925e3049e24b60a73f4b94dc2368.camel@cybertec.at "My personal preference is to always quote GUC names"
Nathan [3]/messages/by-id/20231102015239.GA82553@nathanxps13[4]/messages/by-id/20231107145821.GA779199@nathanxps13 "І'd vote for quoting all GUC names, if for no other
reason than "visibly not English natural words" feels a bit open to
interpretation."
PeterE [6]/messages/by-id/1704b2cf-2444-484a-a7a4-2ba79f72951d@eisentraut.org "... to preserve consistency, we also need to be uniform in
quoting GUC parameter names where the name is hardcoded."

~

OPTION#2. DO NOT quote hardcoded GUC names anywhere
- pro: less patch changes than quoting everything
- con: not consistent with the dynamic names, which are always quoted
- con: risk of mistaking GUC names for normal words in the message

PeterE, originally [1]/messages/by-id/22998fc0-93c2-48d2-b0f9-361cd5764695@eisentraut.org said "I'm leaning toward not quoting GUC
names", but IIUC changed his opinion in [6]/messages/by-id/1704b2cf-2444-484a-a7a4-2ba79f72951d@eisentraut.org.

~~~

Given the above, I've updated the v6 patch set to just *always* quote
GUC names. The docs are also re-written.

======
[1]: /messages/by-id/22998fc0-93c2-48d2-b0f9-361cd5764695@eisentraut.org
[2]: /messages/by-id/4b83f9888428925e3049e24b60a73f4b94dc2368.camel@cybertec.at
[3]: /messages/by-id/20231102015239.GA82553@nathanxps13
[4]: /messages/by-id/20231107145821.GA779199@nathanxps13
[5]: /messages/by-id/CAHut+PtqTao+OKRxGcCzUxt9h9d0=TQZZoRjMYe3xe0-O7_hsQ@mail.gmail.com
[6]: /messages/by-id/1704b2cf-2444-484a-a7a4-2ba79f72951d@eisentraut.org

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v6-0001-GUC-names-docs.patchapplication/octet-stream; name=v6-0001-GUC-names-docs.patchDownload
From 90739ae9e5c3067e91e8cd4781f3fe29eea67c99 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Wed, 3 Jan 2024 14:45:52 +1100
Subject: [PATCH v6] GUC names - docs

---
 doc/src/sgml/sources.sgml | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/doc/src/sgml/sources.sgml b/doc/src/sgml/sources.sgml
index 5d1d510..827f5fe 100644
--- a/doc/src/sgml/sources.sgml
+++ b/doc/src/sgml/sources.sgml
@@ -533,17 +533,10 @@ Hint:       The addendum, written as a complete sentence.
    <title>Use of Quotes</title>
 
    <para>
-    Always use quotes to delimit file names, user-supplied identifiers, and
-    other variables that might contain words.  Do not use them to mark up
-    variables that will not contain words (for example, operator names).
-   </para>
-
-   <para>
-    In messages containing configuration variable names, do not include quotes
-    when the names are visibly not natural English words, such as when they
-    have underscores, are all-uppercase or have mixed case. Otherwise, quotes
-    must be added. Do include quotes in a message where an arbitrary variable
-    name is to be expanded.
+    Always use quotes to delimit file names, user-supplied identifiers,
+    configuration variable names, and other variables that might contain words.
+    Do not use them to mark up variables that will not contain words (for
+    example, operator names).
    </para>
 
    <para>
-- 
1.8.3.1

v6-0005-GUC-names-make-common-translatable-message-string.patchapplication/octet-stream; name=v6-0005-GUC-names-make-common-translatable-message-string.patchDownload
From 4d37a563e0bff3b984e87ab4929156c2fb8469c3 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 4 Jan 2024 17:36:23 +1100
Subject: [PATCH v6] GUC names - make common translatable message strings

---
 contrib/pg_prewarm/autoprewarm.c          |  2 +-
 src/backend/access/transam/xlog.c         | 79 +++++++++++++++++++------------
 src/backend/access/transam/xlogrecovery.c |  2 +-
 src/backend/commands/variable.c           | 11 +++--
 src/backend/port/sysv_shmem.c             |  3 +-
 src/backend/postmaster/bgworker.c         |  3 +-
 src/backend/postmaster/checkpointer.c     |  3 +-
 src/backend/replication/syncrep.c         |  3 +-
 src/backend/storage/file/fd.c             |  9 ++--
 src/backend/storage/lmgr/predicate.c      |  6 ++-
 src/backend/tcop/postgres.c               | 15 +++---
 src/backend/utils/fmgr/dfmgr.c            | 16 +++----
 12 files changed, 94 insertions(+), 58 deletions(-)

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 6c9cd22..6fd1767a 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -877,7 +877,7 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing configuration parameter \"%s\".", "max_worker_processes")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index becb32b..e40a2bc 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4222,16 +4222,22 @@ ReadControlFile(void)
 	if (ControlFile->catalog_version_no != CATALOG_VERSION_NO)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-						   " but the server was compiled with CATALOG_VERSION_NO %d.",
-						   ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "CATALOG_VERSION_NO",
+						   ControlFile->catalog_version_no,
+						   "CATALOG_VERSION_NO",
+						   CATALOG_VERSION_NO),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with MAXALIGN %d,"
-						   " but the server was compiled with MAXALIGN %d.",
-						   ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "MAXALIGN", ControlFile->maxAlign,
+						   "MAXALIGN", MAXIMUM_ALIGNOF),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
 		ereport(FATAL,
@@ -4241,51 +4247,64 @@ ReadControlFile(void)
 	if (ControlFile->blcksz != BLCKSZ)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with BLCKSZ %d,"
-						   " but the server was compiled with BLCKSZ %d.",
-						   ControlFile->blcksz, BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "BLCKSZ", ControlFile->blcksz, "BLCKSZ", BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->relseg_size != RELSEG_SIZE)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with RELSEG_SIZE %d,"
-						   " but the server was compiled with RELSEG_SIZE %d.",
-						   ControlFile->relseg_size, RELSEG_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "RELSEG_SIZE", ControlFile->relseg_size,
+						   "RELSEG_SIZE", RELSEG_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->xlog_blcksz != XLOG_BLCKSZ)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with XLOG_BLCKSZ %d,"
-						   " but the server was compiled with XLOG_BLCKSZ %d.",
-						   ControlFile->xlog_blcksz, XLOG_BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "XLOG_BLCKSZ", ControlFile->xlog_blcksz,
+						   "XLOG_BLCKSZ", XLOG_BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->nameDataLen != NAMEDATALEN)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with NAMEDATALEN %d,"
-						   " but the server was compiled with NAMEDATALEN %d.",
-						   ControlFile->nameDataLen, NAMEDATALEN),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "NAMEDATALEN", ControlFile->nameDataLen,
+						   "NAMEDATALEN", NAMEDATALEN),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
-						   " but the server was compiled with INDEX_MAX_KEYS %d.",
-						   ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "INDEX_MAX_KEYS", ControlFile->indexMaxKeys,
+						   "INDEX_MAX_KEYS", INDEX_MAX_KEYS),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
-						   " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
-						   ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "TOAST_MAX_CHUNK_SIZE", ControlFile->toast_max_chunk_size,
+						   "TOAST_MAX_CHUNK_SIZE", (int) TOAST_MAX_CHUNK_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->loblksize != LOBLKSIZE)
 		ereport(FATAL,
 				(errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with LOBLKSIZE %d,"
-						   " but the server was compiled with LOBLKSIZE %d.",
-						   ControlFile->loblksize, (int) LOBLKSIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "LOBLKSIZE", ControlFile->loblksize,
+						   "LOBLKSIZE", (int) LOBLKSIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef USE_FLOAT8_BYVAL
@@ -4321,11 +4340,13 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "min_wal_size", "wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "max_wal_size", "wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 23449ff..ed3304d 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -4730,7 +4730,7 @@ check_recovery_target(char **newval, void **extra, GucSource source)
 {
 	if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("The only allowed value is \"immediate\".");
+		GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");
 		return false;
 	}
 	return true;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index a72db8b..2325045 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"%s\" specifications.", "DateStyle");
 		return false;
 	}
 
@@ -717,7 +717,8 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change \"%s\" now.",
+								"client_encoding");
 		}
 		return false;
 	}
@@ -1202,7 +1203,8 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"effective_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"effective_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1215,7 +1217,8 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"maintenance_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"maintenance_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index a145615..f0a787a 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -580,7 +580,8 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be 0 on this platform.",
+							"huge_page_size");
 		return false;
 	}
 #endif
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index 4cc33fe..f646079 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -918,7 +918,8 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 								  "Up to %d background workers can be registered with the current settings.",
 								  max_worker_processes,
 								  max_worker_processes),
-				 errhint("Consider increasing the configuration parameter max_worker_processes.")));
+				 errhint("Consider increasing the configuration parameter \"%s\".",
+						 "max_worker_processes")));
 		return;
 	}
 
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 6cd9d9e..101fa52 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -443,7 +443,8 @@ CheckpointerMain(void)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"%s\".", "max_wal_size")));
+						 errhint("Consider increasing the configuration parameter \"%s\".",
+								 "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 172a750..cfb1f61 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1016,7 +1016,8 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("\"synchronous_standby_names\" parser failed");
+				GUC_check_errdetail("\"%s\" parser failed",
+									"synchronous_standby_names");
 			return false;
 		}
 
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index c0c65ea..e44c5fb 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3924,7 +3924,8 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported on this platform.");
+		GUC_check_errdetail("\"%s\" is not supported on this platform.",
+						   "debug_io_direct");
 		result = false;
 	}
 	flags = 0;
@@ -3971,14 +3972,16 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "XLOG_BLCKSZ");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "BLCKSZ");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index e121c25..c8e45a5 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1644,8 +1644,10 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
-				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
+				 errdetail("\"%s\" is set to \"%s\"."
+						   "default_transaction_isolation", "serializable"),
+				 errhint("You can use \"%s\" to change the default.",
+						"SET default_transaction_isolation = 'repeatable read'")));
 
 	/*
 	 * A special optimization is available for SERIALIZABLE READ ONLY
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 1aa5f5b..7ec6969 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3571,7 +3571,8 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("\"%s\" must not exceed %ldkB.",
+							"max_stack_depth",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3596,7 +3597,8 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on this platform.",
+							"client_connection_check_interval");
 		return false;
 	}
 	return true;
@@ -3617,7 +3619,8 @@ check_stage_log_stats(bool *newval, void **extra, GucSource source)
 {
 	if (*newval && log_statement_stats)
 	{
-		GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
+		GUC_check_errdetail("Cannot enable parameter when \"%s\" is true.",
+							"log_statement_stats");
 		return false;
 	}
 	return true;
@@ -3632,9 +3635,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable \"%s\" when \"%s\", \"%s\", or \"%s\" is true.",
+							"log_statement_stats",
+							"log_parser_stats", "log_planner_stats", "log_executor_stats");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index b85d52c..24b71f3 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -358,8 +358,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FUNC_MAX_ARGS = %d, library has %d."),
-						 magic_data.funcmaxargs,
+						 _("Server has %s = %d, library has %d."),
+						 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
 						 module_magic_data->funcmaxargs);
 	}
 	if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
@@ -367,8 +367,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has INDEX_MAX_KEYS = %d, library has %d."),
-						 magic_data.indexmaxkeys,
+						 _("Server has %s = %d, library has %d."),
+						 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
 						 module_magic_data->indexmaxkeys);
 	}
 	if (module_magic_data->namedatalen != magic_data.namedatalen)
@@ -376,8 +376,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has NAMEDATALEN = %d, library has %d."),
-						 magic_data.namedatalen,
+						 _("Server has %s = %d, library has %d."),
+						 "NAMEDATALEN", magic_data.namedatalen,
 						 module_magic_data->namedatalen);
 	}
 	if (module_magic_data->float8byval != magic_data.float8byval)
@@ -385,8 +385,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FLOAT8PASSBYVAL = %s, library has %s."),
-						 magic_data.float8byval ? "true" : "false",
+						 _("Server has %s = %s, library has %s."),
+						 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
 						 module_magic_data->float8byval ? "true" : "false");
 	}
 
-- 
1.8.3.1

v6-0003-GUC-names-fix-case-intervalstyle.patchapplication/octet-stream; name=v6-0003-GUC-names-fix-case-intervalstyle.patchDownload
From 44a736a48d3c8f2afcfa2e1485aae2cf32d2820f Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 4 Jan 2024 15:04:44 +1100
Subject: [PATCH v6] GUC names - fix case intervalstyle

---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 494110b..f95b8fb 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3252,7 +3252,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 127c953..66ddc4c 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761..98d8ae4 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,7 +2,10 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
 -- SET to some nondefault value
+
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
 SHOW vacuum_cost_delay;
-- 
1.8.3.1

v6-0004-GUC-names-fix-case-datestyle.patchapplication/octet-stream; name=v6-0004-GUC-names-fix-case-datestyle.patchDownload
From 3e3abbbe25cf72d9f21fef24894730bda41b5443 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 4 Jan 2024 15:16:45 +1100
Subject: [PATCH v6] GUC names - fix case datestyle

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 0935d85..a72db8b 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index fca9a2a..87c2c09 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4022,7 +4022,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different \"DateStyle\" setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..e936f66 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index cfb4b20..821d160 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

v6-0002-GUC-names-add-quotes.patchapplication/octet-stream; name=v6-0002-GUC-names-add-quotes.patchDownload
From 7cafc15b8ff6613de071bdc9e0d86a10700e3a53 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 4 Jan 2024 14:44:01 +1100
Subject: [PATCH v6] GUC names - add quotes

---
 contrib/adminpack/adminpack.c                      |  2 +-
 contrib/pg_prewarm/autoprewarm.c                   |  4 ++--
 contrib/pg_stat_statements/pg_stat_statements.c    |  6 ++---
 contrib/sepgsql/hooks.c                            |  2 +-
 contrib/test_decoding/expected/slot.out            |  2 +-
 src/backend/access/gin/ginbulk.c                   |  2 +-
 src/backend/access/heap/vacuumlazy.c               |  2 +-
 src/backend/access/table/tableamapi.c              |  4 ++--
 src/backend/access/transam/commit_ts.c             |  4 ++--
 src/backend/access/transam/multixact.c             |  4 ++--
 src/backend/access/transam/rmgr.c                  |  4 ++--
 src/backend/access/transam/twophase.c              |  6 ++---
 src/backend/access/transam/xlog.c                  | 26 +++++++++++-----------
 src/backend/access/transam/xlogarchive.c           |  2 +-
 src/backend/access/transam/xlogfuncs.c             |  4 ++--
 src/backend/access/transam/xlogprefetcher.c        |  2 +-
 src/backend/access/transam/xlogrecovery.c          | 12 +++++-----
 src/backend/commands/publicationcmds.c             |  4 ++--
 src/backend/commands/vacuum.c                      |  2 +-
 src/backend/commands/variable.c                    |  8 +++----
 src/backend/libpq/be-secure-openssl.c              |  4 ++--
 src/backend/libpq/hba.c                            |  2 +-
 src/backend/libpq/pqcomm.c                         |  2 +-
 src/backend/parser/scan.l                          |  2 +-
 src/backend/port/sysv_sema.c                       |  2 +-
 src/backend/port/sysv_shmem.c                      |  8 +++----
 src/backend/port/win32_shmem.c                     |  2 +-
 src/backend/postmaster/bgworker.c                  |  4 ++--
 src/backend/postmaster/checkpointer.c              |  4 ++--
 src/backend/postmaster/pgarch.c                    | 10 ++++-----
 src/backend/postmaster/postmaster.c                | 10 ++++-----
 src/backend/replication/logical/decode.c           |  2 +-
 src/backend/replication/logical/launcher.c         |  4 ++--
 src/backend/replication/logical/logical.c          |  4 ++--
 src/backend/replication/logical/origin.c           |  8 +++----
 src/backend/replication/slot.c                     | 20 ++++++++---------
 src/backend/replication/syncrep.c                  |  2 +-
 src/backend/storage/buffer/localbuf.c              |  2 +-
 src/backend/storage/file/fd.c                      |  8 +++----
 src/backend/storage/lmgr/lock.c                    | 12 +++++-----
 src/backend/storage/lmgr/predicate.c               | 12 +++++-----
 src/backend/storage/lmgr/proc.c                    |  2 +-
 src/backend/tcop/postgres.c                        | 12 +++++-----
 src/backend/utils/adt/pg_locale.c                  |  4 ++--
 src/backend/utils/adt/varlena.c                    |  2 +-
 src/backend/utils/fmgr/dfmgr.c                     |  4 ++--
 src/backend/utils/misc/guc.c                       |  2 +-
 src/backend/utils/misc/guc_tables.c                | 24 ++++++++++----------
 src/bin/initdb/initdb.c                            |  4 ++--
 src/bin/pg_basebackup/streamutil.c                 |  6 ++---
 src/bin/pg_controldata/pg_controldata.c            |  2 +-
 src/bin/pg_dump/pg_backup_archiver.c               |  6 ++---
 src/bin/pg_dump/pg_dump.c                          |  4 ++--
 src/bin/pg_rewind/libpq_source.c                   |  4 ++--
 src/bin/pg_rewind/pg_rewind.c                      |  6 ++---
 src/bin/pg_test_fsync/pg_test_fsync.c              |  2 +-
 src/bin/pg_upgrade/check.c                         |  6 ++---
 src/bin/pg_upgrade/t/003_logical_slots.pl          |  4 ++--
 src/bin/pg_upgrade/t/004_subscription.pl           |  4 ++--
 src/bin/pgbench/pgbench.c                          |  2 +-
 src/fe_utils/archive.c                             |  2 +-
 src/interfaces/libpq/fe-auth.c                     |  2 +-
 src/interfaces/libpq/fe-connect.c                  |  4 ++--
 src/test/modules/libpq_pipeline/libpq_pipeline.c   |  4 ++--
 .../ssl_passphrase_callback/ssl_passphrase_func.c  |  2 +-
 .../ssl_passphrase_callback/t/001_testfunc.pl      |  2 +-
 src/test/modules/test_shm_mq/setup.c               |  2 +-
 src/test/modules/test_slru/test_slru.c             |  2 +-
 src/test/recovery/t/024_archive_recovery.pl        |  4 ++--
 .../recovery/t/035_standby_logical_decoding.pl     |  2 +-
 src/test/regress/expected/collate.icu.utf8.out     |  4 ++--
 src/test/regress/expected/create_am.out            |  2 +-
 src/test/regress/expected/json.out                 |  4 ++--
 src/test/regress/expected/jsonb.out                |  4 ++--
 src/test/regress/expected/prepared_xacts_1.out     | 18 +++++++--------
 src/test/regress/expected/strings.out              | 12 +++++-----
 src/test/subscription/t/001_rep_changes.pl         |  4 ++--
 77 files changed, 200 insertions(+), 200 deletions(-)

diff --git a/contrib/adminpack/adminpack.c b/contrib/adminpack/adminpack.c
index d3aec7b..93f4c7f 100644
--- a/contrib/adminpack/adminpack.c
+++ b/contrib/adminpack/adminpack.c
@@ -508,7 +508,7 @@ pg_logdir_ls_internal(FunctionCallInfo fcinfo)
 	if (strcmp(Log_filename, "postgresql-%Y-%m-%d_%H%M%S.log") != 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("the log_filename parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'")));
+				 errmsg("the \"log_filename\" parameter must equal 'postgresql-%%Y-%%m-%%d_%%H%%M%%S.log'")));
 
 	/* check to see if caller supports us returning a tuplestore */
 	if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 0993bd2..6c9cd22 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -841,7 +841,7 @@ apw_start_leader_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("could not register background process"),
-				 errhint("You may need to increase max_worker_processes.")));
+				 errhint("You may need to increase \"max_worker_processes\".")));
 
 	status = WaitForBackgroundWorkerStartup(handle, &pid);
 	if (status != BGWH_STARTED)
@@ -877,7 +877,7 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter max_worker_processes.")));
+				 errhint("Consider increasing configuration parameter \"max_worker_processes\".")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c
index 6f62a53..94a7979 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.c
+++ b/contrib/pg_stat_statements/pg_stat_statements.c
@@ -1659,7 +1659,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo,
 	if (!pgss || !pgss_hash)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("pg_stat_statements must be loaded via shared_preload_libraries")));
+				 errmsg("\"pg_stat_statements\" must be loaded via \"shared_preload_libraries\"")));
 
 	InitMaterializedSRF(fcinfo, 0);
 
@@ -1988,7 +1988,7 @@ pg_stat_statements_info(PG_FUNCTION_ARGS)
 	if (!pgss || !pgss_hash)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("pg_stat_statements must be loaded via shared_preload_libraries")));
+				 errmsg("\"pg_stat_statements\" must be loaded via \"shared_preload_libraries\"")));
 
 	/* Build a tuple descriptor for our result type */
 	if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -2670,7 +2670,7 @@ entry_reset(Oid userid, Oid dbid, uint64 queryid, bool minmax_only)
 	if (!pgss || !pgss_hash)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("pg_stat_statements must be loaded via shared_preload_libraries")));
+				 errmsg("\"pg_stat_statements\" must be loaded via \"shared_preload_libraries\"")));
 
 	LWLockAcquire(pgss->lock, LW_EXCLUSIVE);
 	num_entries = hash_get_num_entries(pgss_hash);
diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c
index fa73476..471825e 100644
--- a/contrib/sepgsql/hooks.c
+++ b/contrib/sepgsql/hooks.c
@@ -406,7 +406,7 @@ _PG_init(void)
 	if (IsUnderPostmaster)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("sepgsql must be loaded via shared_preload_libraries")));
+				 errmsg("sepgsql must be loaded via \"shared_preload_libraries\"")));
 
 	/*
 	 * Check availability of SELinux on the platform. If disabled, we cannot
diff --git a/contrib/test_decoding/expected/slot.out b/contrib/test_decoding/expected/slot.out
index 63a9940..a3eed5b 100644
--- a/contrib/test_decoding/expected/slot.out
+++ b/contrib/test_decoding/expected/slot.out
@@ -220,7 +220,7 @@ ORDER BY o.slot_name, c.slot_name;
 -- released even when raise error during creating the target slot.
 SELECT 'copy' FROM pg_copy_logical_replication_slot('orig_slot1', 'failed'); -- error
 ERROR:  all replication slots are in use
-HINT:  Free one or increase max_replication_slots.
+HINT:  Free one or increase "max_replication_slots".
 -- temporary slots were dropped automatically
 SELECT pg_drop_replication_slot('orig_slot1');
  pg_drop_replication_slot 
diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c
index 57c218c..0406e29 100644
--- a/src/backend/access/gin/ginbulk.c
+++ b/src/backend/access/gin/ginbulk.c
@@ -42,7 +42,7 @@ ginCombineData(RBTNode *existing, const RBTNode *newdata, void *arg)
 			ereport(ERROR,
 					(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
 					 errmsg("posting list is too long"),
-					 errhint("Reduce maintenance_work_mem.")));
+					 errhint("Reduce \"maintenance_work_mem\".")));
 
 		accum->allocatedMemory -= GetMemoryChunkSpace(eo->list);
 		eo->maxcount *= 2;
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 3b9299b..59f51f4 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -2658,7 +2658,7 @@ lazy_check_wraparound_failsafe(LVRelState *vacrel)
 						vacrel->dbname, vacrel->relnamespace, vacrel->relname,
 						vacrel->num_index_scans),
 				 errdetail("The table's relfrozenxid or relminmxid is too far in the past."),
-				 errhint("Consider increasing configuration parameter maintenance_work_mem or autovacuum_work_mem.\n"
+				 errhint("Consider increasing configuration parameter \"maintenance_work_mem\" or \"autovacuum_work_mem\".\n"
 						 "You might also need to consider other ways for VACUUM to keep up with the allocation of transaction IDs.")));
 
 		/* Stop applying cost limits from this point on */
diff --git a/src/backend/access/table/tableamapi.c b/src/backend/access/table/tableamapi.c
index d7798b6..383d24e 100644
--- a/src/backend/access/table/tableamapi.c
+++ b/src/backend/access/table/tableamapi.c
@@ -113,14 +113,14 @@ check_default_table_access_method(char **newval, void **extra, GucSource source)
 {
 	if (**newval == '\0')
 	{
-		GUC_check_errdetail("%s cannot be empty.",
+		GUC_check_errdetail("\"%s\" cannot be empty.",
 							"default_table_access_method");
 		return false;
 	}
 
 	if (strlen(*newval) >= NAMEDATALEN)
 	{
-		GUC_check_errdetail("%s is too long (maximum %d characters).",
+		GUC_check_errdetail("\"%s\" is too long (maximum %d characters).",
 							"default_table_access_method", NAMEDATALEN - 1);
 		return false;
 	}
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index e6fd9b3..7761830 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -385,9 +385,9 @@ error_commit_ts_disabled(void)
 			(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 			 errmsg("could not get commit timestamp data"),
 			 RecoveryInProgress() ?
-			 errhint("Make sure the configuration parameter %s is set on the primary server.",
+			 errhint("Make sure the configuration parameter \"%s\" is set on the primary server.",
 					 "track_commit_timestamp") :
-			 errhint("Make sure the configuration parameter %s is set.",
+			 errhint("Make sure the configuration parameter \"%s\" is set.",
 					 "track_commit_timestamp")));
 }
 
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index db3423f..93dc9df 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -1124,7 +1124,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
 								  MultiXactState->offsetStopLimit - nextOffset - 1,
 								  nmembers,
 								  MultiXactState->offsetStopLimit - nextOffset - 1),
-				 errhint("Execute a database-wide VACUUM in database with OID %u with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.",
+				 errhint("Execute a database-wide VACUUM in database with OID %u with reduced \"vacuum_multixact_freeze_min_age\" and \"vacuum_multixact_freeze_table_age\" settings.",
 						 MultiXactState->oldestMultiXactDB)));
 	}
 
@@ -1160,7 +1160,7 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
 							   MultiXactState->offsetStopLimit - nextOffset + nmembers,
 							   MultiXactState->oldestMultiXactDB,
 							   MultiXactState->offsetStopLimit - nextOffset + nmembers),
-				 errhint("Execute a database-wide VACUUM in that database with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.")));
+				 errhint("Execute a database-wide VACUUM in that database with reduced \"vacuum_multixact_freeze_min_age\" and \"vacuum_multixact_freeze_table_age\" settings.")));
 
 	ExtendMultiXactMember(nextOffset, nmembers);
 
diff --git a/src/backend/access/transam/rmgr.c b/src/backend/access/transam/rmgr.c
index 7d67eda..45fc9eb 100644
--- a/src/backend/access/transam/rmgr.c
+++ b/src/backend/access/transam/rmgr.c
@@ -82,7 +82,7 @@ void
 RmgrNotFound(RmgrId rmid)
 {
 	ereport(ERROR, (errmsg("resource manager with ID %d not registered", rmid),
-					errhint("Include the extension module that implements this resource manager in shared_preload_libraries.")));
+					errhint("Include the extension module that implements this resource manager in \"shared_preload_libraries\".")));
 }
 
 /*
@@ -109,7 +109,7 @@ RegisterCustomRmgr(RmgrId rmid, const RmgrData *rmgr)
 	if (!process_shared_preload_libraries_in_progress)
 		ereport(ERROR,
 				(errmsg("failed to register custom resource manager \"%s\" with ID %d", rmgr->rm_name, rmid),
-				 errdetail("Custom resource manager must be registered while initializing modules in shared_preload_libraries.")));
+				 errdetail("Custom resource manager must be registered while initializing modules in \"shared_preload_libraries\".")));
 
 	if (RmgrTable[rmid].rm_name != NULL)
 		ereport(ERROR,
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 11e1446..0c7d735 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -391,7 +391,7 @@ MarkAsPreparing(TransactionId xid, const char *gid,
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("prepared transactions are disabled"),
-				 errhint("Set max_prepared_transactions to a nonzero value.")));
+				 errhint("Set \"max_prepared_transactions\" to a nonzero value.")));
 
 	/* on first call, register the exit hook */
 	if (!twophaseExitRegistered)
@@ -420,7 +420,7 @@ MarkAsPreparing(TransactionId xid, const char *gid,
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("maximum number of prepared transactions reached"),
-				 errhint("Increase max_prepared_transactions (currently %d).",
+				 errhint("Increase \"max_prepared_transactions\" (currently %d).",
 						 max_prepared_xacts)));
 	gxact = TwoPhaseState->freeGXacts;
 	TwoPhaseState->freeGXacts = gxact->next;
@@ -2555,7 +2555,7 @@ PrepareRedoAdd(char *buf, XLogRecPtr start_lsn,
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("maximum number of prepared transactions reached"),
-				 errhint("Increase max_prepared_transactions (currently %d).",
+				 errhint("Increase \"max_prepared_transactions\" (currently %d).",
 						 max_prepared_xacts)));
 	gxact = TwoPhaseState->freeGXacts;
 	TwoPhaseState->freeGXacts = gxact->next;
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 1264849..becb32b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4321,11 +4321,11 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("min_wal_size must be at least twice wal_segment_size")));
+						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("max_wal_size must be at least twice wal_segment_size")));
+						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
@@ -5174,9 +5174,9 @@ CheckRequiredParameterValues(void)
 	if (ArchiveRecoveryRequested && ControlFile->wal_level == WAL_LEVEL_MINIMAL)
 	{
 		ereport(FATAL,
-				(errmsg("WAL was generated with wal_level=minimal, cannot continue recovering"),
-				 errdetail("This happens if you temporarily set wal_level=minimal on the server."),
-				 errhint("Use a backup taken after setting wal_level to higher than minimal.")));
+				(errmsg("WAL was generated with \"wal_level=minimal\", cannot continue recovering"),
+				 errdetail("This happens if you temporarily set \"wal_level=minimal\" on the server."),
+				 errhint("Use a backup taken after setting \"wal_level\" to higher than \"minimal\".")));
 	}
 
 	/*
@@ -8360,7 +8360,7 @@ get_sync_bit(int method)
 #endif
 		default:
 			/* can't happen (unless we are out of sync with option array) */
-			elog(ERROR, "unrecognized wal_sync_method: %d", method);
+			elog(ERROR, "unrecognized \"wal_sync_method\": %d", method);
 			return 0;			/* silence warning */
 	}
 }
@@ -8456,7 +8456,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
 			Assert(false);
 			break;
 		default:
-			elog(PANIC, "unrecognized wal_sync_method: %d", wal_sync_method);
+			elog(PANIC, "unrecognized \"wal_sync_method\": %d", wal_sync_method);
 			break;
 	}
 
@@ -8534,7 +8534,7 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("WAL level not sufficient for making an online backup"),
-				 errhint("wal_level must be set to \"replica\" or \"logical\" at server start.")));
+				 errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
 
 	if (strlen(backupidstr) > MAXPGPATH)
 		ereport(ERROR,
@@ -8660,11 +8660,11 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
 				if (!checkpointfpw || state->startpoint <= recptr)
 					ereport(ERROR,
 							(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-							 errmsg("WAL generated with full_page_writes=off was replayed "
+							 errmsg("WAL generated with \"full_page_writes=off\" was replayed "
 									"since last restartpoint"),
 							 errhint("This means that the backup being taken on the standby "
 									 "is corrupt and should not be used. "
-									 "Enable full_page_writes and run CHECKPOINT on the primary, "
+									 "Enable \"full_page_writes\" and run CHECKPOINT on the primary, "
 									 "and then try an online backup again.")));
 
 				/*
@@ -8956,11 +8956,11 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
 		if (state->startpoint <= recptr)
 			ereport(ERROR,
 					(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-					 errmsg("WAL generated with full_page_writes=off was replayed "
+					 errmsg("WAL generated with \"full_page_writes=off\" was replayed "
 							"during online backup"),
 					 errhint("This means that the backup being taken on the standby "
 							 "is corrupt and should not be used. "
-							 "Enable full_page_writes and run CHECKPOINT on the primary, "
+							 "Enable \"full_page_writes\" and run CHECKPOINT on the primary, "
 							 "and then try an online backup again.")));
 
 
@@ -9088,7 +9088,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
 				ereport(WARNING,
 						(errmsg("still waiting for all required WAL segments to be archived (%d seconds elapsed)",
 								waits),
-						 errhint("Check that your archive_command is executing properly.  "
+						 errhint("Check that your \"archive_command\" is executing properly.  "
 								 "You can safely cancel this backup, "
 								 "but the database backup will not be usable without all the WAL segments.")));
 			}
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index 524e80a..e825032 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -234,7 +234,7 @@ RestoreArchivedFile(char *path, const char *xlogfname,
 			ereport(elevel,
 					(errcode_for_file_access(),
 					 errmsg("could not stat file \"%s\": %m", xlogpath),
-					 errdetail("restore_command returned a zero exit status, but stat() failed.")));
+					 errdetail("\"restore_command\" returned a zero exit status, but stat() failed.")));
 		}
 	}
 
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 45452d9..a238c9a 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -218,7 +218,7 @@ pg_log_standby_snapshot(PG_FUNCTION_ARGS)
 	if (!XLogStandbyInfoActive())
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("pg_log_standby_snapshot() can only be used if wal_level >= replica")));
+				 errmsg("pg_log_standby_snapshot() can only be used if \"wal_level\" >= \"replica\"")));
 
 	recptr = LogStandbySnapshot();
 
@@ -251,7 +251,7 @@ pg_create_restore_point(PG_FUNCTION_ARGS)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("WAL level not sufficient for creating a restore point"),
-				 errhint("wal_level must be set to \"replica\" or \"logical\" at server start.")));
+				 errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
 
 	restore_name_str = text_to_cstring(restore_name);
 
diff --git a/src/backend/access/transam/xlogprefetcher.c b/src/backend/access/transam/xlogprefetcher.c
index a98336f..a0d8e31 100644
--- a/src/backend/access/transam/xlogprefetcher.c
+++ b/src/backend/access/transam/xlogprefetcher.c
@@ -1089,7 +1089,7 @@ check_recovery_prefetch(int *new_value, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*new_value == RECOVERY_PREFETCH_ON)
 	{
-		GUC_check_errdetail("recovery_prefetch is not supported on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"recovery_prefetch\" is not supported on platforms that lack posix_fadvise().");
 		return false;
 	}
 #endif
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 6f4f81f..23449ff 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -1090,7 +1090,7 @@ validateRecoveryParameters(void)
 		if ((PrimaryConnInfo == NULL || strcmp(PrimaryConnInfo, "") == 0) &&
 			(recoveryRestoreCommand == NULL || strcmp(recoveryRestoreCommand, "") == 0))
 			ereport(WARNING,
-					(errmsg("specified neither primary_conninfo nor restore_command"),
+					(errmsg("specified neither \"primary_conninfo\" nor \"restore_command\""),
 					 errhint("The database server will regularly poll the pg_wal subdirectory to check for files placed there.")));
 	}
 	else
@@ -1099,7 +1099,7 @@ validateRecoveryParameters(void)
 			strcmp(recoveryRestoreCommand, "") == 0)
 			ereport(FATAL,
 					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("must specify restore_command when standby mode is not enabled")));
+					 errmsg("must specify \"restore_command\" when standby mode is not enabled")));
 	}
 
 	/*
@@ -2118,7 +2118,7 @@ CheckTablespaceDirectory(void)
 					 errmsg("unexpected directory entry \"%s\" found in %s",
 							de->d_name, "pg_tblspc/"),
 					 errdetail("All directory entries in pg_tblspc/ should be symbolic links."),
-					 errhint("Remove those directories, or set allow_in_place_tablespaces to ON transiently to let recovery complete.")));
+					 errhint("Remove those directories, or set \"allow_in_place_tablespaces\" to ON transiently to let recovery complete.")));
 	}
 }
 
@@ -4719,7 +4719,7 @@ error_multiple_recovery_targets(void)
 	ereport(ERROR,
 			(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 			 errmsg("multiple recovery targets specified"),
-			 errdetail("At most one of recovery_target, recovery_target_lsn, recovery_target_name, recovery_target_time, recovery_target_xid may be set.")));
+			 errdetail("At most one of \"recovery_target\", \"recovery_target_lsn\", \"recovery_target_name\", \"recovery_target_time\", \"recovery_target_xid\" may be set.")));
 }
 
 /*
@@ -4803,7 +4803,7 @@ check_recovery_target_name(char **newval, void **extra, GucSource source)
 	/* Use the value of newval directly */
 	if (strlen(*newval) >= MAXFNAMELEN)
 	{
-		GUC_check_errdetail("%s is too long (maximum %d characters).",
+		GUC_check_errdetail("\"%s\" is too long (maximum %d characters).",
 							"recovery_target_name", MAXFNAMELEN - 1);
 		return false;
 	}
@@ -4927,7 +4927,7 @@ check_recovery_target_timeline(char **newval, void **extra, GucSource source)
 		strtoul(*newval, NULL, 0);
 		if (errno == EINVAL || errno == ERANGE)
 		{
-			GUC_check_errdetail("recovery_target_timeline is not a valid number.");
+			GUC_check_errdetail("\"recovery_target_timeline\" is not a valid number.");
 			return false;
 		}
 	}
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index f4ba572..0942939 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -865,8 +865,8 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
 	if (wal_level != WAL_LEVEL_LOGICAL)
 		ereport(WARNING,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("wal_level is insufficient to publish logical changes"),
-				 errhint("Set wal_level to \"logical\" before creating subscriptions.")));
+				 errmsg("\"wal_level\" is insufficient to publish logical changes"),
+				 errhint("Set \"wal_level\" to \"logical\" before creating subscriptions.")));
 
 	return myself;
 }
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index be43b46..8bdbee6 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -134,7 +134,7 @@ check_vacuum_buffer_usage_limit(int *newval, void **extra,
 		return true;
 
 	/* Value does not fall within any allowable range */
-	GUC_check_errdetail("vacuum_buffer_usage_limit must be 0 or between %d kB and %d kB",
+	GUC_check_errdetail("\"vacuum_buffer_usage_limit\" must be 0 or between %d kB and %d kB",
 						MIN_BAS_VAC_RING_SIZE_KB, MAX_BAS_VAC_RING_SIZE_KB);
 
 	return false;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index c361bb2..0935d85 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -717,7 +717,7 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change client_encoding now.");
+			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
 		}
 		return false;
 	}
@@ -778,7 +778,7 @@ assign_client_encoding(const char *newval, void *extra)
 		 */
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
-				 errmsg("cannot change client_encoding during a parallel operation")));
+				 errmsg("cannot change \"client_encoding\" during a parallel operation")));
 	}
 
 	/* We do not expect an error if PrepareClientEncoding succeeded */
@@ -1202,7 +1202,7 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("effective_io_concurrency must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"effective_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1215,7 +1215,7 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("maintenance_io_concurrency must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"maintenance_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c
index 22e3dc5..fb41472 100644
--- a/src/backend/libpq/be-secure-openssl.c
+++ b/src/backend/libpq/be-secure-openssl.c
@@ -195,7 +195,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 			/*- translator: first %s is a GUC option name, second %s is its value */
-					(errmsg("%s setting \"%s\" not supported by this build",
+					(errmsg("\"%s\" setting \"%s\" not supported by this build",
 							"ssl_min_protocol_version",
 							GetConfigOption("ssl_min_protocol_version",
 											false, false))));
@@ -245,7 +245,7 @@ be_tls_init(bool isServerStart)
 		{
 			ereport(isServerStart ? FATAL : LOG,
 					(errmsg("could not set SSL protocol version range"),
-					 errdetail("%s cannot be higher than %s",
+					 errdetail("\"%s\" cannot be higher than \"%s\"",
 							   "ssl_min_protocol_version",
 							   "ssl_max_protocol_version")));
 			goto error;
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index ac602bf..b22716d 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -1383,7 +1383,7 @@ parse_hba_line(TokenizedAuthLine *tok_line, int elevel)
 				ereport(elevel,
 						(errcode(ERRCODE_CONFIG_FILE_ERROR),
 						 errmsg("hostssl record cannot match because SSL is disabled"),
-						 errhint("Set ssl = on in postgresql.conf."),
+						 errhint("Set \"ssl = on\" in postgresql.conf."),
 						 errcontext("line %d of configuration file \"%s\"",
 									line_num, file_name)));
 				*err_msg = "hostssl record cannot match because SSL is disabled";
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 0084a9b..ff61f86 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -636,7 +636,7 @@ Setup_AF_UNIX(const char *sock_path)
 	if (Unix_socket_group[0] != '\0')
 	{
 #ifdef WIN32
-		elog(WARNING, "configuration item unix_socket_group is not supported on this platform");
+		elog(WARNING, "configuration item \"unix_socket_group\" is not supported on this platform");
 #else
 		char	   *endptr;
 		unsigned long val;
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index 0708ba6..c304012 100644
--- a/src/backend/parser/scan.l
+++ b/src/backend/parser/scan.l
@@ -564,7 +564,7 @@ other			.
 						ereport(ERROR,
 								(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 								 errmsg("unsafe use of string constant with Unicode escapes"),
-								 errdetail("String constants with Unicode escapes cannot be used when standard_conforming_strings is off."),
+								 errdetail("String constants with Unicode escapes cannot be used when \"standard_conforming_strings\" is off."),
 								 lexer_errposition()));
 					BEGIN(xus);
 					startlit();
diff --git a/src/backend/port/sysv_sema.c b/src/backend/port/sysv_sema.c
index 0e9c359..adb62ba 100644
--- a/src/backend/port/sysv_sema.c
+++ b/src/backend/port/sysv_sema.c
@@ -127,7 +127,7 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey, int numSems)
 						 "semaphore sets (SEMMNI), or the system wide maximum number of "
 						 "semaphores (SEMMNS), would be exceeded.  You need to raise the "
 						 "respective kernel parameter.  Alternatively, reduce PostgreSQL's "
-						 "consumption of semaphores by reducing its max_connections parameter.\n"
+						 "consumption of semaphores by reducing its \"max_connections\" parameter.\n"
 						 "The PostgreSQL documentation contains more information about "
 						 "configuring your system for PostgreSQL.") : 0));
 	}
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 2de280e..a145615 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -580,7 +580,7 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("huge_page_size must be 0 on this platform.");
+		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
 		return false;
 	}
 #endif
@@ -657,8 +657,8 @@ CreateAnonymousSegment(Size *size)
 						 "for a shared memory segment exceeded available memory, "
 						 "swap space, or huge pages. To reduce the request size "
 						 "(currently %zu bytes), reduce PostgreSQL's shared "
-						 "memory usage, perhaps by reducing shared_buffers or "
-						 "max_connections.",
+						 "memory usage, perhaps by reducing \"shared_buffers\" or "
+						 "\"max_connections\".",
 						 allocsize) : 0));
 	}
 
@@ -728,7 +728,7 @@ PGSharedMemoryCreate(Size size,
 	if (huge_pages == HUGE_PAGES_ON && shared_memory_type != SHMEM_TYPE_MMAP)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("huge pages not supported with the current shared_memory_type setting")));
+				 errmsg("huge pages not supported with the current \"shared_memory_type\" setting")));
 
 	/* Room for a header? */
 	Assert(size > MAXALIGN(sizeof(PGShmemHeader)));
diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c
index 05494c1..bab571d 100644
--- a/src/backend/port/win32_shmem.c
+++ b/src/backend/port/win32_shmem.c
@@ -643,7 +643,7 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 {
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("huge_page_size must be 0 on this platform.");
+		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index 3c99cf6..4cc33fe 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -259,7 +259,7 @@ BackgroundWorkerStateChange(bool allow_new_workers)
 	if (max_worker_processes != BackgroundWorkerData->total_slots)
 	{
 		ereport(LOG,
-				(errmsg("inconsistent background worker state (max_worker_processes=%d, total_slots=%d)",
+				(errmsg("inconsistent background worker state (\"max_worker_processes=%d\", \"total_slots=%d\")",
 						max_worker_processes,
 						BackgroundWorkerData->total_slots)));
 		return;
@@ -875,7 +875,7 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 			return;
 		ereport(LOG,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-				 errmsg("background worker \"%s\": must be registered in shared_preload_libraries",
+				 errmsg("background worker \"%s\": must be registered in \"shared_preload_libraries\"",
 						worker->bgw_name)));
 		return;
 	}
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 67ecb17..6cd9d9e 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -443,7 +443,7 @@ CheckpointerMain(void)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter max_wal_size.")));
+						 errhint("Consider increasing the configuration parameter \"%s\".", "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
@@ -662,7 +662,7 @@ CheckArchiveTimeout(void)
 			 * assume nothing happened.
 			 */
 			if (XLogSegmentOffset(switchpoint, wal_segment_size) != 0)
-				elog(DEBUG1, "write-ahead log switch forced (archive_timeout=%d)",
+				elog(DEBUG1, "write-ahead log switch forced (\"archive_timeout=%d\")",
 					 XLogArchiveTimeout);
 		}
 
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index a2555e8..15174b0 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -413,7 +413,7 @@ pgarch_ArchiverCopyLoop(void)
 				!ArchiveCallbacks->check_configured_cb(archive_module_state))
 			{
 				ereport(WARNING,
-						(errmsg("archive_mode enabled, yet archiving is not configured")));
+						(errmsg("\"archive_mode\" enabled, yet archiving is not configured")));
 				return;
 			}
 
@@ -788,8 +788,8 @@ HandlePgArchInterrupts(void)
 		if (XLogArchiveLibrary[0] != '\0' && XLogArchiveCommand[0] != '\0')
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					 errmsg("both archive_command and archive_library set"),
-					 errdetail("Only one of archive_command, archive_library may be set.")));
+					 errmsg("both \"archive_command\" and \"archive_library\" set"),
+					 errdetail("Only one of \"archive_command\", \"archive_library\" may be set.")));
 
 		archiveLibChanged = strcmp(XLogArchiveLibrary, archiveLib) != 0;
 		pfree(archiveLib);
@@ -827,8 +827,8 @@ LoadArchiveLibrary(void)
 	if (XLogArchiveLibrary[0] != '\0' && XLogArchiveCommand[0] != '\0')
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("both archive_command and archive_library set"),
-				 errdetail("Only one of archive_command, archive_library may be set.")));
+				 errmsg("both \"archive_command\" and \"archive_library\" set"),
+				 errdetail("Only one of \"archive_command\", \"archive_library\" may be set.")));
 
 	/*
 	 * If shell archiving is enabled, use our special initialization function.
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index fb04e4d..fba5686 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -925,7 +925,7 @@ PostmasterMain(int argc, char *argv[])
 	 */
 	if (SuperuserReservedConnections + ReservedConnections >= MaxConnections)
 	{
-		write_stderr("%s: superuser_reserved_connections (%d) plus reserved_connections (%d) must be less than max_connections (%d)\n",
+		write_stderr("%s: \"superuser_reserved_connections\" (%d) plus \"reserved_connections\" (%d) must be less than \"max_connections\" (%d)\n",
 					 progname,
 					 SuperuserReservedConnections, ReservedConnections,
 					 MaxConnections);
@@ -933,13 +933,13 @@ PostmasterMain(int argc, char *argv[])
 	}
 	if (XLogArchiveMode > ARCHIVE_MODE_OFF && wal_level == WAL_LEVEL_MINIMAL)
 		ereport(ERROR,
-				(errmsg("WAL archival cannot be enabled when wal_level is \"minimal\"")));
+				(errmsg("WAL archival cannot be enabled when \"wal_level\" is \"minimal\"")));
 	if (max_wal_senders > 0 && wal_level == WAL_LEVEL_MINIMAL)
 		ereport(ERROR,
-				(errmsg("WAL streaming (max_wal_senders > 0) requires wal_level \"replica\" or \"logical\"")));
+				(errmsg("WAL streaming (\"max_wal_senders\" > 0) requires \"wal_level\" to be \"replica\" or \"logical\"")));
 	if (summarize_wal && wal_level == WAL_LEVEL_MINIMAL)
 		ereport(ERROR,
-				(errmsg("WAL cannot be summarized when wal_level is \"minimal\"")));
+				(errmsg("WAL cannot be summarized when \"wal_level\" is \"minimal\"")));
 
 	/*
 	 * Other one-time internal sanity checks can go here, if they are fast.
@@ -3892,7 +3892,7 @@ PostmasterStateMachine(void)
 		if (!restart_after_crash)
 		{
 			ereport(LOG,
-					(errmsg("shutting down because restart_after_crash is off")));
+					(errmsg("shutting down because \"restart_after_crash\" is off")));
 			ExitPostmaster(1);
 		}
 	}
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 1237118..75e2a5c 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -177,7 +177,7 @@ xlog_decode(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 					Assert(RecoveryInProgress());
 					ereport(ERROR,
 							(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-							 errmsg("logical decoding on standby requires wal_level >= logical on the primary")));
+							 errmsg("logical decoding on standby requires \"wal_level\" >= \"logical\" on the primary")));
 				}
 				break;
 			}
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 501910b..7663ac1 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -431,7 +431,7 @@ retry:
 		ereport(WARNING,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
 				 errmsg("out of logical replication worker slots"),
-				 errhint("You might need to increase %s.", "max_logical_replication_workers")));
+				 errhint("You might need to increase \"%s\".", "max_logical_replication_workers")));
 		return false;
 	}
 
@@ -517,7 +517,7 @@ retry:
 		ereport(WARNING,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
 				 errmsg("out of background worker slots"),
-				 errhint("You might need to increase %s.", "max_worker_processes")));
+				 errhint("You might need to increase \"%s\".", "max_worker_processes")));
 		return false;
 	}
 
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index 8288da5..a37f54f 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -119,7 +119,7 @@ CheckLogicalDecodingRequirements(void)
 	if (wal_level < WAL_LEVEL_LOGICAL)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("logical decoding requires wal_level >= logical")));
+				 errmsg("logical decoding requires \"wal_level\" >= \"logical\"")));
 
 	if (MyDatabaseId == InvalidOid)
 		ereport(ERROR,
@@ -139,7 +139,7 @@ CheckLogicalDecodingRequirements(void)
 		if (GetActiveWalLevelOnStandby() < WAL_LEVEL_LOGICAL)
 			ereport(ERROR,
 					(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-					 errmsg("logical decoding on standby requires wal_level >= logical on the primary")));
+					 errmsg("logical decoding on standby requires \"wal_level\" >= \"logical\" on the primary")));
 	}
 }
 
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index 460e3dc..443a0c5 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -187,7 +187,7 @@ replorigin_check_prerequisites(bool check_slots, bool recoveryOK)
 	if (check_slots && max_replication_slots == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("cannot query or manipulate replication origin when max_replication_slots = 0")));
+				 errmsg("cannot query or manipulate replication origin when \"max_replication_slots\" = 0")));
 
 	if (!recoveryOK && RecoveryInProgress())
 		ereport(ERROR,
@@ -795,7 +795,7 @@ StartupReplicationOrigin(void)
 		if (last_state == max_replication_slots)
 			ereport(PANIC,
 					(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-					 errmsg("could not find free replication state, increase max_replication_slots")));
+					 errmsg("could not find free replication state, increase \"max_replication_slots\"")));
 
 		/* copy data to shared memory */
 		replication_states[last_state].roident = disk_state.roident;
@@ -954,7 +954,7 @@ replorigin_advance(RepOriginId node,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
 				 errmsg("could not find free replication state slot for replication origin with ID %d",
 						node),
-				 errhint("Increase max_replication_slots and try again.")));
+				 errhint("Increase \"max_replication_slots\" and try again.")));
 
 	if (replication_state == NULL)
 	{
@@ -1153,7 +1153,7 @@ replorigin_session_setup(RepOriginId node, int acquired_by)
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
 				 errmsg("could not find free replication state slot for replication origin with ID %d",
 						node),
-				 errhint("Increase max_replication_slots and try again.")));
+				 errhint("Increase \"max_replication_slots\" and try again.")));
 	else if (session_replication_state == NULL)
 	{
 		/* initialize new slot */
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
index 18bc281..47c9f0a 100644
--- a/src/backend/replication/slot.c
+++ b/src/backend/replication/slot.c
@@ -293,7 +293,7 @@ ReplicationSlotCreate(const char *name, bool db_specific,
 		ereport(ERROR,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
 				 errmsg("all replication slots are in use"),
-				 errhint("Free one or increase max_replication_slots.")));
+				 errhint("Free one or increase \"max_replication_slots\".")));
 
 	/*
 	 * Since this slot is not in use, nobody should be looking at any part of
@@ -1173,12 +1173,12 @@ CheckSlotRequirements(void)
 	if (max_replication_slots == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("replication slots can only be used if max_replication_slots > 0")));
+				 errmsg("replication slots can only be used if \"max_replication_slots\" > 0")));
 
 	if (wal_level < WAL_LEVEL_REPLICA)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("replication slots can only be used if wal_level >= replica")));
+				 errmsg("replication slots can only be used if \"wal_level\" >= \"replica\"")));
 }
 
 /*
@@ -1312,7 +1312,7 @@ ReportSlotInvalidation(ReplicationSlotInvalidationCause cause,
 			break;
 
 		case RS_INVAL_WAL_LEVEL:
-			appendStringInfoString(&err_detail, _("Logical decoding on standby requires wal_level >= logical on the primary server."));
+			appendStringInfoString(&err_detail, _("Logical decoding on standby requires \"wal_level\" >= \"logical\" on the primary server."));
 			break;
 		case RS_INVAL_NONE:
 			pg_unreachable();
@@ -1325,7 +1325,7 @@ ReportSlotInvalidation(ReplicationSlotInvalidationCause cause,
 			errmsg("invalidating obsolete replication slot \"%s\"",
 				   NameStr(slotname)),
 			errdetail_internal("%s", err_detail.data),
-			hint ? errhint("You might need to increase %s.", "max_slot_wal_keep_size") : 0);
+			hint ? errhint("You might need to increase \"%s\".", "max_slot_wal_keep_size") : 0);
 
 	pfree(err_detail.data);
 }
@@ -2113,15 +2113,15 @@ RestoreSlotFromDisk(const char *name)
 	if (cp.slotdata.database != InvalidOid && wal_level < WAL_LEVEL_LOGICAL)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("logical replication slot \"%s\" exists, but wal_level < logical",
+				 errmsg("logical replication slot \"%s\" exists, but \"wal_level\" < \"logical\"",
 						NameStr(cp.slotdata.name)),
-				 errhint("Change wal_level to be logical or higher.")));
+				 errhint("Change \"wal_level\" to be \"logical\" or higher.")));
 	else if (wal_level < WAL_LEVEL_REPLICA)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				 errmsg("physical replication slot \"%s\" exists, but wal_level < replica",
+				 errmsg("physical replication slot \"%s\" exists, but \"wal_level\" < \"replica\"",
 						NameStr(cp.slotdata.name)),
-				 errhint("Change wal_level to be replica or higher.")));
+				 errhint("Change \"wal_level\" to be \"replica\" or higher.")));
 
 	/* nothing can be active yet, don't lock anything */
 	for (i = 0; i < max_replication_slots; i++)
@@ -2157,5 +2157,5 @@ RestoreSlotFromDisk(const char *name)
 	if (!restored)
 		ereport(FATAL,
 				(errmsg("too many replication slots active before shutdown"),
-				 errhint("Increase max_replication_slots and try again.")));
+				 errhint("Increase \"max_replication_slots\" and try again.")));
 }
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 88f8958..172a750 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1016,7 +1016,7 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("synchronous_standby_names parser failed");
+				GUC_check_errdetail("\"synchronous_standby_names\" parser failed");
 			return false;
 		}
 
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index d1cdd3e..487a230 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -705,7 +705,7 @@ check_temp_buffers(int *newval, void **extra, GucSource source)
 	 */
 	if (source != PGC_S_TEST && NLocBuffer && NLocBuffer != *newval)
 	{
-		GUC_check_errdetail("temp_buffers cannot be changed after any temporary tables have been accessed in the session.");
+		GUC_check_errdetail("\"temp_buffers\" cannot be changed after any temporary tables have been accessed in the session.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index fbffdd7..c0c65ea 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3924,7 +3924,7 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("debug_io_direct is not supported on this platform.");
+		GUC_check_errdetail("\"debug_io_direct\" is not supported on this platform.");
 		result = false;
 	}
 	flags = 0;
@@ -3938,7 +3938,7 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 
 	if (!SplitGUCList(rawstring, ',', &elemlist))
 	{
-		GUC_check_errdetail("invalid list syntax in parameter %s",
+		GUC_check_errdetail("invalid list syntax in parameter \"%s\"",
 							"debug_io_direct");
 		pfree(rawstring);
 		list_free(elemlist);
@@ -3971,14 +3971,14 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("debug_io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("\"debug_io_direct\" is not supported for WAL because XLOG_BLCKSZ is too small");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("debug_io_direct is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("\"debug_io_direct\" is not supported for data because BLCKSZ is too small");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index b8c57b3..6e00dcd 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -961,7 +961,7 @@ LockAcquireExtended(const LOCKTAG *locktag,
 				ereport(ERROR,
 						(errcode(ERRCODE_OUT_OF_MEMORY),
 						 errmsg("out of shared memory"),
-						 errhint("You might need to increase %s.", "max_locks_per_transaction")));
+						 errhint("You might need to increase \"%s\".", "max_locks_per_transaction")));
 			else
 				return LOCKACQUIRE_NOT_AVAIL;
 		}
@@ -999,7 +999,7 @@ LockAcquireExtended(const LOCKTAG *locktag,
 			ereport(ERROR,
 					(errcode(ERRCODE_OUT_OF_MEMORY),
 					 errmsg("out of shared memory"),
-					 errhint("You might need to increase %s.", "max_locks_per_transaction")));
+					 errhint("You might need to increase \"%s\".", "max_locks_per_transaction")));
 		else
 			return LOCKACQUIRE_NOT_AVAIL;
 	}
@@ -2784,7 +2784,7 @@ FastPathGetRelationLockEntry(LOCALLOCK *locallock)
 			ereport(ERROR,
 					(errcode(ERRCODE_OUT_OF_MEMORY),
 					 errmsg("out of shared memory"),
-					 errhint("You might need to increase %s.", "max_locks_per_transaction")));
+					 errhint("You might need to increase \"%s\".", "max_locks_per_transaction")));
 		}
 		GrantLock(proclock->tag.myLock, proclock, lockmode);
 		FAST_PATH_CLEAR_LOCKMODE(MyProc, f, lockmode);
@@ -4169,7 +4169,7 @@ lock_twophase_recover(TransactionId xid, uint16 info,
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("out of shared memory"),
-				 errhint("You might need to increase %s.", "max_locks_per_transaction")));
+				 errhint("You might need to increase \"%s\".", "max_locks_per_transaction")));
 	}
 
 	/*
@@ -4234,7 +4234,7 @@ lock_twophase_recover(TransactionId xid, uint16 info,
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("out of shared memory"),
-				 errhint("You might need to increase %s.", "max_locks_per_transaction")));
+				 errhint("You might need to increase \"%s\".", "max_locks_per_transaction")));
 	}
 
 	/*
@@ -4584,7 +4584,7 @@ VirtualXactLock(VirtualTransactionId vxid, bool wait)
 			ereport(ERROR,
 					(errcode(ERRCODE_OUT_OF_MEMORY),
 					 errmsg("out of shared memory"),
-					 errhint("You might need to increase %s.", "max_locks_per_transaction")));
+					 errhint("You might need to increase \"%s\".", "max_locks_per_transaction")));
 		}
 		GrantLock(proclock->tag.myLock, proclock, ExclusiveLock);
 
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 1129b8e..e121c25 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -647,7 +647,7 @@ SetRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("not enough elements in RWConflictPool to record a read/write conflict"),
-				 errhint("You might need to run fewer transactions at a time or increase max_connections.")));
+				 errhint("You might need to run fewer transactions at a time or increase \"max_connections\".")));
 
 	conflict = dlist_head_element(RWConflictData, outLink, &RWConflictPool->availableList);
 	dlist_delete(&conflict->outLink);
@@ -672,7 +672,7 @@ SetPossibleUnsafeConflict(SERIALIZABLEXACT *roXact,
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("not enough elements in RWConflictPool to record a potential read/write conflict"),
-				 errhint("You might need to run fewer transactions at a time or increase max_connections.")));
+				 errhint("You might need to run fewer transactions at a time or increase \"max_connections\".")));
 
 	conflict = dlist_head_element(RWConflictData, outLink, &RWConflictPool->availableList);
 	dlist_delete(&conflict->outLink);
@@ -1644,7 +1644,7 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("default_transaction_isolation is set to \"serializable\"."),
+				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
 				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
 
 	/*
@@ -2427,7 +2427,7 @@ CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("out of shared memory"),
-				 errhint("You might need to increase %s.", "max_pred_locks_per_transaction")));
+				 errhint("You might need to increase \"%s\".", "max_pred_locks_per_transaction")));
 	if (!found)
 		dlist_init(&target->predicateLocks);
 
@@ -2442,7 +2442,7 @@ CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag,
 		ereport(ERROR,
 				(errcode(ERRCODE_OUT_OF_MEMORY),
 				 errmsg("out of shared memory"),
-				 errhint("You might need to increase %s.", "max_pred_locks_per_transaction")));
+				 errhint("You might need to increase \"%s\".", "max_pred_locks_per_transaction")));
 
 	if (!found)
 	{
@@ -3839,7 +3839,7 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
 				ereport(ERROR,
 						(errcode(ERRCODE_OUT_OF_MEMORY),
 						 errmsg("out of shared memory"),
-						 errhint("You might need to increase %s.", "max_pred_locks_per_transaction")));
+						 errhint("You might need to increase \"%s\".", "max_pred_locks_per_transaction")));
 			if (found)
 			{
 				Assert(predlock->commitSeqNo != 0);
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index b6451d9..e4e91ab 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -346,7 +346,7 @@ InitProcess(void)
 		if (am_walsender)
 			ereport(FATAL,
 					(errcode(ERRCODE_TOO_MANY_CONNECTIONS),
-					 errmsg("number of requested standby connections exceeds max_wal_senders (currently %d)",
+					 errmsg("number of requested standby connections exceeds \"max_wal_senders\" (currently %d)",
 							max_wal_senders)));
 		ereport(FATAL,
 				(errcode(ERRCODE_TOO_MANY_CONNECTIONS),
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 7298a18..1aa5f5b 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3524,7 +3524,7 @@ check_stack_depth(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
 				 errmsg("stack depth limit exceeded"),
-				 errhint("Increase the configuration parameter max_stack_depth (currently %dkB), "
+				 errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), "
 						 "after ensuring the platform's stack depth limit is adequate.",
 						 max_stack_depth)));
 	}
@@ -3571,7 +3571,7 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("max_stack_depth must not exceed %ldkB.",
+		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3596,7 +3596,7 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("client_connection_check_interval must be set to 0 on this platform.");
+		GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
 		return false;
 	}
 	return true;
@@ -3632,9 +3632,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable log_statement_stats when "
-							"log_parser_stats, log_planner_stats, "
-							"or log_executor_stats is true.");
+		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
+							"\"log_parser_stats\", \"log_planner_stats\", "
+							"or \"log_executor_stats\" is true.");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 1dee462..d5003da 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -2875,7 +2875,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("could not get language from ICU locale \"%s\": %s",
 						loc_str, u_errorName(status)),
-				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
 						 "icu_validation_level", "disabled")));
 		return;
 	}
@@ -2904,7 +2904,7 @@ icu_validate_locale(const char *loc_str)
 		ereport(elevel,
 				(errmsg("ICU locale \"%s\" has unknown language \"%s\"",
 						loc_str, lang),
-				 errhint("To disable ICU locale validation, set the parameter %s to \"%s\".",
+				 errhint("To disable ICU locale validation, set the parameter \"%s\" to \"%s\".",
 						 "icu_validation_level", "disabled")));
 
 	/* check that it can be opened */
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index f6b1156..08810c3 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -456,7 +456,7 @@ byteaout(PG_FUNCTION_ARGS)
 	}
 	else
 	{
-		elog(ERROR, "unrecognized bytea_output setting: %d",
+		elog(ERROR, "unrecognized \"bytea_output\" setting: %d",
 			 bytea_output);
 		rp = result = NULL;		/* keep compiler quiet */
 	}
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 56724ff..b85d52c 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -555,7 +555,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (piece == p)
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("zero-length component in parameter dynamic_library_path")));
+					 errmsg("zero-length component in parameter \"dynamic_library_path\"")));
 
 		if (piece == NULL)
 			len = strlen(p);
@@ -574,7 +574,7 @@ find_in_dynamic_libpath(const char *basename)
 		if (!is_absolute_path(mangled))
 			ereport(ERROR,
 					(errcode(ERRCODE_INVALID_NAME),
-					 errmsg("component in parameter dynamic_library_path is not an absolute path")));
+					 errmsg("component in parameter \"dynamic_library_path\" is not an absolute path")));
 
 		full = palloc(strlen(mangled) + 1 + baselen + 1);
 		sprintf(full, "%s/%s", mangled, basename);
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index d929a17..494110b 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1873,7 +1873,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
 	else
 	{
 		write_stderr("%s does not know where to find the database system data.\n"
-					 "This can be specified as data_directory in \"%s\", "
+					 "This can be specified as \"data_directory\" in \"%s\", "
 					 "or by the -D invocation option, or by the "
 					 "PGDATA environment variable.\n",
 					 progname, ConfigFileName);
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 3945a92..8b9f2b2 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -1104,7 +1104,7 @@ struct config_bool ConfigureNamesBool[] =
 	},
 	{
 		{"ssl_passphrase_command_supports_reload", PGC_SIGHUP, CONN_AUTH_SSL,
-			gettext_noop("Controls whether ssl_passphrase_command is called during server reload."),
+			gettext_noop("Controls whether \"ssl_passphrase_command\" is called during server reload."),
 			NULL
 		},
 		&ssl_passphrase_command_supports_reload,
@@ -1152,7 +1152,7 @@ struct config_bool ConfigureNamesBool[] =
 			gettext_noop("Continues processing past damaged page headers."),
 			gettext_noop("Detection of a damaged page header normally causes PostgreSQL to "
 						 "report an error, aborting the current transaction. Setting "
-						 "zero_damaged_pages to true causes the system to instead report a "
+						 "\"zero_damaged_page\" to true causes the system to instead report a "
 						 "warning, zero out the damaged page, and continue processing. This "
 						 "behavior will destroy data, namely all the rows on the damaged page."),
 			GUC_NOT_IN_SAMPLE
@@ -1167,7 +1167,7 @@ struct config_bool ConfigureNamesBool[] =
 			gettext_noop("Detection of WAL records having references to "
 						 "invalid pages during recovery causes PostgreSQL to "
 						 "raise a PANIC-level error, aborting the recovery. "
-						 "Setting ignore_invalid_pages to true causes "
+						 "Setting \"ignore_invalid_pages\" to true causes "
 						 "the system to ignore invalid page references "
 						 "in WAL records (but still report a warning), "
 						 "and continue recovery. This behavior may cause "
@@ -2644,7 +2644,7 @@ struct config_int ConfigureNamesInt[] =
 		{"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
 			gettext_noop("Sets the maximum number of locks per transaction."),
 			gettext_noop("The shared lock table is sized on the assumption that at most "
-						 "max_locks_per_transaction objects per server process or prepared "
+						 "\"max_locks_per_transaction\" objects per server process or prepared "
 						 "transaction will need to be locked at any one time.")
 		},
 		&max_locks_per_xact,
@@ -2656,7 +2656,7 @@ struct config_int ConfigureNamesInt[] =
 		{"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
 			gettext_noop("Sets the maximum number of predicate locks per transaction."),
 			gettext_noop("The shared predicate lock table is sized on the assumption that "
-						 "at most max_pred_locks_per_transaction objects per server process "
+						 "at most \"max_pred_locks_per_transaction\" objects per server process "
 						 "or prepared transaction will need to be locked at any one time.")
 		},
 		&max_predicate_locks_per_xact,
@@ -2907,7 +2907,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"commit_siblings", PGC_USERSET, WAL_SETTINGS,
 			gettext_noop("Sets the minimum number of concurrent open transactions "
-						 "required before performing commit_delay."),
+						 "required before performing \"commit_delay\"."),
 			NULL
 		},
 		&CommitSiblings,
@@ -3039,7 +3039,7 @@ struct config_int ConfigureNamesInt[] =
 		{"maintenance_io_concurrency",
 			PGC_USERSET,
 			RESOURCES_ASYNCHRONOUS,
-			gettext_noop("A variant of effective_io_concurrency that is used for maintenance work."),
+			gettext_noop("A variant of \"effective_io_concurrency\" that is used for maintenance work."),
 			NULL,
 			GUC_EXPLAIN
 		},
@@ -3732,7 +3732,7 @@ struct config_real ConfigureNamesReal[] =
 
 	{
 		{"hash_mem_multiplier", PGC_USERSET, RESOURCES_MEM,
-			gettext_noop("Multiple of work_mem to use for hash tables."),
+			gettext_noop("Multiple of \"work_mem\" to use for hash tables."),
 			NULL,
 			GUC_EXPLAIN
 		},
@@ -3826,7 +3826,7 @@ struct config_real ConfigureNamesReal[] =
 
 	{
 		{"log_statement_sample_rate", PGC_SUSET, LOGGING_WHEN,
-			gettext_noop("Fraction of statements exceeding log_min_duration_sample to be logged."),
+			gettext_noop("Fraction of statements exceeding \"log_min_duration_sample\" to be logged."),
 			gettext_noop("Use a value between 0.0 (never log) and 1.0 (always log).")
 		},
 		&log_statement_sample_rate,
@@ -3857,7 +3857,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_command", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the shell command that will be called to archive a WAL file."),
-			gettext_noop("This is used only if archive_library is not set.")
+			gettext_noop("This is used only if \"archive_library\" is not set.")
 		},
 		&XLogArchiveCommand,
 		"",
@@ -3867,7 +3867,7 @@ struct config_string ConfigureNamesString[] =
 	{
 		{"archive_library", PGC_SIGHUP, WAL_ARCHIVING,
 			gettext_noop("Sets the library that will be called to archive a WAL file."),
-			gettext_noop("An empty string indicates that archive_command should be used.")
+			gettext_noop("An empty string indicates that \"archive_command\" should be used.")
 		},
 		&XLogArchiveLibrary,
 		"",
@@ -4798,7 +4798,7 @@ struct config_enum ConfigureNamesEnum[] =
 
 	{
 		{"archive_mode", PGC_POSTMASTER, WAL_ARCHIVING,
-			gettext_noop("Allows archiving of WAL files using archive_command."),
+			gettext_noop("Allows archiving of WAL files using \"archive_command\"."),
 			NULL
 		},
 		&XLogArchiveMode,
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index e68b40d..0dc5149 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1085,7 +1085,7 @@ test_config_settings(void)
 	 * Probe for max_connections before shared_buffers, since it is subject to
 	 * more constraints than shared_buffers.
 	 */
-	printf(_("selecting default max_connections ... "));
+	printf(_("selecting default \"max_connections\" ... "));
 	fflush(stdout);
 
 	for (i = 0; i < connslen; i++)
@@ -1105,7 +1105,7 @@ test_config_settings(void)
 
 	printf("%d\n", n_connections);
 
-	printf(_("selecting default shared_buffers ... "));
+	printf(_("selecting default \"shared_buffers\" ... "));
 	fflush(stdout);
 
 	for (i = 0; i < bufslen; i++)
diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index dbd08ab..b2c5413 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -226,7 +226,7 @@ GetConnection(void)
 		res = PQexec(tmpconn, ALWAYS_SECURE_SEARCH_PATH_SQL);
 		if (PQresultStatus(res) != PGRES_TUPLES_OK)
 		{
-			pg_log_error("could not clear search_path: %s",
+			pg_log_error("could not clear \"search_path\": %s",
 						 PQerrorMessage(tmpconn));
 			PQclear(res);
 			PQfinish(tmpconn);
@@ -242,14 +242,14 @@ GetConnection(void)
 	tmpparam = PQparameterStatus(tmpconn, "integer_datetimes");
 	if (!tmpparam)
 	{
-		pg_log_error("could not determine server setting for integer_datetimes");
+		pg_log_error("could not determine server setting for \"integer_datetimes\"");
 		PQfinish(tmpconn);
 		exit(1);
 	}
 
 	if (strcmp(tmpparam, "on") != 0)
 	{
-		pg_log_error("integer_datetimes compile flag does not match server");
+		pg_log_error("\"integer_datetimes\" compile flag does not match server");
 		PQfinish(tmpconn);
 		exit(1);
 	}
diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index 93e0837..93a05d8 100644
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -81,7 +81,7 @@ wal_level_str(WalLevel wal_level)
 		case WAL_LEVEL_LOGICAL:
 			return "logical";
 	}
-	return _("unrecognized wal_level");
+	return _("unrecognized \"wal_level\"");
 }
 
 
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 256d1e3..d561a38 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -3313,7 +3313,7 @@ _selectOutputSchema(ArchiveHandle *AH, const char *schemaName)
 
 		if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
 			warn_or_exit_horribly(AH,
-								  "could not set search_path to \"%s\": %s",
+								  "could not set \"search_path\" to \"%s\": %s",
 								  schemaName, PQerrorMessage(AH->connection));
 
 		PQclear(res);
@@ -3374,7 +3374,7 @@ _selectTablespace(ArchiveHandle *AH, const char *tablespace)
 
 		if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
 			warn_or_exit_horribly(AH,
-								  "could not set default_tablespace to %s: %s",
+								  "could not set \"default_tablespace\" to %s: %s",
 								  fmtId(want), PQerrorMessage(AH->connection));
 
 		PQclear(res);
@@ -3423,7 +3423,7 @@ _selectTableAccessMethod(ArchiveHandle *AH, const char *tableam)
 
 		if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
 			warn_or_exit_horribly(AH,
-								  "could not set default_table_access_method: %s",
+								  "could not set \"default_table_access_method\": %s",
 								  PQerrorMessage(AH->connection));
 
 		PQclear(res);
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 8973ec7..08ea9b5 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -3496,7 +3496,7 @@ dumpStdStrings(Archive *AH)
 	const char *stdstrings = AH->std_strings ? "on" : "off";
 	PQExpBuffer qry = createPQExpBuffer();
 
-	pg_log_info("saving standard_conforming_strings = %s",
+	pg_log_info("saving \"standard_conforming_strings = %s\"",
 				stdstrings);
 
 	appendPQExpBuffer(qry, "SET standard_conforming_strings = '%s';\n",
@@ -3554,7 +3554,7 @@ dumpSearchPath(Archive *AH)
 	appendStringLiteralAH(qry, path->data, AH);
 	appendPQExpBufferStr(qry, ", false);\n");
 
-	pg_log_info("saving search_path = %s", path->data);
+	pg_log_info("saving \"search_path = %s\"", path->data);
 
 	ArchiveEntry(AH, nilCatalogId, createDumpId(),
 				 ARCHIVE_OPTS(.tag = "SEARCHPATH",
diff --git a/src/bin/pg_rewind/libpq_source.c b/src/bin/pg_rewind/libpq_source.c
index 417c74c..656a81b 100644
--- a/src/bin/pg_rewind/libpq_source.c
+++ b/src/bin/pg_rewind/libpq_source.c
@@ -127,7 +127,7 @@ init_libpq_conn(PGconn *conn)
 	/* secure search_path */
 	res = PQexec(conn, ALWAYS_SECURE_SEARCH_PATH_SQL);
 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
-		pg_fatal("could not clear search_path: %s",
+		pg_fatal("could not clear \"search_path\": %s",
 				 PQresultErrorMessage(res));
 	PQclear(res);
 
@@ -138,7 +138,7 @@ init_libpq_conn(PGconn *conn)
 	 */
 	str = run_simple_query(conn, "SHOW full_page_writes");
 	if (strcmp(str, "on") != 0)
-		pg_fatal("full_page_writes must be enabled in the source server");
+		pg_fatal("\"full_page_writes\" must be enabled in the source server");
 	pg_free(str);
 
 	/* Prepare a statement we'll use to fetch files */
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index f55ef4f..afc1885 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -94,7 +94,7 @@ usage(const char *progname)
 	printf(_("%s resynchronizes a PostgreSQL cluster with another copy of the cluster.\n\n"), progname);
 	printf(_("Usage:\n  %s [OPTION]...\n\n"), progname);
 	printf(_("Options:\n"));
-	printf(_("  -c, --restore-target-wal       use restore_command in target configuration to\n"
+	printf(_("  -c, --restore-target-wal       use \"restore_command\" in target configuration to\n"
 			 "                                 retrieve WAL files from archives\n"));
 	printf(_("  -D, --target-pgdata=DIRECTORY  existing data directory to modify\n"));
 	printf(_("      --source-pgdata=DIRECTORY  source data directory to synchronize with\n"));
@@ -1111,11 +1111,11 @@ getRestoreCommand(const char *argv0)
 	(void) pg_strip_crlf(cmd_output);
 
 	if (strcmp(cmd_output, "") == 0)
-		pg_fatal("restore_command is not set in the target cluster");
+		pg_fatal("\"restore_command\" is not set in the target cluster");
 
 	restore_command = pg_strdup(cmd_output);
 
-	pg_log_debug("using for rewind restore_command = \'%s\'",
+	pg_log_debug("using for rewind \"restore_command = \'%s\'\"",
 				 restore_command);
 
 	destroyPQExpBuffer(postgres_cmd);
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index 54bc076..27360fc 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -298,7 +298,7 @@ test_sync(int writes_per_op)
 		printf(_("\nCompare file sync methods using one %dkB write:\n"), XLOG_BLCKSZ_K);
 	else
 		printf(_("\nCompare file sync methods using two %dkB writes:\n"), XLOG_BLCKSZ_K);
-	printf(_("(in wal_sync_method preference order, except fdatasync is Linux's default)\n"));
+	printf(_("(in \"wal_sync_method\" preference order, except fdatasync is Linux's default)\n"));
 
 	/*
 	 * Test open_datasync if available
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index 87c0662..3c2d9c5 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -1534,13 +1534,13 @@ check_new_cluster_logical_replication_slots(void)
 	wal_level = PQgetvalue(res, 0, 0);
 
 	if (strcmp(wal_level, "logical") != 0)
-		pg_fatal("wal_level must be \"logical\", but is set to \"%s\"",
+		pg_fatal("\"wal_level\" must be \"logical\", but is set to \"%s\"",
 				 wal_level);
 
 	max_replication_slots = atoi(PQgetvalue(res, 1, 0));
 
 	if (nslots_on_old > max_replication_slots)
-		pg_fatal("max_replication_slots (%d) must be greater than or equal to the number of "
+		pg_fatal("\"max_replication_slots\" (%d) must be greater than or equal to the number of "
 				 "logical replication slots (%d) on the old cluster",
 				 max_replication_slots, nslots_on_old);
 
@@ -1587,7 +1587,7 @@ check_new_cluster_subscription_configuration(void)
 
 	max_replication_slots = atoi(PQgetvalue(res, 0, 0));
 	if (nsubs_on_old > max_replication_slots)
-		pg_fatal("max_replication_slots (%d) must be greater than or equal to the number of "
+		pg_fatal("\"max_replication_slots\" (%d) must be greater than or equal to the number of "
 				 "subscriptions (%d) on the old cluster",
 				 max_replication_slots, nsubs_on_old);
 
diff --git a/src/bin/pg_upgrade/t/003_logical_slots.pl b/src/bin/pg_upgrade/t/003_logical_slots.pl
index 752c25a..86b248c 100644
--- a/src/bin/pg_upgrade/t/003_logical_slots.pl
+++ b/src/bin/pg_upgrade/t/003_logical_slots.pl
@@ -63,10 +63,10 @@ command_checks_all(
 	[@pg_upgrade_cmd],
 	1,
 	[
-		qr/max_replication_slots \(1\) must be greater than or equal to the number of logical replication slots \(2\) on the old cluster/
+		qr/"max_replication_slots" \(1\) must be greater than or equal to the number of logical replication slots \(2\) on the old cluster/
 	],
 	[qr//],
-	'run of pg_upgrade where the new cluster has insufficient max_replication_slots'
+	'run of pg_upgrade where the new cluster has insufficient "max_replication_slots"'
 );
 ok( -d $newpub->data_dir . "/pg_upgrade_output.d",
 	"pg_upgrade_output.d/ not removed after pg_upgrade failure");
diff --git a/src/bin/pg_upgrade/t/004_subscription.pl b/src/bin/pg_upgrade/t/004_subscription.pl
index d08ffff..faa597e 100644
--- a/src/bin/pg_upgrade/t/004_subscription.pl
+++ b/src/bin/pg_upgrade/t/004_subscription.pl
@@ -218,10 +218,10 @@ command_checks_all(
 	],
 	1,
 	[
-		qr/max_replication_slots \(0\) must be greater than or equal to the number of subscriptions \(1\) on the old cluster/
+		qr/"max_replication_slots" \(0\) must be greater than or equal to the number of subscriptions \(1\) on the old cluster/
 	],
 	[qr//],
-	'run of pg_upgrade where the new cluster has insufficient max_replication_slots'
+	'run of pg_upgrade where the new cluster has insufficient "max_replication_slots"'
 );
 
 # Reset max_replication_slots
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 1253f19..8ee5c6b 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -5343,7 +5343,7 @@ GetTableInfo(PGconn *con, bool scale_given)
 		 * This case is unlikely as pgbench already found "pgbench_branches"
 		 * above to compute the scale.
 		 */
-		pg_log_error("no pgbench_accounts table found in search_path");
+		pg_log_error("no pgbench_accounts table found in \"search_path\"");
 		pg_log_error_hint("Perhaps you need to do initialization (\"pgbench -i\") in database \"%s\".", PQdb(con));
 		exit(1);
 	}
diff --git a/src/fe_utils/archive.c b/src/fe_utils/archive.c
index eb1c930..2e81ae4 100644
--- a/src/fe_utils/archive.c
+++ b/src/fe_utils/archive.c
@@ -95,7 +95,7 @@ RestoreArchivedFile(const char *path, const char *xlogfname,
 	 * fatal too.
 	 */
 	if (wait_result_is_any_signal(rc, true))
-		pg_fatal("restore_command failed: %s",
+		pg_fatal("\"restore_command\" failed: %s",
 				 wait_result_to_str(rc));
 
 	/*
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 912aa14..54eeea3 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -1315,7 +1315,7 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user,
 		if (strlen(val) > MAX_ALGORITHM_NAME_LEN)
 		{
 			PQclear(res);
-			libpq_append_conn_error(conn, "password_encryption value too long");
+			libpq_append_conn_error(conn, "\"password_encryption\" value too long");
 			return NULL;
 		}
 		strcpy(algobuf, val);
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index bf83a9b..37ece35 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -1554,7 +1554,7 @@ connectOptions2(PGconn *conn)
 	if (!sslVerifyProtocolVersion(conn->ssl_min_protocol_version))
 	{
 		conn->status = CONNECTION_BAD;
-		libpq_append_conn_error(conn, "invalid %s value: \"%s\"",
+		libpq_append_conn_error(conn, "invalid \"%s\" value: \"%s\"",
 								"ssl_min_protocol_version",
 								conn->ssl_min_protocol_version);
 		return false;
@@ -1562,7 +1562,7 @@ connectOptions2(PGconn *conn)
 	if (!sslVerifyProtocolVersion(conn->ssl_max_protocol_version))
 	{
 		conn->status = CONNECTION_BAD;
-		libpq_append_conn_error(conn, "invalid %s value: \"%s\"",
+		libpq_append_conn_error(conn, "invalid \"%s\" value: \"%s\"",
 								"ssl_max_protocol_version",
 								conn->ssl_max_protocol_version);
 		return false;
diff --git a/src/test/modules/libpq_pipeline/libpq_pipeline.c b/src/test/modules/libpq_pipeline/libpq_pipeline.c
index 3c009ee..6610c1e 100644
--- a/src/test/modules/libpq_pipeline/libpq_pipeline.c
+++ b/src/test/modules/libpq_pipeline/libpq_pipeline.c
@@ -1824,10 +1824,10 @@ main(int argc, char **argv)
 
 	res = PQexec(conn, "SET lc_messages TO \"C\"");
 	if (PQresultStatus(res) != PGRES_COMMAND_OK)
-		pg_fatal("failed to set lc_messages: %s", PQerrorMessage(conn));
+		pg_fatal("failed to set \"lc_messages\": %s", PQerrorMessage(conn));
 	res = PQexec(conn, "SET debug_parallel_query = off");
 	if (PQresultStatus(res) != PGRES_COMMAND_OK)
-		pg_fatal("failed to set debug_parallel_query: %s", PQerrorMessage(conn));
+		pg_fatal("failed to set \"debug_parallel_query\": %s", PQerrorMessage(conn));
 
 	/* Set the trace file, if requested */
 	if (tracefile != NULL)
diff --git a/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c b/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
index 948706a..d599214 100644
--- a/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
+++ b/src/test/modules/ssl_passphrase_callback/ssl_passphrase_func.c
@@ -58,7 +58,7 @@ set_rot13(SSL_CTX *context, bool isServerStart)
 	/* warn if the user has set ssl_passphrase_command */
 	if (ssl_passphrase_command[0])
 		ereport(WARNING,
-				(errmsg("ssl_passphrase_command setting ignored by ssl_passphrase_func module")));
+				(errmsg("\"ssl_passphrase_command\" setting ignored by ssl_passphrase_func module")));
 
 	SSL_CTX_set_default_passwd_cb(context, rot13_passphrase);
 }
diff --git a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
index c63e7bd..190a401 100644
--- a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
+++ b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
@@ -56,7 +56,7 @@ my $log_contents = slurp_file($log);
 
 like(
 	$log_contents,
-	qr/WARNING.*ssl_passphrase_command setting ignored by ssl_passphrase_func module/,
+	qr/WARNING.*"ssl_passphrase_command" setting ignored by ssl_passphrase_func module/,
 	"ssl_passphrase_command set warning");
 
 # set the wrong passphrase
diff --git a/src/test/modules/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c
index abc7935..d34181a 100644
--- a/src/test/modules/test_shm_mq/setup.c
+++ b/src/test/modules/test_shm_mq/setup.c
@@ -233,7 +233,7 @@ setup_background_workers(int nworkers, dsm_segment *seg)
 			ereport(ERROR,
 					(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 					 errmsg("could not register background process"),
-					 errhint("You may need to increase max_worker_processes.")));
+					 errhint("You may need to increase \"max_worker_processes\".")));
 		++wstate->nworkers;
 	}
 
diff --git a/src/test/modules/test_slru/test_slru.c b/src/test/modules/test_slru/test_slru.c
index d0fb944..bee3932 100644
--- a/src/test/modules/test_slru/test_slru.c
+++ b/src/test/modules/test_slru/test_slru.c
@@ -248,7 +248,7 @@ _PG_init(void)
 	if (!process_shared_preload_libraries_in_progress)
 		ereport(ERROR,
 				(errmsg("cannot load \"%s\" after startup", "test_slru"),
-				 errdetail("\"%s\" must be loaded with shared_preload_libraries.",
+				 errdetail("\"%s\" must be loaded with \"shared_preload_libraries\".",
 						   "test_slru")));
 
 	prev_shmem_request_hook = shmem_request_hook;
diff --git a/src/test/recovery/t/024_archive_recovery.pl b/src/test/recovery/t/024_archive_recovery.pl
index e9ab118..901457c 100644
--- a/src/test/recovery/t/024_archive_recovery.pl
+++ b/src/test/recovery/t/024_archive_recovery.pl
@@ -91,8 +91,8 @@ sub test_recovery_wal_level_minimal
 	# Confirm that the archive recovery fails with an expected error
 	my $logfile = slurp_file($recovery_node->logfile());
 	ok( $logfile =~
-		  qr/FATAL: .* WAL was generated with wal_level=minimal, cannot continue recovering/,
-		"$node_text ends with an error because it finds WAL generated with wal_level=minimal"
+		  qr/FATAL: .* WAL was generated with "wal_level=minimal", cannot continue recovering/,
+		"$node_text ends with an error because it finds WAL generated with \"wal_level=minimal\""
 	);
 }
 
diff --git a/src/test/recovery/t/035_standby_logical_decoding.pl b/src/test/recovery/t/035_standby_logical_decoding.pl
index 2e7893e..602cce5 100644
--- a/src/test/recovery/t/035_standby_logical_decoding.pl
+++ b/src/test/recovery/t/035_standby_logical_decoding.pl
@@ -744,7 +744,7 @@ $handle =
   make_slot_active($node_standby, 'wal_level_', 0, \$stdout, \$stderr);
 # We are not able to read from the slot as it requires wal_level >= logical on the primary server
 check_pg_recvlogical_stderr($handle,
-	"logical decoding on standby requires wal_level >= logical on the primary"
+	"logical decoding on standby requires \"wal_level\" >= \"logical\" on the primary"
 );
 
 # Restore primary wal_level
diff --git a/src/test/regress/expected/collate.icu.utf8.out b/src/test/regress/expected/collate.icu.utf8.out
index 7a05c75..97bbe53 100644
--- a/src/test/regress/expected/collate.icu.utf8.out
+++ b/src/test/regress/expected/collate.icu.utf8.out
@@ -1042,7 +1042,7 @@ ERROR:  parameter "locale" must be specified
 SET icu_validation_level = ERROR;
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); -- fails
 ERROR:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
+HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
 CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=yes'); -- fails
 ERROR:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 RESET icu_validation_level;
@@ -1050,7 +1050,7 @@ CREATE COLLATION testx (provider = icu, locale = '@colStrength=primary;nonsense=
 WARNING:  could not convert locale name "@colStrength=primary;nonsense=yes" to language tag: U_ILLEGAL_ARGUMENT_ERROR
 CREATE COLLATION testx (provider = icu, locale = 'nonsense-nowhere'); DROP COLLATION testx;
 WARNING:  ICU locale "nonsense-nowhere" has unknown language "nonsense"
-HINT:  To disable ICU locale validation, set the parameter icu_validation_level to "disabled".
+HINT:  To disable ICU locale validation, set the parameter "icu_validation_level" to "disabled".
 CREATE COLLATION test4 FROM nonsense;
 ERROR:  collation "nonsense" for encoding "UTF8" does not exist
 CREATE COLLATION test5 FROM test0;
diff --git a/src/test/regress/expected/create_am.out b/src/test/regress/expected/create_am.out
index b50293d..f7851ca 100644
--- a/src/test/regress/expected/create_am.out
+++ b/src/test/regress/expected/create_am.out
@@ -113,7 +113,7 @@ COMMIT;
 -- prevent empty values
 SET default_table_access_method = '';
 ERROR:  invalid value for parameter "default_table_access_method": ""
-DETAIL:  default_table_access_method cannot be empty.
+DETAIL:  "default_table_access_method" cannot be empty.
 -- prevent nonexistent values
 SET default_table_access_method = 'I do not exist AM';
 ERROR:  invalid value for parameter "default_table_access_method": "I do not exist AM"
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out
index 7cb28f1..aa29bc5 100644
--- a/src/test/regress/expected/json.out
+++ b/src/test/regress/expected/json.out
@@ -219,10 +219,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::json;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::json;			-- OK
diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out
index b597d01..f8a7dac 100644
--- a/src/test/regress/expected/jsonb.out
+++ b/src/test/regress/expected/jsonb.out
@@ -213,10 +213,10 @@ CONTEXT:  JSON data, line 1: {"abc":1,3...
 SET max_stack_depth = '100kB';
 SELECT repeat('[', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 SELECT repeat('{"a":', 10000)::jsonb;
 ERROR:  stack depth limit exceeded
-HINT:  Increase the configuration parameter max_stack_depth (currently 100kB), after ensuring the platform's stack depth limit is adequate.
+HINT:  Increase the configuration parameter "max_stack_depth" (currently 100kB), after ensuring the platform's stack depth limit is adequate.
 RESET max_stack_depth;
 -- Miscellaneous stuff.
 SELECT 'true'::jsonb;			-- OK
diff --git a/src/test/regress/expected/prepared_xacts_1.out b/src/test/regress/expected/prepared_xacts_1.out
index 2cd50ad..f9b7913 100644
--- a/src/test/regress/expected/prepared_xacts_1.out
+++ b/src/test/regress/expected/prepared_xacts_1.out
@@ -19,7 +19,7 @@ SELECT * FROM pxtest1;
 
 PREPARE TRANSACTION 'foo1';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 SELECT * FROM pxtest1;
  foobar 
 --------
@@ -58,7 +58,7 @@ SELECT * FROM pxtest1;
 
 PREPARE TRANSACTION 'foo2';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 SELECT * FROM pxtest1;
  foobar 
 --------
@@ -84,7 +84,7 @@ SELECT * FROM pxtest1;
 
 PREPARE TRANSACTION 'foo3';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 SELECT gid FROM pg_prepared_xacts;
  gid 
 -----
@@ -95,7 +95,7 @@ INSERT INTO pxtest1 VALUES ('fff');
 -- This should fail, because the gid foo3 is already in use
 PREPARE TRANSACTION 'foo3';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 SELECT * FROM pxtest1;
  foobar 
 --------
@@ -121,7 +121,7 @@ SELECT * FROM pxtest1;
 
 PREPARE TRANSACTION 'foo4';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 SELECT gid FROM pg_prepared_xacts;
  gid 
 -----
@@ -138,7 +138,7 @@ SELECT * FROM pxtest1;
 INSERT INTO pxtest1 VALUES ('fff');
 PREPARE TRANSACTION 'foo5';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 SELECT gid FROM pg_prepared_xacts;
  gid 
 -----
@@ -169,7 +169,7 @@ SELECT pg_advisory_xact_lock_shared(1);
 
 PREPARE TRANSACTION 'foo6';  -- fails
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 -- Test subtransactions
 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
   CREATE TABLE pxtest2 (a int);
@@ -181,7 +181,7 @@ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
   INSERT INTO pxtest2 VALUES (3);
 PREPARE TRANSACTION 'regress-one';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 CREATE TABLE pxtest3(fff int);
 -- Test shared invalidation
 BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
@@ -199,7 +199,7 @@ BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
 
 PREPARE TRANSACTION 'regress-two';
 ERROR:  prepared transactions are disabled
-HINT:  Set max_prepared_transactions to a nonzero value.
+HINT:  Set "max_prepared_transactions" to a nonzero value.
 -- No such cursor
 FETCH 1 FROM foo;
 ERROR:  cursor "foo" does not exist
diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out
index b7500d9..52b69a1 100644
--- a/src/test/regress/expected/strings.out
+++ b/src/test/regress/expected/strings.out
@@ -147,17 +147,17 @@ SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
 ERROR:  unsafe use of string constant with Unicode escapes
 LINE 1: SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
                ^
-DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
+DETAIL:  String constants with Unicode escapes cannot be used when "standard_conforming_strings" is off.
 SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
 ERROR:  unsafe use of string constant with Unicode escapes
 LINE 1: SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061...
                ^
-DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
+DETAIL:  String constants with Unicode escapes cannot be used when "standard_conforming_strings" is off.
 SELECT U&' \' UESCAPE '!' AS "tricky";
 ERROR:  unsafe use of string constant with Unicode escapes
 LINE 1: SELECT U&' \' UESCAPE '!' AS "tricky";
                ^
-DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
+DETAIL:  String constants with Unicode escapes cannot be used when "standard_conforming_strings" is off.
 SELECT 'tricky' AS U&"\" UESCAPE '!';
    \    
 --------
@@ -168,17 +168,17 @@ SELECT U&'wrong: \061';
 ERROR:  unsafe use of string constant with Unicode escapes
 LINE 1: SELECT U&'wrong: \061';
                ^
-DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
+DETAIL:  String constants with Unicode escapes cannot be used when "standard_conforming_strings" is off.
 SELECT U&'wrong: \+0061';
 ERROR:  unsafe use of string constant with Unicode escapes
 LINE 1: SELECT U&'wrong: \+0061';
                ^
-DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
+DETAIL:  String constants with Unicode escapes cannot be used when "standard_conforming_strings" is off.
 SELECT U&'wrong: +0061' UESCAPE '+';
 ERROR:  unsafe use of string constant with Unicode escapes
 LINE 1: SELECT U&'wrong: +0061' UESCAPE '+';
                ^
-DETAIL:  String constants with Unicode escapes cannot be used when standard_conforming_strings is off.
+DETAIL:  String constants with Unicode escapes cannot be used when "standard_conforming_strings" is off.
 RESET standard_conforming_strings;
 -- bytea
 SET bytea_output TO hex;
diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl
index 16c7fb9..63c6f3e 100644
--- a/src/test/subscription/t/001_rep_changes.pl
+++ b/src/test/subscription/t/001_rep_changes.pl
@@ -573,7 +573,7 @@ CREATE PUBLICATION tap_pub2 FOR TABLE skip_wal;
 ROLLBACK;
 });
 ok( $reterr =~
-	  m/WARNING:  wal_level is insufficient to publish logical changes/,
-	'CREATE PUBLICATION while wal_level=minimal');
+	  m/WARNING:  "wal_level" is insufficient to publish logical changes/,
+	'CREATE PUBLICATION while "wal_level=minimal"');
 
 done_testing();
-- 
1.8.3.1

#50Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Smith (#49)
Re: GUC names in messages

On 04.01.24 07:53, Peter Smith wrote:

Now that I read this again, I think this is wrong.

We should decide the quoting for a category, not the actual content.
Like, quote all file names; do not quote keywords.

This led to the attempted patch to decide the quoting of GUC parameter
names dynamically based on the actual content, which no one really
liked. But then, to preserve consistency, we also need to be uniform in
quoting GUC parameter names where the name is hardcoded.

I agree. By attempting to define when to and when not to use quotes it
has become overcomplicated.

Earlier in the thread, I counted how quotes were used in the existing
messages [5]; there were ~39 quoted and 164 not quoted. Based on that
we chose to stay with the majority, and leave all the unquoted ones so
only adding quotes "when necessary". In hindsight, that was probably
the wrong choice because it opened a can of worms about what "when
necessary" even means (e.g. what about underscores, mixed case etc).

Certainly one simple rule "just quote everything" is easiest to follow.

I've been going through the translation updates for PG17 these days and
was led back around to this issue. It seems we left it in an
intermediate state that no one was really happy with and which is
arguably as inconsistent or more so than before.

I think we should accept your two patches

v6-0001-GUC-names-docs.patch
v6-0002-GUC-names-add-quotes.patch

which effectively everyone was in favor of and which seem to be the most
robust and sustainable solution.

(The remaining three patches from the v6 set would be PG18 material at
this point.)

#51Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Peter Eisentraut (#50)
Re: GUC names in messages

On 2024-May-16, Peter Eisentraut wrote:

I think we should accept your two patches

v6-0001-GUC-names-docs.patch
v6-0002-GUC-names-add-quotes.patch

which effectively everyone was in favor of and which seem to be the most
robust and sustainable solution.

I think we should also take patch 0005 in pg17, which reduces the number
of strings to translate.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"XML!" Exclaimed C++. "What are you doing here? You're not a programming
language."
"Tell that to the people who use me," said XML.
https://burningbird.net/the-parable-of-the-languages/

#52Daniel Gustafsson
daniel@yesql.se
In reply to: Peter Eisentraut (#50)
Re: GUC names in messages

On 16 May 2024, at 13:35, Peter Eisentraut <peter@eisentraut.org> wrote:

I think we should accept your two patches

I agree with this.

v6-0001-GUC-names-docs.patch

+1

v6-0002-GUC-names-add-quotes.patch

- errmsg("WAL generated with full_page_writes=off was replayed "
+ errmsg("WAL generated with \"full_page_writes=off\" was replayed "

I'm not a fan of this syntax, but I at the same time can't offer a better idea
so this isn't an objection but a hope that it can be made even better during
the v18 cycle.

--
Daniel Gustafsson

#53Daniel Gustafsson
daniel@yesql.se
In reply to: Alvaro Herrera (#51)
Re: GUC names in messages

On 16 May 2024, at 13:56, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:

I think we should also take patch 0005 in pg17, which reduces the number
of strings to translate.

Agreed, lessening the burden on translators is always a good idea.

--
Daniel Gustafsson

#54Tom Lane
tgl@sss.pgh.pa.us
In reply to: Daniel Gustafsson (#52)
Re: GUC names in messages

Daniel Gustafsson <daniel@yesql.se> writes:

On 16 May 2024, at 13:35, Peter Eisentraut <peter@eisentraut.org> wrote:

- errmsg("WAL generated with full_page_writes=off was replayed "
+ errmsg("WAL generated with \"full_page_writes=off\" was replayed "

I'm not a fan of this syntax, but I at the same time can't offer a better idea
so this isn't an objection but a hope that it can be made even better during
the v18 cycle.

Yeah ... formally correct would be something like

errmsg("WAL generated with \"full_page_writes\"=\"off\" was replayed "

but that's a bit much for my taste.

regards, tom lane

#55Peter Smith
smithpb2250@gmail.com
In reply to: Peter Eisentraut (#50)
Re: GUC names in messages

On Thu, May 16, 2024 at 9:35 PM Peter Eisentraut <peter@eisentraut.org> wrote:

On 04.01.24 07:53, Peter Smith wrote:

Now that I read this again, I think this is wrong.

We should decide the quoting for a category, not the actual content.
Like, quote all file names; do not quote keywords.

This led to the attempted patch to decide the quoting of GUC parameter
names dynamically based on the actual content, which no one really
liked. But then, to preserve consistency, we also need to be uniform in
quoting GUC parameter names where the name is hardcoded.

I agree. By attempting to define when to and when not to use quotes it
has become overcomplicated.

Earlier in the thread, I counted how quotes were used in the existing
messages [5]; there were ~39 quoted and 164 not quoted. Based on that
we chose to stay with the majority, and leave all the unquoted ones so
only adding quotes "when necessary". In hindsight, that was probably
the wrong choice because it opened a can of worms about what "when
necessary" even means (e.g. what about underscores, mixed case etc).

Certainly one simple rule "just quote everything" is easiest to follow.

I've been going through the translation updates for PG17 these days and
was led back around to this issue. It seems we left it in an
intermediate state that no one was really happy with and which is
arguably as inconsistent or more so than before.

I think we should accept your two patches

v6-0001-GUC-names-docs.patch
v6-0002-GUC-names-add-quotes.patch

which effectively everyone was in favor of and which seem to be the most
robust and sustainable solution.

(The remaining three patches from the v6 set would be PG18 material at
this point.)

Thanks very much for taking an interest in resurrecting this thread.

It was always my intention to come back to this when the dust had
settled on PG17. But it would be even better if the docs for the rule
"just quote everything", and anything else you deem acceptable, can be
pushed sooner.

Of course, there will still be plenty more to do for PG18, including
locating examples in newly pushed code for messages that have slipped
through the cracks during the last few months using different formats,
and other improvements, but those tasks should become easier if we can
get some of these v6 patches out of the way first.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#56Peter Eisentraut
peter@eisentraut.org
In reply to: Peter Smith (#55)
Re: GUC names in messages

On 17.05.24 05:31, Peter Smith wrote:

I think we should accept your two patches

v6-0001-GUC-names-docs.patch
v6-0002-GUC-names-add-quotes.patch

which effectively everyone was in favor of and which seem to be the most
robust and sustainable solution.

(The remaining three patches from the v6 set would be PG18 material at
this point.)

Thanks very much for taking an interest in resurrecting this thread.

It was always my intention to come back to this when the dust had
settled on PG17. But it would be even better if the docs for the rule
"just quote everything", and anything else you deem acceptable, can be
pushed sooner.

Of course, there will still be plenty more to do for PG18, including
locating examples in newly pushed code for messages that have slipped
through the cracks during the last few months using different formats,
and other improvements, but those tasks should become easier if we can
get some of these v6 patches out of the way first.

I committed your 0001 and 0002 now, with some small fixes.

There has also been quite a bit of new code, of course, since you posted
your patches, so we'll probably find a few more things that could use
adjustment.

I'd be happy to consider the rest of your patch set after beta1 and/or
for PG18.

#57Peter Smith
smithpb2250@gmail.com
In reply to: Peter Eisentraut (#56)
Re: GUC names in messages

On Fri, May 17, 2024 at 9:57 PM Peter Eisentraut <peter@eisentraut.org> wrote:

On 17.05.24 05:31, Peter Smith wrote:

I think we should accept your two patches

v6-0001-GUC-names-docs.patch
v6-0002-GUC-names-add-quotes.patch

which effectively everyone was in favor of and which seem to be the most
robust and sustainable solution.

(The remaining three patches from the v6 set would be PG18 material at
this point.)

Thanks very much for taking an interest in resurrecting this thread.

It was always my intention to come back to this when the dust had
settled on PG17. But it would be even better if the docs for the rule
"just quote everything", and anything else you deem acceptable, can be
pushed sooner.

Of course, there will still be plenty more to do for PG18, including
locating examples in newly pushed code for messages that have slipped
through the cracks during the last few months using different formats,
and other improvements, but those tasks should become easier if we can
get some of these v6 patches out of the way first.

I committed your 0001 and 0002 now, with some small fixes.

There has also been quite a bit of new code, of course, since you posted
your patches, so we'll probably find a few more things that could use
adjustment.

I'd be happy to consider the rest of your patch set after beta1 and/or
for PG18.

Thanks for pushing!

I'll try to dedicate more time to this sometime soon to go through all
the code again to track down those loose ends.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

#58Peter Smith
smithpb2250@gmail.com
In reply to: Peter Eisentraut (#56)
8 attachment(s)
Re: GUC names in messages

On Fri, May 17, 2024 at 9:57 PM Peter Eisentraut <peter@eisentraut.org> wrote:

On 17.05.24 05:31, Peter Smith wrote:

I think we should accept your two patches

v6-0001-GUC-names-docs.patch
v6-0002-GUC-names-add-quotes.patch

which effectively everyone was in favor of and which seem to be the most
robust and sustainable solution.

(The remaining three patches from the v6 set would be PG18 material at
this point.)

Thanks very much for taking an interest in resurrecting this thread.

It was always my intention to come back to this when the dust had
settled on PG17. But it would be even better if the docs for the rule
"just quote everything", and anything else you deem acceptable, can be
pushed sooner.

Of course, there will still be plenty more to do for PG18, including
locating examples in newly pushed code for messages that have slipped
through the cracks during the last few months using different formats,
and other improvements, but those tasks should become easier if we can
get some of these v6 patches out of the way first.

I committed your 0001 and 0002 now, with some small fixes.

There has also been quite a bit of new code, of course, since you posted
your patches, so we'll probably find a few more things that could use
adjustment.

I'd be happy to consider the rest of your patch set after beta1 and/or
for PG18.

Thanks for pushing some of those v6 patches. Here is the new patch set v7*.

I have used a homegrown script/regex to help identify all the GUC
names that still needed quoting. Many of these occurrences are from
recently pushed code -- i.e. they are more recent than that v6-0002
patch previously pushed [1]v6-0001,0002 were already pushed. /messages/by-id/55ab714f-86e3-41a3-a1d2-a96a115db8bd@eisentraut.org.

The new GUC quoting patches are separated by different GUC types only
to simplify my processing of them.

v7-0001 = Add quotes for GUCs - bool
v7-0002 = Add quotes for GUCs - int
v7-0003 = Add quotes for GUCs - real
v7-0004 = Add quotes for GUCs - string
v7-0005 = Add quotes for GUCs - enum

The other v7 patches are just carried forward unchanged from v6:

v7-0006 = fix case for IntervalStyle
v7-0007 = fix case for Datestyle
v7-0008 = make common translatable message strings

~~~~

STATUS

Here is the status of these v7* patches, and remaining works to do:

* AFAIK those first 5 ("Add quotes") patches can be pushed ASAP in
PG17. If anybody finds more GUCs still not quoted then those are
probably somehow accidentally missed by me and should be fixed.

* The remaining 3 patches may wait until PG18.

* The patch 0008 ("make common translatable message strings") may be
OK to be pushed as-is. OTOH, this is the tip of another iceberg so I
expect if we look harder there will be many many more candidates to
turn into common messages. There may also be examples where 'similar'
messages can use identical common text, but those will require more
discussion/debate case-by-case

* Another remaining task is to check current usage and improve the
consistency of how some of the GUC values have been quoted. Refer to
mail from Kyotaro-san [2]/messages/by-id/20240520.165613.189183526936651938.horikyota.ntt@gmail.com for examples of this.

======
[1]: v6-0001,0002 were already pushed. /messages/by-id/55ab714f-86e3-41a3-a1d2-a96a115db8bd@eisentraut.org
/messages/by-id/55ab714f-86e3-41a3-a1d2-a96a115db8bd@eisentraut.org

[2]: /messages/by-id/20240520.165613.189183526936651938.horikyota.ntt@gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v7-0005-Add-quotes-for-GUCs-enum.patchapplication/octet-stream; name=v7-0005-Add-quotes-for-GUCs-enum.patchDownload
From c75d6a6501ef4706c4b814f11a86ce4e44c4f883 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 12:31:01 +1000
Subject: [PATCH v7] Add quotes for GUCs - enum

---
 src/backend/access/transam/xlog.c           | 2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 330e058..1f3e601 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -9061,7 +9061,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("WAL level not sufficient for making an online backup"),
-				 errhint("wal_level must be set to \"replica\" or \"logical\" at server start.")));
+				 errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
 
 	/*
 	 * OK to update backup counter and session-level lock.
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index acfb419..78e7fbb 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -924,7 +924,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 
 	if (strcmp(wal_level, "logical") != 0)
 	{
-		pg_log_error("publisher requires wal_level >= \"logical\"");
+		pg_log_error("publisher requires \"wal_level\" >= \"logical\"");
 		failed = true;
 	}
 
-- 
1.8.3.1

v7-0007-GUC-names-fix-case-datestyle.patchapplication/octet-stream; name=v7-0007-GUC-names-fix-case-datestyle.patchDownload
From 8aa746a8ba6f4552470521a854fa248dbd649630 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 14:14:05 +1000
Subject: [PATCH v7] GUC names - fix case datestyle

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 9345131..3726aa3 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 7abdc62..600b591 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4107,7 +4107,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different \"DateStyle\" setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..e936f66 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index 241713c..13603f6 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

v7-0004-Add-quotes-for-GUCs-string.patchapplication/octet-stream; name=v7-0004-Add-quotes-for-GUCs-string.patchDownload
From cfb6a909dcfa12a2f3e387dea03cbef2c21d2b8b Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 12:30:30 +1000
Subject: [PATCH v7] Add quotes for GUCs - string

---
 src/backend/archive/shell_archive.c           |  2 +-
 src/backend/replication/logical/slotsync.c    | 12 ++++++------
 src/bin/pg_archivecleanup/pg_archivecleanup.c |  2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c   |  2 +-
 src/bin/pg_dump/pg_backup_db.c                |  2 +-
 src/bin/pg_rewind/pg_rewind.c                 |  2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/backend/archive/shell_archive.c b/src/backend/archive/shell_archive.c
index 506c5a3..4de7e66 100644
--- a/src/backend/archive/shell_archive.c
+++ b/src/backend/archive/shell_archive.c
@@ -48,7 +48,7 @@ shell_archive_configured(ArchiveModuleState *state)
 	if (XLogArchiveCommand[0] != '\0')
 		return true;
 
-	arch_module_check_errdetail("%s is not set.",
+	arch_module_check_errdetail("\"%s\" is not set.",
 								"archive_command");
 	return false;
 }
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 2c60a84..aaacc1d 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -962,14 +962,14 @@ validate_remote_info(WalReceiverConn *wrconn)
 
 	if (res->status != WALRCV_OK_TUPLES)
 		ereport(ERROR,
-				errmsg("could not fetch primary_slot_name \"%s\" info from the primary server: %s",
+				errmsg("could not fetch primary slot name \"%s\" info from the primary server: %s",
 					   PrimarySlotName, res->err),
-				errhint("Check if primary_slot_name is configured correctly."));
+				errhint("Check if \"primary_slot_name\" is configured correctly."));
 
 	tupslot = MakeSingleTupleTableSlot(res->tupledesc, &TTSOpsMinimalTuple);
 	if (!tuplestore_gettupleslot(res->tuplestore, true, false, tupslot))
 		elog(ERROR,
-			 "failed to fetch tuple for the primary server slot specified by primary_slot_name");
+			 "failed to fetch tuple for the primary server slot specified by \"primary_slot_name\"");
 
 	remote_in_recovery = DatumGetBool(slot_getattr(tupslot, 1, &isnull));
 	Assert(!isnull);
@@ -992,9 +992,9 @@ validate_remote_info(WalReceiverConn *wrconn)
 	if (!primary_slot_valid)
 		ereport(ERROR,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires valid primary_slot_name"),
+				errmsg("slot synchronization requires valid \"primary_slot_name\""),
 		/* translator: second %s is a GUC variable name */
-				errdetail("The replication slot \"%s\" specified by %s does not exist on the primary server.",
+				errdetail("The replication slot \"%s\" specified by \"%s\" does not exist on the primary server.",
 						  PrimarySlotName, "primary_slot_name"));
 
 	ExecClearTuple(tupslot);
@@ -1060,7 +1060,7 @@ ValidateSlotSyncParams(int elevel)
 		ereport(elevel,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires %s to be defined", "primary_slot_name"));
+				errmsg("slot synchronization requires \"%s\" to be defined", "primary_slot_name"));
 		return false;
 	}
 
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 07bf356..3acbe69 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -269,7 +269,7 @@ usage(void)
 			 "                              clean up\n"));
 	printf(_("  -?, --help                  show this help, then exit\n"));
 	printf(_("\n"
-			 "For use as archive_cleanup_command in postgresql.conf:\n"
+			 "For use as \"archive_cleanup_command\" in postgresql.conf:\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
 			 "e.g.\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 4e2c9ff..acfb419 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -510,7 +510,7 @@ connect_database(const char *conninfo, bool exit_on_error)
 	res = PQexec(conn, ALWAYS_SECURE_SEARCH_PATH_SQL);
 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		pg_log_error("could not clear search_path: %s",
+		pg_log_error("could not clear \"search_path\": %s",
 					 PQresultErrorMessage(res));
 		PQclear(res);
 		PQfinish(conn);
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index a02841c..4d1957a 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -39,7 +39,7 @@ _check_database_version(ArchiveHandle *AH)
 	remoteversion_str = PQparameterStatus(AH->connection, "server_version");
 	remoteversion = PQserverVersion(AH->connection);
 	if (remoteversion == 0 || !remoteversion_str)
-		pg_fatal("could not get server_version from libpq");
+		pg_fatal("could not get \"server_version\" from libpq");
 
 	AH->public.remoteVersionStr = pg_strdup(remoteversion_str);
 	AH->public.remoteVersion = remoteversion;
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 8dfea05..287245c 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -1106,7 +1106,7 @@ getRestoreCommand(const char *argv0)
 
 	restore_command = pipe_read_line(postgres_cmd->data);
 	if (restore_command == NULL)
-		pg_fatal("unable to read restore_command from target cluster");
+		pg_fatal("unable to read \"restore_command\" from target cluster");
 
 	(void) pg_strip_crlf(restore_command);
 
-- 
1.8.3.1

v7-0006-GUC-names-fix-case-intervalstyle.patchapplication/octet-stream; name=v7-0006-GUC-names-fix-case-intervalstyle.patchDownload
From 554341cf623b87909d35f3e3c8a1b0b2f4012b2b Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 13:21:59 +1000
Subject: [PATCH v7] GUC names - fix case intervalstyle

---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 547cecd..a458958 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3281,7 +3281,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 455b6d6..b5d94eb 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761..98d8ae4 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,7 +2,10 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
 -- SET to some nondefault value
+
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
 SHOW vacuum_cost_delay;
-- 
1.8.3.1

v7-0001-Add-quotes-for-GUC-bool.patchapplication/octet-stream; name=v7-0001-Add-quotes-for-GUC-bool.patchDownload
From b93852a5feeee7e33c50118afa10b84e56f279f2 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 11:39:45 +1000
Subject: [PATCH v7] Add quotes for GUC - bool

---
 src/backend/replication/logical/slotsync.c             | 4 ++--
 src/test/recovery/t/040_standby_failover_slots_sync.pl | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 56d3fb5..2c60a84 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -1074,7 +1074,7 @@ ValidateSlotSyncParams(int elevel)
 		ereport(elevel,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires %s to be enabled",
+				errmsg("slot synchronization requires \"%s\" to be enabled",
 					   "hot_standby_feedback"));
 		return false;
 	}
@@ -1126,7 +1126,7 @@ slotsync_reread_config(void)
 	{
 		ereport(LOG,
 		/* translator: %s is a GUC variable name */
-				errmsg("slot sync worker will shutdown because %s is disabled", "sync_replication_slots"));
+				errmsg("slot sync worker will shutdown because \"%s\" is disabled", "sync_replication_slots"));
 		proc_exit(0);
 	}
 
diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl
index 3b6dddb..eca0b24 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -529,7 +529,7 @@ $standby1->wait_for_log(
 	qr/slot sync worker will restart because of a parameter change/,
 	$log_offset);
 $standby1->wait_for_log(
-	qr/slot synchronization requires hot_standby_feedback to be enabled/,
+	qr/slot synchronization requires "hot_standby_feedback" to be enabled/,
 	$log_offset);
 
 $log_offset = -s $standby1->logfile;
-- 
1.8.3.1

v7-0003-Add-quotes-for-GUCs-real.patchapplication/octet-stream; name=v7-0003-Add-quotes-for-GUCs-real.patchDownload
From 05a846a889a587d335a64fb732262b00afee73bc Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 12:24:51 +1000
Subject: [PATCH v7] Add quotes for GUCs - real

---
 src/backend/utils/misc/guc_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 66ef451..ff9086e 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3001,7 +3001,7 @@ struct config_int ConfigureNamesInt[] =
 		{"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN,
 			gettext_noop("Sets the minimum execution time above which "
 						 "a sample of statements will be logged."
-						 " Sampling is determined by log_statement_sample_rate."),
+						 " Sampling is determined by \"log_statement_sample_rate\"."),
 			gettext_noop("Zero logs a sample of all queries. -1 turns this feature off."),
 			GUC_UNIT_MS
 		},
-- 
1.8.3.1

v7-0002-Add-quotes-for-GUCs-int.patchapplication/octet-stream; name=v7-0002-Add-quotes-for-GUCs-int.patchDownload
From 0b338d94d0f2e5f6a4cdfe1be7c5e38b0e0959d1 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 12:23:26 +1000
Subject: [PATCH v7] Add quotes for GUCs - int

---
 src/backend/postmaster/bgworker.c           |  2 +-
 src/backend/postmaster/checkpointer.c       |  2 +-
 src/backend/replication/logical/launcher.c  |  2 +-
 src/backend/storage/file/fd.c               |  2 +-
 src/backend/utils/misc/guc_tables.c         |  8 ++++----
 src/bin/pg_basebackup/pg_createsubscriber.c | 15 ++++++++++-----
 src/include/libpq/libpq-be-fe-helpers.h     |  4 ++--
 7 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index fa52b6d..cf5ffb9 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -257,7 +257,7 @@ BackgroundWorkerStateChange(bool allow_new_workers)
 	if (max_worker_processes != BackgroundWorkerData->total_slots)
 	{
 		ereport(LOG,
-				(errmsg("inconsistent background worker state (max_worker_processes=%d, total_slots=%d)",
+				(errmsg("inconsistent background worker state (\"max_worker_processes\"=%d, total slots=%d)",
 						max_worker_processes,
 						BackgroundWorkerData->total_slots)));
 		return;
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 3c68a99..1397335 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -663,7 +663,7 @@ CheckArchiveTimeout(void)
 			 * assume nothing happened.
 			 */
 			if (XLogSegmentOffset(switchpoint, wal_segment_size) != 0)
-				elog(DEBUG1, "write-ahead log switch forced (archive_timeout=%d)",
+				elog(DEBUG1, "write-ahead log switch forced (\"archive_timeout\"=%d)",
 					 XLogArchiveTimeout);
 		}
 
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 27c3a91..b902b78 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -331,7 +331,7 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
 	if (max_replication_slots == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("cannot start logical replication workers when max_replication_slots = 0")));
+				 errmsg("cannot start logical replication workers when \"max_replication_slots\" = 0")));
 
 	/*
 	 * We need to do the modification of the shared memory under lock so that
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index a7c05b0..aa9d5f7 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2231,7 +2231,7 @@ FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset,
 			if (newTotal > (uint64) temp_file_limit * (uint64) 1024)
 				ereport(ERROR,
 						(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-						 errmsg("temporary file size exceeds temp_file_limit (%dkB)",
+						 errmsg("temporary file size exceeds \"temp_file_limit\" (%dkB)",
 								temp_file_limit)));
 		}
 	}
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 46c258b..66ef451 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -2294,7 +2294,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"commit_timestamp_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the commit timestamp cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&commit_timestamp_buffers,
@@ -2349,7 +2349,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"subtransaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the sub-transaction cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&subtransaction_buffers,
@@ -2360,7 +2360,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"transaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the transaction status cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&transaction_buffers,
@@ -2875,7 +2875,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS,
 			gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."),
-			gettext_noop("Specify -1 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify -1 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_XBLOCKS
 		},
 		&XLOGbuffers,
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 90cc580..4e2c9ff 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -932,7 +932,8 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("publisher requires %d replication slots, but only %d remain",
 					 num_dbs, max_repslots - cur_repslots);
-		pg_log_error_hint("Consider increasing max_replication_slots to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_replication_slots",
 						  cur_repslots + num_dbs);
 		failed = true;
 	}
@@ -941,7 +942,8 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("publisher requires %d wal sender processes, but only %d remain",
 					 num_dbs, max_walsenders - cur_walsenders);
-		pg_log_error_hint("Consider increasing max_wal_senders to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_wal_senders",
 						  cur_walsenders + num_dbs);
 		failed = true;
 	}
@@ -1031,7 +1033,8 @@ check_subscriber(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("subscriber requires %d replication slots, but only %d remain",
 					 num_dbs, max_repslots);
-		pg_log_error_hint("Consider increasing max_replication_slots to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_replication_slots",
 						  num_dbs);
 		failed = true;
 	}
@@ -1040,7 +1043,8 @@ check_subscriber(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("subscriber requires %d logical replication workers, but only %d remain",
 					 num_dbs, max_lrworkers);
-		pg_log_error_hint("Consider increasing max_logical_replication_workers to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_logical_replication_workers",
 						  num_dbs);
 		failed = true;
 	}
@@ -1049,7 +1053,8 @@ check_subscriber(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("subscriber requires %d worker processes, but only %d remain",
 					 num_dbs + 1, max_wprocs);
-		pg_log_error_hint("Consider increasing max_worker_processes to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_worker_processes",
 						  num_dbs + 1);
 		failed = true;
 	}
diff --git a/src/include/libpq/libpq-be-fe-helpers.h b/src/include/libpq/libpq-be-fe-helpers.h
index fe50829..46a90df 100644
--- a/src/include/libpq/libpq-be-fe-helpers.h
+++ b/src/include/libpq/libpq-be-fe-helpers.h
@@ -142,13 +142,13 @@ libpqsrv_connect_prepare(void)
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
+				 errhint("Raise the server's \"max_files_per_process\" and/or \"ulimit -n\" limits.")));
 #else
 		ereport(ERROR,
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process setting.")));
+				 errhint("Raise the server's \"max_files_per_process\" setting.")));
 #endif
 	}
 }
-- 
1.8.3.1

v7-0008-GUC-names-make-common-translatable-message-string.patchapplication/octet-stream; name=v7-0008-GUC-names-make-common-translatable-message-string.patchDownload
From 49c94014f2ca057f5d22e2327ca9769a1d0f7e6a Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 28 May 2024 15:42:26 +1000
Subject: [PATCH v7] GUC names - make common translatable message strings

---
 contrib/pg_prewarm/autoprewarm.c          |  2 +-
 src/backend/access/transam/xlog.c         | 78 +++++++++++++++++++------------
 src/backend/access/transam/xlogrecovery.c |  2 +-
 src/backend/commands/variable.c           | 11 +++--
 src/backend/port/sysv_shmem.c             |  3 +-
 src/backend/postmaster/bgworker.c         |  3 +-
 src/backend/postmaster/checkpointer.c     |  3 +-
 src/backend/replication/syncrep.c         |  3 +-
 src/backend/storage/file/fd.c             |  9 ++--
 src/backend/storage/lmgr/predicate.c      |  6 ++-
 src/backend/tcop/postgres.c               | 15 +++---
 src/backend/utils/fmgr/dfmgr.c            | 16 +++----
 12 files changed, 93 insertions(+), 58 deletions(-)

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 961d3b8..5c3d6e4 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -867,7 +867,7 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing configuration parameter \"%s\".", "max_worker_processes")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 1f3e601..0724277 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4391,17 +4391,21 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-						   " but the server was compiled with CATALOG_VERSION_NO %d.",
-						   ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "CATALOG_VERSION_NO", ControlFile->catalog_version_no,
+						   "CATALOG_VERSION_NO", CATALOG_VERSION_NO),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with MAXALIGN %d,"
-						   " but the server was compiled with MAXALIGN %d.",
-						   ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "MAXALIGN", ControlFile->maxAlign,
+						   "MAXALIGN", MAXIMUM_ALIGNOF),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
 		ereport(FATAL,
@@ -4413,57 +4417,71 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with BLCKSZ %d,"
-						   " but the server was compiled with BLCKSZ %d.",
-						   ControlFile->blcksz, BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "BLCKSZ", ControlFile->blcksz,
+						   "BLCKSZ", BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->relseg_size != RELSEG_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with RELSEG_SIZE %d,"
-						   " but the server was compiled with RELSEG_SIZE %d.",
-						   ControlFile->relseg_size, RELSEG_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "RELSEG_SIZE", ControlFile->relseg_size,
+						   "RELSEG_SIZE", RELSEG_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->xlog_blcksz != XLOG_BLCKSZ)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with XLOG_BLCKSZ %d,"
-						   " but the server was compiled with XLOG_BLCKSZ %d.",
-						   ControlFile->xlog_blcksz, XLOG_BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "XLOG_BLCKSZ", ControlFile->xlog_blcksz,
+						   "XLOG_BLCKSZ", XLOG_BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->nameDataLen != NAMEDATALEN)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with NAMEDATALEN %d,"
-						   " but the server was compiled with NAMEDATALEN %d.",
-						   ControlFile->nameDataLen, NAMEDATALEN),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "NAMEDATALEN", ControlFile->nameDataLen,
+						   "NAMEDATALEN", NAMEDATALEN),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
-						   " but the server was compiled with INDEX_MAX_KEYS %d.",
-						   ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "INDEX_MAX_KEYS", ControlFile->indexMaxKeys,
+						   "INDEX_MAX_KEYS", INDEX_MAX_KEYS),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
-						   " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
-						   ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "TOAST_MAX_CHUNK_SIZE", ControlFile->toast_max_chunk_size,
+						   "TOAST_MAX_CHUNK_SIZE", (int) TOAST_MAX_CHUNK_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->loblksize != LOBLKSIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with LOBLKSIZE %d,"
-						   " but the server was compiled with LOBLKSIZE %d.",
-						   ControlFile->loblksize, (int) LOBLKSIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "LOBLKSIZE", ControlFile->loblksize,
+						   "LOBLKSIZE", (int) LOBLKSIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef USE_FLOAT8_BYVAL
@@ -4501,11 +4519,13 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "min_wal_size", "wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "max_wal_size", "wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index b45b833..5ed4a47 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -4782,7 +4782,7 @@ check_recovery_target(char **newval, void **extra, GucSource source)
 {
 	if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("The only allowed value is \"immediate\".");
+		GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");
 		return false;
 	}
 	return true;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 3726aa3..584e14c 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"%s\" specifications.", "DateStyle");
 		return false;
 	}
 
@@ -717,7 +717,8 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change \"%s\" now.",
+								"client_encoding");
 		}
 		return false;
 	}
@@ -1202,7 +1203,8 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"effective_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"effective_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1215,7 +1217,8 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"maintenance_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"maintenance_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 362a37d..eb2455b 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -581,7 +581,8 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be 0 on this platform.",
+							"huge_page_size");
 		return false;
 	}
 #endif
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index cf5ffb9..a2aa1de 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -928,7 +928,8 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 								  "Up to %d background workers can be registered with the current settings.",
 								  max_worker_processes,
 								  max_worker_processes),
-				 errhint("Consider increasing the configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing the configuration parameter \"%s\".",
+						 "max_worker_processes")));
 		return;
 	}
 
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 1397335..db4f356 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -442,7 +442,8 @@ CheckpointerMain(char *startup_data, size_t startup_data_len)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"%s\".", "max_wal_size")));
+						 errhint("Consider increasing the configuration parameter \"%s\".",
+								 "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index fa5988c..59aa537 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1010,7 +1010,8 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("\"synchronous_standby_names\" parser failed");
+				GUC_check_errdetail("\"%s\" parser failed",
+									"synchronous_standby_names");
 			return false;
 		}
 
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index aa9d5f7..a213baf 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3947,7 +3947,8 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported on this platform.");
+		GUC_check_errdetail("\"%s\" is not supported on this platform.",
+						   "debug_io_direct");
 		result = false;
 	}
 	flags = 0;
@@ -3994,14 +3995,16 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "XLOG_BLCKSZ");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "BLCKSZ");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 9384165..c1e916c 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1678,8 +1678,10 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
-				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
+				 errdetail("\"%s\" is set to \"%s\"."
+						   "default_transaction_isolation", "serializable"),
+				 errhint("You can use \"%s\" to change the default.",
+						"SET default_transaction_isolation = 'repeatable read'")));
 
 	/*
 	 * A special optimization is available for SERIALIZABLE READ ONLY
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 45a3794..411cb3e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3582,7 +3582,8 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("\"%s\" must not exceed %ldkB.",
+							"max_stack_depth",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3607,7 +3608,8 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on this platform.",
+							"client_connection_check_interval");
 		return false;
 	}
 	return true;
@@ -3628,7 +3630,8 @@ check_stage_log_stats(bool *newval, void **extra, GucSource source)
 {
 	if (*newval && log_statement_stats)
 	{
-		GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
+		GUC_check_errdetail("Cannot enable parameter when \"%s\" is true.",
+							"log_statement_stats");
 		return false;
 	}
 	return true;
@@ -3643,9 +3646,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable \"%s\" when \"%s\", \"%s\", or \"%s\" is true.",
+							"log_statement_stats",
+							"log_parser_stats", "log_planner_stats", "log_executor_stats");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 092004d..5248766 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -358,8 +358,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FUNC_MAX_ARGS = %d, library has %d."),
-						 magic_data.funcmaxargs,
+						 _("Server has %s = %d, library has %d."),
+						 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
 						 module_magic_data->funcmaxargs);
 	}
 	if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
@@ -367,8 +367,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has INDEX_MAX_KEYS = %d, library has %d."),
-						 magic_data.indexmaxkeys,
+						 _("Server has %s = %d, library has %d."),
+						 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
 						 module_magic_data->indexmaxkeys);
 	}
 	if (module_magic_data->namedatalen != magic_data.namedatalen)
@@ -376,8 +376,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has NAMEDATALEN = %d, library has %d."),
-						 magic_data.namedatalen,
+						 _("Server has %s = %d, library has %d."),
+						 "NAMEDATALEN", magic_data.namedatalen,
 						 module_magic_data->namedatalen);
 	}
 	if (module_magic_data->float8byval != magic_data.float8byval)
@@ -385,8 +385,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FLOAT8PASSBYVAL = %s, library has %s."),
-						 magic_data.float8byval ? "true" : "false",
+						 _("Server has %s = %s, library has %s."),
+						 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
 						 module_magic_data->float8byval ? "true" : "false");
 	}
 
-- 
1.8.3.1

#59Peter Smith
smithpb2250@gmail.com
In reply to: Peter Smith (#58)
8 attachment(s)
Re: GUC names in messages

On Tue, May 28, 2024 at 4:16 PM Peter Smith <smithpb2250@gmail.com> wrote:

...

The new GUC quoting patches are separated by different GUC types only
to simplify my processing of them.

v7-0001 = Add quotes for GUCs - bool
v7-0002 = Add quotes for GUCs - int
v7-0003 = Add quotes for GUCs - real
v7-0004 = Add quotes for GUCs - string
v7-0005 = Add quotes for GUCs - enum

The other v7 patches are just carried forward unchanged from v6:

v7-0006 = fix case for IntervalStyle
v7-0007 = fix case for Datestyle
v7-0008 = make common translatable message strings

~~~~

Hi,

Here is a new patch set v8*, which is the same as v7* but fixes an
error in v7-0008 detected by cfbot.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v8-0001-Add-quotes-for-GUCs-bool.patchapplication/octet-stream; name=v8-0001-Add-quotes-for-GUCs-bool.patchDownload
From 4976951ec45455f14f03e10f952c514d920e8f68 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 11:08:52 +1000
Subject: [PATCH v8] Add quotes for GUCs - bool

---
 src/backend/replication/logical/slotsync.c             | 4 ++--
 src/test/recovery/t/040_standby_failover_slots_sync.pl | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 56d3fb5..2c60a84 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -1074,7 +1074,7 @@ ValidateSlotSyncParams(int elevel)
 		ereport(elevel,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires %s to be enabled",
+				errmsg("slot synchronization requires \"%s\" to be enabled",
 					   "hot_standby_feedback"));
 		return false;
 	}
@@ -1126,7 +1126,7 @@ slotsync_reread_config(void)
 	{
 		ereport(LOG,
 		/* translator: %s is a GUC variable name */
-				errmsg("slot sync worker will shutdown because %s is disabled", "sync_replication_slots"));
+				errmsg("slot sync worker will shutdown because \"%s\" is disabled", "sync_replication_slots"));
 		proc_exit(0);
 	}
 
diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl
index 3b6dddb..eca0b24 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -529,7 +529,7 @@ $standby1->wait_for_log(
 	qr/slot sync worker will restart because of a parameter change/,
 	$log_offset);
 $standby1->wait_for_log(
-	qr/slot synchronization requires hot_standby_feedback to be enabled/,
+	qr/slot synchronization requires "hot_standby_feedback" to be enabled/,
 	$log_offset);
 
 $log_offset = -s $standby1->logfile;
-- 
1.8.3.1

v8-0005-Add-quotes-for-GUCs-enum.patchapplication/octet-stream; name=v8-0005-Add-quotes-for-GUCs-enum.patchDownload
From 53e6bddaff689ce251602eb80c618dabfbee6b36 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 11:11:03 +1000
Subject: [PATCH v8] Add quotes for GUCs - enum

---
 src/backend/access/transam/xlog.c           | 2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 330e058..1f3e601 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -9061,7 +9061,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("WAL level not sufficient for making an online backup"),
-				 errhint("wal_level must be set to \"replica\" or \"logical\" at server start.")));
+				 errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
 
 	/*
 	 * OK to update backup counter and session-level lock.
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index acfb419..78e7fbb 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -924,7 +924,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 
 	if (strcmp(wal_level, "logical") != 0)
 	{
-		pg_log_error("publisher requires wal_level >= \"logical\"");
+		pg_log_error("publisher requires \"wal_level\" >= \"logical\"");
 		failed = true;
 	}
 
-- 
1.8.3.1

v8-0003-Add-quotes-for-GUCs-real.patchapplication/octet-stream; name=v8-0003-Add-quotes-for-GUCs-real.patchDownload
From d05c6a701b8318a9b9ea7f1a478d86aa912b3517 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 11:09:53 +1000
Subject: [PATCH v8] Add quotes for GUCs - real

---
 src/backend/utils/misc/guc_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 66ef451..ff9086e 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3001,7 +3001,7 @@ struct config_int ConfigureNamesInt[] =
 		{"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN,
 			gettext_noop("Sets the minimum execution time above which "
 						 "a sample of statements will be logged."
-						 " Sampling is determined by log_statement_sample_rate."),
+						 " Sampling is determined by \"log_statement_sample_rate\"."),
 			gettext_noop("Zero logs a sample of all queries. -1 turns this feature off."),
 			GUC_UNIT_MS
 		},
-- 
1.8.3.1

v8-0004-Add-quotes-for-GUCs-string.patchapplication/octet-stream; name=v8-0004-Add-quotes-for-GUCs-string.patchDownload
From ba4f6ce974fb62ae1be5187dbc3e0aadd4e54081 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 11:10:43 +1000
Subject: [PATCH v8] Add quotes for GUCs - string

---
 src/backend/archive/shell_archive.c           |  2 +-
 src/backend/replication/logical/slotsync.c    | 12 ++++++------
 src/bin/pg_archivecleanup/pg_archivecleanup.c |  2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c   |  2 +-
 src/bin/pg_dump/pg_backup_db.c                |  2 +-
 src/bin/pg_rewind/pg_rewind.c                 |  2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/backend/archive/shell_archive.c b/src/backend/archive/shell_archive.c
index 506c5a3..4de7e66 100644
--- a/src/backend/archive/shell_archive.c
+++ b/src/backend/archive/shell_archive.c
@@ -48,7 +48,7 @@ shell_archive_configured(ArchiveModuleState *state)
 	if (XLogArchiveCommand[0] != '\0')
 		return true;
 
-	arch_module_check_errdetail("%s is not set.",
+	arch_module_check_errdetail("\"%s\" is not set.",
 								"archive_command");
 	return false;
 }
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 2c60a84..aaacc1d 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -962,14 +962,14 @@ validate_remote_info(WalReceiverConn *wrconn)
 
 	if (res->status != WALRCV_OK_TUPLES)
 		ereport(ERROR,
-				errmsg("could not fetch primary_slot_name \"%s\" info from the primary server: %s",
+				errmsg("could not fetch primary slot name \"%s\" info from the primary server: %s",
 					   PrimarySlotName, res->err),
-				errhint("Check if primary_slot_name is configured correctly."));
+				errhint("Check if \"primary_slot_name\" is configured correctly."));
 
 	tupslot = MakeSingleTupleTableSlot(res->tupledesc, &TTSOpsMinimalTuple);
 	if (!tuplestore_gettupleslot(res->tuplestore, true, false, tupslot))
 		elog(ERROR,
-			 "failed to fetch tuple for the primary server slot specified by primary_slot_name");
+			 "failed to fetch tuple for the primary server slot specified by \"primary_slot_name\"");
 
 	remote_in_recovery = DatumGetBool(slot_getattr(tupslot, 1, &isnull));
 	Assert(!isnull);
@@ -992,9 +992,9 @@ validate_remote_info(WalReceiverConn *wrconn)
 	if (!primary_slot_valid)
 		ereport(ERROR,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires valid primary_slot_name"),
+				errmsg("slot synchronization requires valid \"primary_slot_name\""),
 		/* translator: second %s is a GUC variable name */
-				errdetail("The replication slot \"%s\" specified by %s does not exist on the primary server.",
+				errdetail("The replication slot \"%s\" specified by \"%s\" does not exist on the primary server.",
 						  PrimarySlotName, "primary_slot_name"));
 
 	ExecClearTuple(tupslot);
@@ -1060,7 +1060,7 @@ ValidateSlotSyncParams(int elevel)
 		ereport(elevel,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires %s to be defined", "primary_slot_name"));
+				errmsg("slot synchronization requires \"%s\" to be defined", "primary_slot_name"));
 		return false;
 	}
 
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 07bf356..3acbe69 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -269,7 +269,7 @@ usage(void)
 			 "                              clean up\n"));
 	printf(_("  -?, --help                  show this help, then exit\n"));
 	printf(_("\n"
-			 "For use as archive_cleanup_command in postgresql.conf:\n"
+			 "For use as \"archive_cleanup_command\" in postgresql.conf:\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
 			 "e.g.\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 4e2c9ff..acfb419 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -510,7 +510,7 @@ connect_database(const char *conninfo, bool exit_on_error)
 	res = PQexec(conn, ALWAYS_SECURE_SEARCH_PATH_SQL);
 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		pg_log_error("could not clear search_path: %s",
+		pg_log_error("could not clear \"search_path\": %s",
 					 PQresultErrorMessage(res));
 		PQclear(res);
 		PQfinish(conn);
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index a02841c..4d1957a 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -39,7 +39,7 @@ _check_database_version(ArchiveHandle *AH)
 	remoteversion_str = PQparameterStatus(AH->connection, "server_version");
 	remoteversion = PQserverVersion(AH->connection);
 	if (remoteversion == 0 || !remoteversion_str)
-		pg_fatal("could not get server_version from libpq");
+		pg_fatal("could not get \"server_version\" from libpq");
 
 	AH->public.remoteVersionStr = pg_strdup(remoteversion_str);
 	AH->public.remoteVersion = remoteversion;
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 8dfea05..287245c 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -1106,7 +1106,7 @@ getRestoreCommand(const char *argv0)
 
 	restore_command = pipe_read_line(postgres_cmd->data);
 	if (restore_command == NULL)
-		pg_fatal("unable to read restore_command from target cluster");
+		pg_fatal("unable to read \"restore_command\" from target cluster");
 
 	(void) pg_strip_crlf(restore_command);
 
-- 
1.8.3.1

v8-0002-Add-quotes-foir-GUCs-int.patchapplication/octet-stream; name=v8-0002-Add-quotes-foir-GUCs-int.patchDownload
From f247d21658ac80262c1ac4d8b07a9bdaebbfe687 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 11:09:33 +1000
Subject: [PATCH v8] Add quotes foir GUCs - int

---
 src/backend/postmaster/bgworker.c           |  2 +-
 src/backend/postmaster/checkpointer.c       |  2 +-
 src/backend/replication/logical/launcher.c  |  2 +-
 src/backend/storage/file/fd.c               |  2 +-
 src/backend/utils/misc/guc_tables.c         |  8 ++++----
 src/bin/pg_basebackup/pg_createsubscriber.c | 15 ++++++++++-----
 src/include/libpq/libpq-be-fe-helpers.h     |  4 ++--
 7 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index fa52b6d..cf5ffb9 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -257,7 +257,7 @@ BackgroundWorkerStateChange(bool allow_new_workers)
 	if (max_worker_processes != BackgroundWorkerData->total_slots)
 	{
 		ereport(LOG,
-				(errmsg("inconsistent background worker state (max_worker_processes=%d, total_slots=%d)",
+				(errmsg("inconsistent background worker state (\"max_worker_processes\"=%d, total slots=%d)",
 						max_worker_processes,
 						BackgroundWorkerData->total_slots)));
 		return;
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 3c68a99..1397335 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -663,7 +663,7 @@ CheckArchiveTimeout(void)
 			 * assume nothing happened.
 			 */
 			if (XLogSegmentOffset(switchpoint, wal_segment_size) != 0)
-				elog(DEBUG1, "write-ahead log switch forced (archive_timeout=%d)",
+				elog(DEBUG1, "write-ahead log switch forced (\"archive_timeout\"=%d)",
 					 XLogArchiveTimeout);
 		}
 
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 27c3a91..b902b78 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -331,7 +331,7 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
 	if (max_replication_slots == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("cannot start logical replication workers when max_replication_slots = 0")));
+				 errmsg("cannot start logical replication workers when \"max_replication_slots\" = 0")));
 
 	/*
 	 * We need to do the modification of the shared memory under lock so that
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index a7c05b0..aa9d5f7 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2231,7 +2231,7 @@ FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset,
 			if (newTotal > (uint64) temp_file_limit * (uint64) 1024)
 				ereport(ERROR,
 						(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-						 errmsg("temporary file size exceeds temp_file_limit (%dkB)",
+						 errmsg("temporary file size exceeds \"temp_file_limit\" (%dkB)",
 								temp_file_limit)));
 		}
 	}
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 46c258b..66ef451 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -2294,7 +2294,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"commit_timestamp_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the commit timestamp cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&commit_timestamp_buffers,
@@ -2349,7 +2349,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"subtransaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the sub-transaction cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&subtransaction_buffers,
@@ -2360,7 +2360,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"transaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the transaction status cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&transaction_buffers,
@@ -2875,7 +2875,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS,
 			gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."),
-			gettext_noop("Specify -1 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify -1 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_XBLOCKS
 		},
 		&XLOGbuffers,
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 90cc580..4e2c9ff 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -932,7 +932,8 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("publisher requires %d replication slots, but only %d remain",
 					 num_dbs, max_repslots - cur_repslots);
-		pg_log_error_hint("Consider increasing max_replication_slots to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_replication_slots",
 						  cur_repslots + num_dbs);
 		failed = true;
 	}
@@ -941,7 +942,8 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("publisher requires %d wal sender processes, but only %d remain",
 					 num_dbs, max_walsenders - cur_walsenders);
-		pg_log_error_hint("Consider increasing max_wal_senders to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_wal_senders",
 						  cur_walsenders + num_dbs);
 		failed = true;
 	}
@@ -1031,7 +1033,8 @@ check_subscriber(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("subscriber requires %d replication slots, but only %d remain",
 					 num_dbs, max_repslots);
-		pg_log_error_hint("Consider increasing max_replication_slots to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_replication_slots",
 						  num_dbs);
 		failed = true;
 	}
@@ -1040,7 +1043,8 @@ check_subscriber(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("subscriber requires %d logical replication workers, but only %d remain",
 					 num_dbs, max_lrworkers);
-		pg_log_error_hint("Consider increasing max_logical_replication_workers to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_logical_replication_workers",
 						  num_dbs);
 		failed = true;
 	}
@@ -1049,7 +1053,8 @@ check_subscriber(const struct LogicalRepInfo *dbinfo)
 	{
 		pg_log_error("subscriber requires %d worker processes, but only %d remain",
 					 num_dbs + 1, max_wprocs);
-		pg_log_error_hint("Consider increasing max_worker_processes to at least %d.",
+		pg_log_error_hint("Consider increasing \"%s\" to at least %d.",
+						  "max_worker_processes",
 						  num_dbs + 1);
 		failed = true;
 	}
diff --git a/src/include/libpq/libpq-be-fe-helpers.h b/src/include/libpq/libpq-be-fe-helpers.h
index fe50829..46a90df 100644
--- a/src/include/libpq/libpq-be-fe-helpers.h
+++ b/src/include/libpq/libpq-be-fe-helpers.h
@@ -142,13 +142,13 @@ libpqsrv_connect_prepare(void)
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
+				 errhint("Raise the server's \"max_files_per_process\" and/or \"ulimit -n\" limits.")));
 #else
 		ereport(ERROR,
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process setting.")));
+				 errhint("Raise the server's \"max_files_per_process\" setting.")));
 #endif
 	}
 }
-- 
1.8.3.1

v8-0007-GUC-names-fix-case-datestyle.patchapplication/octet-stream; name=v8-0007-GUC-names-fix-case-datestyle.patchDownload
From 6838cf7e53cfdf818393354908a19c91325908cc Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 11:12:02 +1000
Subject: [PATCH v8] GUC names fix case - datestyle

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 9345131..3726aa3 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 7abdc62..600b591 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4107,7 +4107,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different \"DateStyle\" setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..e936f66 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index 241713c..13603f6 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

v8-0006-GUC-names-fix-case-intervalstyle.patchapplication/octet-stream; name=v8-0006-GUC-names-fix-case-intervalstyle.patchDownload
From 52556c5ec8101f742f7bf1e2187b7a7e5f50b995 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 11:11:34 +1000
Subject: [PATCH v8] GUC names fix case - intervalstyle

---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 547cecd..a458958 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3281,7 +3281,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 455b6d6..b5d94eb 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761..98d8ae4 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,7 +2,10 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
 -- SET to some nondefault value
+
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
 SHOW vacuum_cost_delay;
-- 
1.8.3.1

v8-0008-GUC-names-make-common-translatable-messages.patchapplication/octet-stream; name=v8-0008-GUC-names-make-common-translatable-messages.patchDownload
From bdc1236512d85449c61909d9fe02062364e3981e Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 11 Jun 2024 12:04:27 +1000
Subject: [PATCH v8] GUC names - make common translatable messages

---
 contrib/pg_prewarm/autoprewarm.c          |  2 +-
 src/backend/access/transam/xlog.c         | 78 +++++++++++++++++++------------
 src/backend/access/transam/xlogrecovery.c |  2 +-
 src/backend/commands/variable.c           | 11 +++--
 src/backend/port/sysv_shmem.c             |  3 +-
 src/backend/postmaster/bgworker.c         |  3 +-
 src/backend/postmaster/checkpointer.c     |  3 +-
 src/backend/replication/syncrep.c         |  3 +-
 src/backend/storage/file/fd.c             |  9 ++--
 src/backend/storage/lmgr/predicate.c      |  6 ++-
 src/backend/tcop/postgres.c               | 15 +++---
 src/backend/utils/fmgr/dfmgr.c            | 16 +++----
 12 files changed, 93 insertions(+), 58 deletions(-)

diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 961d3b8..5c3d6e4 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -867,7 +867,7 @@ apw_start_database_worker(void)
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
 				 errmsg("registering dynamic bgworker autoprewarm failed"),
-				 errhint("Consider increasing configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing configuration parameter \"%s\".", "max_worker_processes")));
 
 	/*
 	 * Ignore return value; if it fails, postmaster has died, but we have
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 1f3e601..0724277 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4391,17 +4391,21 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-						   " but the server was compiled with CATALOG_VERSION_NO %d.",
-						   ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "CATALOG_VERSION_NO", ControlFile->catalog_version_no,
+						   "CATALOG_VERSION_NO", CATALOG_VERSION_NO),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with MAXALIGN %d,"
-						   " but the server was compiled with MAXALIGN %d.",
-						   ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "MAXALIGN", ControlFile->maxAlign,
+						   "MAXALIGN", MAXIMUM_ALIGNOF),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
 		ereport(FATAL,
@@ -4413,57 +4417,71 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with BLCKSZ %d,"
-						   " but the server was compiled with BLCKSZ %d.",
-						   ControlFile->blcksz, BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "BLCKSZ", ControlFile->blcksz,
+						   "BLCKSZ", BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->relseg_size != RELSEG_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with RELSEG_SIZE %d,"
-						   " but the server was compiled with RELSEG_SIZE %d.",
-						   ControlFile->relseg_size, RELSEG_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "RELSEG_SIZE", ControlFile->relseg_size,
+						   "RELSEG_SIZE", RELSEG_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->xlog_blcksz != XLOG_BLCKSZ)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with XLOG_BLCKSZ %d,"
-						   " but the server was compiled with XLOG_BLCKSZ %d.",
-						   ControlFile->xlog_blcksz, XLOG_BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "XLOG_BLCKSZ", ControlFile->xlog_blcksz,
+						   "XLOG_BLCKSZ", XLOG_BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->nameDataLen != NAMEDATALEN)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with NAMEDATALEN %d,"
-						   " but the server was compiled with NAMEDATALEN %d.",
-						   ControlFile->nameDataLen, NAMEDATALEN),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "NAMEDATALEN", ControlFile->nameDataLen,
+						   "NAMEDATALEN", NAMEDATALEN),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
-						   " but the server was compiled with INDEX_MAX_KEYS %d.",
-						   ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "INDEX_MAX_KEYS", ControlFile->indexMaxKeys,
+						   "INDEX_MAX_KEYS", INDEX_MAX_KEYS),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
-						   " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
-						   ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "TOAST_MAX_CHUNK_SIZE", ControlFile->toast_max_chunk_size,
+						   "TOAST_MAX_CHUNK_SIZE", (int) TOAST_MAX_CHUNK_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->loblksize != LOBLKSIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with LOBLKSIZE %d,"
-						   " but the server was compiled with LOBLKSIZE %d.",
-						   ControlFile->loblksize, (int) LOBLKSIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "LOBLKSIZE", ControlFile->loblksize,
+						   "LOBLKSIZE", (int) LOBLKSIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef USE_FLOAT8_BYVAL
@@ -4501,11 +4519,13 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "min_wal_size", "wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "max_wal_size", "wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index b45b833..5ed4a47 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -4782,7 +4782,7 @@ check_recovery_target(char **newval, void **extra, GucSource source)
 {
 	if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("The only allowed value is \"immediate\".");
+		GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");
 		return false;
 	}
 	return true;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 3726aa3..584e14c 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"%s\" specifications.", "DateStyle");
 		return false;
 	}
 
@@ -717,7 +717,8 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change \"%s\" now.",
+								"client_encoding");
 		}
 		return false;
 	}
@@ -1202,7 +1203,8 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"effective_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"effective_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1215,7 +1217,8 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"maintenance_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"maintenance_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 362a37d..eb2455b 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -581,7 +581,8 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be 0 on this platform.",
+							"huge_page_size");
 		return false;
 	}
 #endif
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index cf5ffb9..a2aa1de 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -928,7 +928,8 @@ RegisterBackgroundWorker(BackgroundWorker *worker)
 								  "Up to %d background workers can be registered with the current settings.",
 								  max_worker_processes,
 								  max_worker_processes),
-				 errhint("Consider increasing the configuration parameter \"max_worker_processes\".")));
+				 errhint("Consider increasing the configuration parameter \"%s\".",
+						 "max_worker_processes")));
 		return;
 	}
 
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 1397335..db4f356 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -442,7 +442,8 @@ CheckpointerMain(char *startup_data, size_t startup_data_len)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"%s\".", "max_wal_size")));
+						 errhint("Consider increasing the configuration parameter \"%s\".",
+								 "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index fa5988c..59aa537 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1010,7 +1010,8 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("\"synchronous_standby_names\" parser failed");
+				GUC_check_errdetail("\"%s\" parser failed",
+									"synchronous_standby_names");
 			return false;
 		}
 
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index aa9d5f7..a213baf 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3947,7 +3947,8 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported on this platform.");
+		GUC_check_errdetail("\"%s\" is not supported on this platform.",
+						   "debug_io_direct");
 		result = false;
 	}
 	flags = 0;
@@ -3994,14 +3995,16 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "XLOG_BLCKSZ");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "BLCKSZ");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 9384165..9f9850f 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1678,8 +1678,10 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
-				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
+				 errdetail("\"%s\" is set to \"%s\".",
+						   "default_transaction_isolation", "serializable"),
+				 errhint("You can use \"%s\" to change the default.",
+						"SET default_transaction_isolation = 'repeatable read'")));
 
 	/*
 	 * A special optimization is available for SERIALIZABLE READ ONLY
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 45a3794..411cb3e 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3582,7 +3582,8 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("\"%s\" must not exceed %ldkB.",
+							"max_stack_depth",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3607,7 +3608,8 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on this platform.",
+							"client_connection_check_interval");
 		return false;
 	}
 	return true;
@@ -3628,7 +3630,8 @@ check_stage_log_stats(bool *newval, void **extra, GucSource source)
 {
 	if (*newval && log_statement_stats)
 	{
-		GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
+		GUC_check_errdetail("Cannot enable parameter when \"%s\" is true.",
+							"log_statement_stats");
 		return false;
 	}
 	return true;
@@ -3643,9 +3646,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable \"%s\" when \"%s\", \"%s\", or \"%s\" is true.",
+							"log_statement_stats",
+							"log_parser_stats", "log_planner_stats", "log_executor_stats");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 092004d..5248766 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -358,8 +358,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FUNC_MAX_ARGS = %d, library has %d."),
-						 magic_data.funcmaxargs,
+						 _("Server has %s = %d, library has %d."),
+						 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
 						 module_magic_data->funcmaxargs);
 	}
 	if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
@@ -367,8 +367,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has INDEX_MAX_KEYS = %d, library has %d."),
-						 magic_data.indexmaxkeys,
+						 _("Server has %s = %d, library has %d."),
+						 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
 						 module_magic_data->indexmaxkeys);
 	}
 	if (module_magic_data->namedatalen != magic_data.namedatalen)
@@ -376,8 +376,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has NAMEDATALEN = %d, library has %d."),
-						 magic_data.namedatalen,
+						 _("Server has %s = %d, library has %d."),
+						 "NAMEDATALEN", magic_data.namedatalen,
 						 module_magic_data->namedatalen);
 	}
 	if (module_magic_data->float8byval != magic_data.float8byval)
@@ -385,8 +385,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FLOAT8PASSBYVAL = %s, library has %s."),
-						 magic_data.float8byval ? "true" : "false",
+						 _("Server has %s = %s, library has %s."),
+						 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
 						 module_magic_data->float8byval ? "true" : "false");
 	}
 
-- 
1.8.3.1

#60Peter Smith
smithpb2250@gmail.com
In reply to: Peter Smith (#59)
8 attachment(s)
Re: GUC names in messages

CFBot reported some failures, so I have attached the rebased patch set v9*.

I'm hopeful the majority of these might be pushed to avoid more rebasing...

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v9-0001-Add-quotes-for-GUCs-bool.patchapplication/octet-stream; name=v9-0001-Add-quotes-for-GUCs-bool.patchDownload
From 23e01933cf1fe82eeb2e773e9e3d9d92c674ccb9 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 15:14:52 +1000
Subject: [PATCH v9] Add quotes for GUCs - bool

---
 src/backend/replication/logical/slotsync.c             | 4 ++--
 src/test/recovery/t/040_standby_failover_slots_sync.pl | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 2d1914c..062ff3d 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -1074,7 +1074,7 @@ ValidateSlotSyncParams(int elevel)
 		ereport(elevel,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires %s to be enabled",
+				errmsg("slot synchronization requires \"%s\" to be enabled",
 					   "hot_standby_feedback"));
 		return false;
 	}
@@ -1126,7 +1126,7 @@ slotsync_reread_config(void)
 	{
 		ereport(LOG,
 		/* translator: %s is a GUC variable name */
-				errmsg("slot sync worker will shutdown because %s is disabled", "sync_replication_slots"));
+				errmsg("slot sync worker will shutdown because \"%s\" is disabled", "sync_replication_slots"));
 		proc_exit(0);
 	}
 
diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl
index 2c51cfc..f3c0682 100644
--- a/src/test/recovery/t/040_standby_failover_slots_sync.pl
+++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl
@@ -529,7 +529,7 @@ $standby1->wait_for_log(
 	qr/slot sync worker will restart because of a parameter change/,
 	$log_offset);
 $standby1->wait_for_log(
-	qr/slot synchronization requires hot_standby_feedback to be enabled/,
+	qr/slot synchronization requires "hot_standby_feedback" to be enabled/,
 	$log_offset);
 
 $log_offset = -s $standby1->logfile;
-- 
1.8.3.1

v9-0005-Add-quotes-for-GUCs-enum.patchapplication/octet-stream; name=v9-0005-Add-quotes-for-GUCs-enum.patchDownload
From e3d37bb4ee13aedd13ab1e2a12170d865961349d Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 15:39:25 +1000
Subject: [PATCH v9] Add quotes for GUCs - enum

---
 src/backend/access/transam/xlog.c           | 2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ee0fb0e..8c9e048 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -9111,7 +9111,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("WAL level not sufficient for making an online backup"),
-				 errhint("wal_level must be set to \"replica\" or \"logical\" at server start.")));
+				 errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
 
 	/*
 	 * OK to update backup counter and session-level lock.
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index c2c9d10..822b4f4 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -911,7 +911,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 
 	if (strcmp(wal_level, "logical") != 0)
 	{
-		pg_log_error("publisher requires wal_level >= \"logical\"");
+		pg_log_error("publisher requires \"wal_level\" >= \"logical\"");
 		failed = true;
 	}
 
-- 
1.8.3.1

v9-0003-Add-quotes-for-GUCs-real.patchapplication/octet-stream; name=v9-0003-Add-quotes-for-GUCs-real.patchDownload
From 0991eb9ac8f1c95ea7ea322081171471f9f6b4cc Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 15:36:35 +1000
Subject: [PATCH v9] Add quotes for GUCs - real

---
 src/backend/utils/misc/guc_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 039696e..6c39fc2 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3068,7 +3068,7 @@ struct config_int ConfigureNamesInt[] =
 		{"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN,
 			gettext_noop("Sets the minimum execution time above which "
 						 "a sample of statements will be logged."
-						 " Sampling is determined by log_statement_sample_rate."),
+						 " Sampling is determined by \"log_statement_sample_rate\"."),
 			gettext_noop("Zero logs a sample of all queries. -1 turns this feature off."),
 			GUC_UNIT_MS
 		},
-- 
1.8.3.1

v9-0004-Add-quotes-for-GUCs-string.patchapplication/octet-stream; name=v9-0004-Add-quotes-for-GUCs-string.patchDownload
From 7bc8a8db24a21c13ba1d271ffca2142687a26116 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 15:38:02 +1000
Subject: [PATCH v9] Add quotes for GUCs - string

---
 src/backend/archive/shell_archive.c           |  2 +-
 src/backend/replication/logical/slotsync.c    | 12 ++++++------
 src/bin/pg_archivecleanup/pg_archivecleanup.c |  2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c   |  2 +-
 src/bin/pg_dump/pg_backup_db.c                |  2 +-
 src/bin/pg_rewind/pg_rewind.c                 |  2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/backend/archive/shell_archive.c b/src/backend/archive/shell_archive.c
index 506c5a3..4de7e66 100644
--- a/src/backend/archive/shell_archive.c
+++ b/src/backend/archive/shell_archive.c
@@ -48,7 +48,7 @@ shell_archive_configured(ArchiveModuleState *state)
 	if (XLogArchiveCommand[0] != '\0')
 		return true;
 
-	arch_module_check_errdetail("%s is not set.",
+	arch_module_check_errdetail("\"%s\" is not set.",
 								"archive_command");
 	return false;
 }
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 062ff3d..a36c3f3 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -962,14 +962,14 @@ validate_remote_info(WalReceiverConn *wrconn)
 
 	if (res->status != WALRCV_OK_TUPLES)
 		ereport(ERROR,
-				errmsg("could not fetch primary_slot_name \"%s\" info from the primary server: %s",
+				errmsg("could not fetch primary slot name \"%s\" info from the primary server: %s",
 					   PrimarySlotName, res->err),
-				errhint("Check if primary_slot_name is configured correctly."));
+				errhint("Check if \"primary_slot_name\" is configured correctly."));
 
 	tupslot = MakeSingleTupleTableSlot(res->tupledesc, &TTSOpsMinimalTuple);
 	if (!tuplestore_gettupleslot(res->tuplestore, true, false, tupslot))
 		elog(ERROR,
-			 "failed to fetch tuple for the primary server slot specified by primary_slot_name");
+			 "failed to fetch tuple for the primary server slot specified by \"primary_slot_name\"");
 
 	remote_in_recovery = DatumGetBool(slot_getattr(tupslot, 1, &isnull));
 	Assert(!isnull);
@@ -992,9 +992,9 @@ validate_remote_info(WalReceiverConn *wrconn)
 	if (!primary_slot_valid)
 		ereport(ERROR,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires valid primary_slot_name"),
+				errmsg("slot synchronization requires valid \"primary_slot_name\""),
 		/* translator: second %s is a GUC variable name */
-				errdetail("The replication slot \"%s\" specified by %s does not exist on the primary server.",
+				errdetail("The replication slot \"%s\" specified by \"%s\" does not exist on the primary server.",
 						  PrimarySlotName, "primary_slot_name"));
 
 	ExecClearTuple(tupslot);
@@ -1060,7 +1060,7 @@ ValidateSlotSyncParams(int elevel)
 		ereport(elevel,
 		/* translator: %s is a GUC variable name */
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("slot synchronization requires %s to be defined", "primary_slot_name"));
+				errmsg("slot synchronization requires \"%s\" to be defined", "primary_slot_name"));
 		return false;
 	}
 
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 5a12438..c25348b 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -270,7 +270,7 @@ usage(void)
 			 "                              clean up\n"));
 	printf(_("  -?, --help                  show this help, then exit\n"));
 	printf(_("\n"
-			 "For use as archive_cleanup_command in postgresql.conf:\n"
+			 "For use as \"archive_cleanup_command\" in postgresql.conf:\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
 			 "e.g.\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 6295783..c2c9d10 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -523,7 +523,7 @@ connect_database(const char *conninfo, bool exit_on_error)
 	res = PQexec(conn, ALWAYS_SECURE_SEARCH_PATH_SQL);
 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		pg_log_error("could not clear search_path: %s",
+		pg_log_error("could not clear \"search_path\": %s",
 					 PQresultErrorMessage(res));
 		PQclear(res);
 		PQfinish(conn);
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index a02841c..4d1957a 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -39,7 +39,7 @@ _check_database_version(ArchiveHandle *AH)
 	remoteversion_str = PQparameterStatus(AH->connection, "server_version");
 	remoteversion = PQserverVersion(AH->connection);
 	if (remoteversion == 0 || !remoteversion_str)
-		pg_fatal("could not get server_version from libpq");
+		pg_fatal("could not get \"server_version\" from libpq");
 
 	AH->public.remoteVersionStr = pg_strdup(remoteversion_str);
 	AH->public.remoteVersion = remoteversion;
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 323c356..c6c4daa 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -1104,7 +1104,7 @@ getRestoreCommand(const char *argv0)
 
 	restore_command = pipe_read_line(postgres_cmd->data);
 	if (restore_command == NULL)
-		pg_fatal("unable to read restore_command from target cluster");
+		pg_fatal("unable to read \"restore_command\" from target cluster");
 
 	(void) pg_strip_crlf(restore_command);
 
-- 
1.8.3.1

v9-0002-Add-quotes-for-GUCs-int.patchapplication/octet-stream; name=v9-0002-Add-quotes-for-GUCs-int.patchDownload
From dc834492cf04c40966808ab3c9b48f7f7c816a17 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 15:34:30 +1000
Subject: [PATCH v9] Add quotes for GUCs - int

---
 src/backend/postmaster/bgworker.c          | 2 +-
 src/backend/postmaster/checkpointer.c      | 2 +-
 src/backend/replication/logical/launcher.c | 2 +-
 src/backend/storage/file/fd.c              | 2 +-
 src/backend/utils/misc/guc_tables.c        | 8 ++++----
 src/include/libpq/libpq-be-fe-helpers.h    | 4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index b83967c..07bc551 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -257,7 +257,7 @@ BackgroundWorkerStateChange(bool allow_new_workers)
 	if (max_worker_processes != BackgroundWorkerData->total_slots)
 	{
 		ereport(LOG,
-				(errmsg("inconsistent background worker state (max_worker_processes=%d, total_slots=%d)",
+				(errmsg("inconsistent background worker state (\"max_worker_processes\"=%d, total slots=%d)",
 						max_worker_processes,
 						BackgroundWorkerData->total_slots)));
 		return;
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 199f008..eeb73c8 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -663,7 +663,7 @@ CheckArchiveTimeout(void)
 			 * assume nothing happened.
 			 */
 			if (XLogSegmentOffset(switchpoint, wal_segment_size) != 0)
-				elog(DEBUG1, "write-ahead log switch forced (archive_timeout=%d)",
+				elog(DEBUG1, "write-ahead log switch forced (\"archive_timeout\"=%d)",
 					 XLogArchiveTimeout);
 		}
 
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index c566d50..3df5ac5a 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -337,7 +337,7 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
 	if (max_replication_slots == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("cannot start logical replication workers when max_replication_slots = 0")));
+				 errmsg("cannot start logical replication workers when \"max_replication_slots\" = 0")));
 
 	/*
 	 * We need to do the modification of the shared memory under lock so that
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 3944321..e32718e 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2231,7 +2231,7 @@ FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset,
 			if (newTotal > (uint64) temp_file_limit * (uint64) 1024)
 				ereport(ERROR,
 						(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-						 errmsg("temporary file size exceeds temp_file_limit (%dkB)",
+						 errmsg("temporary file size exceeds \"temp_file_limit\" (%dkB)",
 								temp_file_limit)));
 		}
 	}
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 79ecaa4..039696e 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -2356,7 +2356,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"commit_timestamp_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the commit timestamp cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&commit_timestamp_buffers,
@@ -2411,7 +2411,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"subtransaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the sub-transaction cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&subtransaction_buffers,
@@ -2422,7 +2422,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"transaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the transaction status cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&transaction_buffers,
@@ -2942,7 +2942,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS,
 			gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."),
-			gettext_noop("Specify -1 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify -1 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_XBLOCKS
 		},
 		&XLOGbuffers,
diff --git a/src/include/libpq/libpq-be-fe-helpers.h b/src/include/libpq/libpq-be-fe-helpers.h
index fe50829..46a90df 100644
--- a/src/include/libpq/libpq-be-fe-helpers.h
+++ b/src/include/libpq/libpq-be-fe-helpers.h
@@ -142,13 +142,13 @@ libpqsrv_connect_prepare(void)
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
+				 errhint("Raise the server's \"max_files_per_process\" and/or \"ulimit -n\" limits.")));
 #else
 		ereport(ERROR,
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process setting.")));
+				 errhint("Raise the server's \"max_files_per_process\" setting.")));
 #endif
 	}
 }
-- 
1.8.3.1

v9-0008-GUC-names-make-common-translatable-messages.patchapplication/octet-stream; name=v9-0008-GUC-names-make-common-translatable-messages.patchDownload
From 5a72585e39e67d55997fa7f8925a4265bf003c08 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 16:50:11 +1000
Subject: [PATCH v9] GUC names - make common translatable messages

---
 src/backend/access/transam/xlog.c         | 78 +++++++++++++++++++------------
 src/backend/access/transam/xlogrecovery.c |  2 +-
 src/backend/commands/variable.c           | 11 +++--
 src/backend/port/sysv_shmem.c             |  3 +-
 src/backend/postmaster/checkpointer.c     |  3 +-
 src/backend/replication/syncrep.c         |  3 +-
 src/backend/storage/file/fd.c             |  9 ++--
 src/backend/storage/lmgr/predicate.c      |  6 ++-
 src/backend/tcop/postgres.c               | 15 +++---
 src/backend/utils/fmgr/dfmgr.c            | 16 +++----
 10 files changed, 90 insertions(+), 56 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 8c9e048..8ccec20 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4395,17 +4395,21 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-						   " but the server was compiled with CATALOG_VERSION_NO %d.",
-						   ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "CATALOG_VERSION_NO", ControlFile->catalog_version_no,
+						   "CATALOG_VERSION_NO", CATALOG_VERSION_NO),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with MAXALIGN %d,"
-						   " but the server was compiled with MAXALIGN %d.",
-						   ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "MAXALIGN", ControlFile->maxAlign,
+						   "MAXALIGN", MAXIMUM_ALIGNOF),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
 		ereport(FATAL,
@@ -4417,57 +4421,71 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with BLCKSZ %d,"
-						   " but the server was compiled with BLCKSZ %d.",
-						   ControlFile->blcksz, BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "BLCKSZ", ControlFile->blcksz,
+						   "BLCKSZ", BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->relseg_size != RELSEG_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with RELSEG_SIZE %d,"
-						   " but the server was compiled with RELSEG_SIZE %d.",
-						   ControlFile->relseg_size, RELSEG_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "RELSEG_SIZE", ControlFile->relseg_size,
+						   "RELSEG_SIZE", RELSEG_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->xlog_blcksz != XLOG_BLCKSZ)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with XLOG_BLCKSZ %d,"
-						   " but the server was compiled with XLOG_BLCKSZ %d.",
-						   ControlFile->xlog_blcksz, XLOG_BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "XLOG_BLCKSZ", ControlFile->xlog_blcksz,
+						   "XLOG_BLCKSZ", XLOG_BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->nameDataLen != NAMEDATALEN)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with NAMEDATALEN %d,"
-						   " but the server was compiled with NAMEDATALEN %d.",
-						   ControlFile->nameDataLen, NAMEDATALEN),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "NAMEDATALEN", ControlFile->nameDataLen,
+						   "NAMEDATALEN", NAMEDATALEN),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
-						   " but the server was compiled with INDEX_MAX_KEYS %d.",
-						   ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "INDEX_MAX_KEYS", ControlFile->indexMaxKeys,
+						   "INDEX_MAX_KEYS", INDEX_MAX_KEYS),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
-						   " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
-						   ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "TOAST_MAX_CHUNK_SIZE", ControlFile->toast_max_chunk_size,
+						   "TOAST_MAX_CHUNK_SIZE", (int) TOAST_MAX_CHUNK_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->loblksize != LOBLKSIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with LOBLKSIZE %d,"
-						   " but the server was compiled with LOBLKSIZE %d.",
-						   ControlFile->loblksize, (int) LOBLKSIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "LOBLKSIZE", ControlFile->loblksize,
+						   "LOBLKSIZE", (int) LOBLKSIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef USE_FLOAT8_BYVAL
@@ -4505,11 +4523,13 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "min_wal_size", "wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "max_wal_size", "wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index ad817fb..36e3131 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -4794,7 +4794,7 @@ check_recovery_target(char **newval, void **extra, GucSource source)
 {
 	if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("The only allowed value is \"immediate\".");
+		GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");
 		return false;
 	}
 	return true;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 7a2c37c..9109ed0 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"%s\" specifications.", "DateStyle");
 		return false;
 	}
 
@@ -745,7 +745,8 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change \"%s\" now.",
+								"client_encoding");
 		}
 		return false;
 	}
@@ -1212,7 +1213,8 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"effective_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"effective_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1225,7 +1227,8 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"maintenance_io_concurrency\" must be set to 0 on platforms that lack posix_fadvise().");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack posix_fadvise().",
+							"maintenance_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 362a37d..eb2455b 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -581,7 +581,8 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be 0 on this platform.",
+							"huge_page_size");
 		return false;
 	}
 #endif
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index eeb73c8..e3db617 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -442,7 +442,8 @@ CheckpointerMain(char *startup_data, size_t startup_data_len)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"%s\".", "max_wal_size")));
+						 errhint("Consider increasing the configuration parameter \"%s\".",
+								 "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index fa5988c..59aa537 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1010,7 +1010,8 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("\"synchronous_standby_names\" parser failed");
+				GUC_check_errdetail("\"%s\" parser failed",
+									"synchronous_standby_names");
 			return false;
 		}
 
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index e32718e..1afafd3 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3947,7 +3947,8 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported on this platform.");
+		GUC_check_errdetail("\"%s\" is not supported on this platform.",
+						   "debug_io_direct");
 		result = false;
 	}
 	flags = 0;
@@ -3994,14 +3995,16 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "XLOG_BLCKSZ");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "BLCKSZ");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index b455b78..b4c0486 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1678,8 +1678,10 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
-				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
+				 errdetail("\"%s\" is set to \"%s\".",
+						   "default_transaction_isolation", "serializable"),
+				 errhint("You can use \"%s\" to change the default.",
+						"SET default_transaction_isolation = 'repeatable read'")));
 
 	/*
 	 * A special optimization is available for SERIALIZABLE READ ONLY
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 8bc6bea..567a4b8 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3591,7 +3591,8 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("\"%s\" must not exceed %ldkB.",
+							"max_stack_depth",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3616,7 +3617,8 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on this platform.",
+							"client_connection_check_interval");
 		return false;
 	}
 	return true;
@@ -3637,7 +3639,8 @@ check_stage_log_stats(bool *newval, void **extra, GucSource source)
 {
 	if (*newval && log_statement_stats)
 	{
-		GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
+		GUC_check_errdetail("Cannot enable parameter when \"%s\" is true.",
+							"log_statement_stats");
 		return false;
 	}
 	return true;
@@ -3652,9 +3655,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable \"%s\" when \"%s\", \"%s\", or \"%s\" is true.",
+							"log_statement_stats",
+							"log_parser_stats", "log_planner_stats", "log_executor_stats");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 092004d..5248766 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -358,8 +358,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FUNC_MAX_ARGS = %d, library has %d."),
-						 magic_data.funcmaxargs,
+						 _("Server has %s = %d, library has %d."),
+						 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
 						 module_magic_data->funcmaxargs);
 	}
 	if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
@@ -367,8 +367,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has INDEX_MAX_KEYS = %d, library has %d."),
-						 magic_data.indexmaxkeys,
+						 _("Server has %s = %d, library has %d."),
+						 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
 						 module_magic_data->indexmaxkeys);
 	}
 	if (module_magic_data->namedatalen != magic_data.namedatalen)
@@ -376,8 +376,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has NAMEDATALEN = %d, library has %d."),
-						 magic_data.namedatalen,
+						 _("Server has %s = %d, library has %d."),
+						 "NAMEDATALEN", magic_data.namedatalen,
 						 module_magic_data->namedatalen);
 	}
 	if (module_magic_data->float8byval != magic_data.float8byval)
@@ -385,8 +385,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FLOAT8PASSBYVAL = %s, library has %s."),
-						 magic_data.float8byval ? "true" : "false",
+						 _("Server has %s = %s, library has %s."),
+						 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
 						 module_magic_data->float8byval ? "true" : "false");
 	}
 
-- 
1.8.3.1

v9-0006-GUC-names-fix-case-intervalstyle.patchapplication/octet-stream; name=v9-0006-GUC-names-fix-case-intervalstyle.patchDownload
From be9b2c816a2745284175a0b4513d6d083cb9d6c4 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 16:24:03 +1000
Subject: [PATCH v9] GUC names fix case - intervalstyle

---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 13527fc..a68d3c5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3278,7 +3278,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 455b6d6..b5d94eb 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761..98d8ae4 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,7 +2,10 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
 -- SET to some nondefault value
+
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
 SHOW vacuum_cost_delay;
-- 
1.8.3.1

v9-0007-GUC-names-fix-case-datestyle.patchapplication/octet-stream; name=v9-0007-GUC-names-fix-case-datestyle.patchDownload
From 02b2fcee4f35e820de11a245548db8858207b313 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 16:25:17 +1000
Subject: [PATCH v9] GUC names fix case - datestyle

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 6202c5e..7a2c37c 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 7abdc62..600b591 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4107,7 +4107,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different \"DateStyle\" setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..e936f66 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index 241713c..13603f6 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

#61Peter Smith
smithpb2250@gmail.com
In reply to: Peter Smith (#60)
7 attachment(s)
Re: GUC names in messages

Hi.

The cfbot was reporting my patches needed to be rebased.

Here is the rebased patch set v10*. Everything is the same as before
except now there are only 7 patches instead of 8. The previous v9-0001
("bool") patch no longer exists because those changes are now already
present in HEAD.

I hope these might be pushed soon to avoid further rebasing.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v10-0001-Add-quotes-for-GUCs-int.patchapplication/octet-stream; name=v10-0001-Add-quotes-for-GUCs-int.patchDownload
From 224090ed4f8d313b7e790d3320d95bb66d59e695 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 3 Sep 2024 08:45:09 +1000
Subject: [PATCH v10] Add quotes for GUCs - int

---
 src/backend/postmaster/bgworker.c          | 2 +-
 src/backend/postmaster/checkpointer.c      | 2 +-
 src/backend/replication/logical/launcher.c | 2 +-
 src/backend/storage/file/fd.c              | 2 +-
 src/backend/utils/misc/guc_tables.c        | 8 ++++----
 src/include/libpq/libpq-be-fe-helpers.h    | 4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index b83967c..07bc551 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -257,7 +257,7 @@ BackgroundWorkerStateChange(bool allow_new_workers)
 	if (max_worker_processes != BackgroundWorkerData->total_slots)
 	{
 		ereport(LOG,
-				(errmsg("inconsistent background worker state (max_worker_processes=%d, total_slots=%d)",
+				(errmsg("inconsistent background worker state (\"max_worker_processes\"=%d, total slots=%d)",
 						max_worker_processes,
 						BackgroundWorkerData->total_slots)));
 		return;
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 199f008..eeb73c8 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -663,7 +663,7 @@ CheckArchiveTimeout(void)
 			 * assume nothing happened.
 			 */
 			if (XLogSegmentOffset(switchpoint, wal_segment_size) != 0)
-				elog(DEBUG1, "write-ahead log switch forced (archive_timeout=%d)",
+				elog(DEBUG1, "write-ahead log switch forced (\"archive_timeout\"=%d)",
 					 XLogArchiveTimeout);
 		}
 
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index c566d50..3df5ac5a 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -337,7 +337,7 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
 	if (max_replication_slots == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("cannot start logical replication workers when max_replication_slots = 0")));
+				 errmsg("cannot start logical replication workers when \"max_replication_slots\" = 0")));
 
 	/*
 	 * We need to do the modification of the shared memory under lock so that
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 368cc94..fbe9e57 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2254,7 +2254,7 @@ FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset,
 			if (newTotal > (uint64) temp_file_limit * (uint64) 1024)
 				ereport(ERROR,
 						(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-						 errmsg("temporary file size exceeds temp_file_limit (%dkB)",
+						 errmsg("temporary file size exceeds \"temp_file_limit\" (%dkB)",
 								temp_file_limit)));
 		}
 	}
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 521ec55..a414828 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -2356,7 +2356,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"commit_timestamp_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the commit timestamp cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&commit_timestamp_buffers,
@@ -2411,7 +2411,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"subtransaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the subtransaction cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&subtransaction_buffers,
@@ -2422,7 +2422,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"transaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the transaction status cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&transaction_buffers,
@@ -2942,7 +2942,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS,
 			gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."),
-			gettext_noop("Specify -1 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify -1 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_XBLOCKS
 		},
 		&XLOGbuffers,
diff --git a/src/include/libpq/libpq-be-fe-helpers.h b/src/include/libpq/libpq-be-fe-helpers.h
index fe50829..46a90df 100644
--- a/src/include/libpq/libpq-be-fe-helpers.h
+++ b/src/include/libpq/libpq-be-fe-helpers.h
@@ -142,13 +142,13 @@ libpqsrv_connect_prepare(void)
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
+				 errhint("Raise the server's \"max_files_per_process\" and/or \"ulimit -n\" limits.")));
 #else
 		ereport(ERROR,
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process setting.")));
+				 errhint("Raise the server's \"max_files_per_process\" setting.")));
 #endif
 	}
 }
-- 
1.8.3.1

v10-0004-Add-quotes-for-GUCs-enum.patchapplication/octet-stream; name=v10-0004-Add-quotes-for-GUCs-enum.patchDownload
From 1817aa813b5cde2136960510e04a0428830c5e3a Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 3 Sep 2024 09:47:50 +1000
Subject: [PATCH v10] Add quotes for GUCs - enum

---
 src/backend/access/transam/xlog.c           | 2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ee0fb0e..8c9e048 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -9111,7 +9111,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("WAL level not sufficient for making an online backup"),
-				 errhint("wal_level must be set to \"replica\" or \"logical\" at server start.")));
+				 errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
 
 	/*
 	 * OK to update backup counter and session-level lock.
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 764a2d6..e804b2a 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -911,7 +911,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 
 	if (strcmp(wal_level, "logical") != 0)
 	{
-		pg_log_error("publisher requires wal_level >= \"logical\"");
+		pg_log_error("publisher requires \"wal_level\" >= \"logical\"");
 		failed = true;
 	}
 
-- 
1.8.3.1

v10-0003-Add-quotes-for-GUCs-string.patchapplication/octet-stream; name=v10-0003-Add-quotes-for-GUCs-string.patchDownload
From 29f48fba0e27a63a5645c7be2d44db40fd8ab90f Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 3 Sep 2024 09:46:24 +1000
Subject: [PATCH v10] Add quotes for GUCs - string

---
 src/backend/archive/shell_archive.c           | 2 +-
 src/backend/replication/logical/slotsync.c    | 6 +++---
 src/bin/pg_archivecleanup/pg_archivecleanup.c | 2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c   | 2 +-
 src/bin/pg_dump/pg_backup_db.c                | 2 +-
 src/bin/pg_rewind/pg_rewind.c                 | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/backend/archive/shell_archive.c b/src/backend/archive/shell_archive.c
index 506c5a3..4de7e66 100644
--- a/src/backend/archive/shell_archive.c
+++ b/src/backend/archive/shell_archive.c
@@ -48,7 +48,7 @@ shell_archive_configured(ArchiveModuleState *state)
 	if (XLogArchiveCommand[0] != '\0')
 		return true;
 
-	arch_module_check_errdetail("%s is not set.",
+	arch_module_check_errdetail("\"%s\" is not set.",
 								"archive_command");
 	return false;
 }
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 5107229..20d9653 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -962,14 +962,14 @@ validate_remote_info(WalReceiverConn *wrconn)
 
 	if (res->status != WALRCV_OK_TUPLES)
 		ereport(ERROR,
-				errmsg("could not fetch primary_slot_name \"%s\" info from the primary server: %s",
+				errmsg("could not fetch primary slot name \"%s\" info from the primary server: %s",
 					   PrimarySlotName, res->err),
-				errhint("Check if primary_slot_name is configured correctly."));
+				errhint("Check if \"primary_slot_name\" is configured correctly."));
 
 	tupslot = MakeSingleTupleTableSlot(res->tupledesc, &TTSOpsMinimalTuple);
 	if (!tuplestore_gettupleslot(res->tuplestore, true, false, tupslot))
 		elog(ERROR,
-			 "failed to fetch tuple for the primary server slot specified by primary_slot_name");
+			 "failed to fetch tuple for the primary server slot specified by \"primary_slot_name\"");
 
 	remote_in_recovery = DatumGetBool(slot_getattr(tupslot, 1, &isnull));
 	Assert(!isnull);
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 5a12438..c25348b 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -270,7 +270,7 @@ usage(void)
 			 "                              clean up\n"));
 	printf(_("  -?, --help                  show this help, then exit\n"));
 	printf(_("\n"
-			 "For use as archive_cleanup_command in postgresql.conf:\n"
+			 "For use as \"archive_cleanup_command\" in postgresql.conf:\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
 			 "e.g.\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 6b79393..764a2d6 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -523,7 +523,7 @@ connect_database(const char *conninfo, bool exit_on_error)
 	res = PQexec(conn, ALWAYS_SECURE_SEARCH_PATH_SQL);
 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		pg_log_error("could not clear search_path: %s",
+		pg_log_error("could not clear \"search_path\": %s",
 					 PQresultErrorMessage(res));
 		PQclear(res);
 		PQfinish(conn);
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index a02841c..4d1957a 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -39,7 +39,7 @@ _check_database_version(ArchiveHandle *AH)
 	remoteversion_str = PQparameterStatus(AH->connection, "server_version");
 	remoteversion = PQserverVersion(AH->connection);
 	if (remoteversion == 0 || !remoteversion_str)
-		pg_fatal("could not get server_version from libpq");
+		pg_fatal("could not get \"server_version\" from libpq");
 
 	AH->public.remoteVersionStr = pg_strdup(remoteversion_str);
 	AH->public.remoteVersion = remoteversion;
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 1027d23..960916a 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -1104,7 +1104,7 @@ getRestoreCommand(const char *argv0)
 
 	restore_command = pipe_read_line(postgres_cmd->data);
 	if (restore_command == NULL)
-		pg_fatal("could not read restore_command from target cluster");
+		pg_fatal("could not read \"restore_command\" from target cluster");
 
 	(void) pg_strip_crlf(restore_command);
 
-- 
1.8.3.1

v10-0002-Add-quotes-for-GUCs-real.patchapplication/octet-stream; name=v10-0002-Add-quotes-for-GUCs-real.patchDownload
From 552b34bf62282e9591ec20e987d93b1efb6a6968 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 3 Sep 2024 09:26:14 +1000
Subject: [PATCH v10] Add quotes for GUCs - real

---
 src/backend/utils/misc/guc_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index a414828..686309d 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -3068,7 +3068,7 @@ struct config_int ConfigureNamesInt[] =
 		{"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN,
 			gettext_noop("Sets the minimum execution time above which "
 						 "a sample of statements will be logged."
-						 " Sampling is determined by log_statement_sample_rate."),
+						 " Sampling is determined by \"log_statement_sample_rate\"."),
 			gettext_noop("Zero logs a sample of all queries. -1 turns this feature off."),
 			GUC_UNIT_MS
 		},
-- 
1.8.3.1

v10-0005-GUC-names-fix-case-intervalstyle.patchapplication/octet-stream; name=v10-0005-GUC-names-fix-case-intervalstyle.patchDownload
From 06ef4e6a1366a81b7bd78cc1dc610ae9822f9c20 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 3 Sep 2024 10:31:21 +1000
Subject: [PATCH v10] GUC names - fix case intervalstyle

---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 13527fc..a68d3c5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3278,7 +3278,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 455b6d6..b5d94eb 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761..98d8ae4 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,7 +2,10 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
 -- SET to some nondefault value
+
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
 SHOW vacuum_cost_delay;
-- 
1.8.3.1

v10-0006-GUC-names-fix-case-datestyle.patchapplication/octet-stream; name=v10-0006-GUC-names-fix-case-datestyle.patchDownload
From e267a0e0aae8a33d110a9e56fc2375b131064ef4 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 3 Sep 2024 10:32:53 +1000
Subject: [PATCH v10] GUC names - fix case datestyle

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 136c584..7b3ffe8 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 7abdc62..600b591 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4107,7 +4107,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different \"DateStyle\" setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..e936f66 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index 241713c..13603f6 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

v10-0007-GUC-names-make-common-translatable-messages.patchapplication/octet-stream; name=v10-0007-GUC-names-make-common-translatable-messages.patchDownload
From 28f6c54e637cf23365455cec398f01bf4fa8be96 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 3 Sep 2024 10:41:46 +1000
Subject: [PATCH v10] GUC names - make common translatable messages

---
 src/backend/access/transam/xlog.c         | 78 +++++++++++++++++++------------
 src/backend/access/transam/xlogrecovery.c |  2 +-
 src/backend/commands/variable.c           | 11 +++--
 src/backend/port/sysv_shmem.c             |  3 +-
 src/backend/postmaster/checkpointer.c     |  3 +-
 src/backend/replication/syncrep.c         |  3 +-
 src/backend/storage/file/fd.c             |  9 ++--
 src/backend/storage/lmgr/predicate.c      |  6 ++-
 src/backend/tcop/postgres.c               | 15 +++---
 src/backend/utils/fmgr/dfmgr.c            | 16 +++----
 10 files changed, 90 insertions(+), 56 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 8c9e048..8ccec20 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4395,17 +4395,21 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-						   " but the server was compiled with CATALOG_VERSION_NO %d.",
-						   ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "CATALOG_VERSION_NO", ControlFile->catalog_version_no,
+						   "CATALOG_VERSION_NO", CATALOG_VERSION_NO),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with MAXALIGN %d,"
-						   " but the server was compiled with MAXALIGN %d.",
-						   ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "MAXALIGN", ControlFile->maxAlign,
+						   "MAXALIGN", MAXIMUM_ALIGNOF),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
 		ereport(FATAL,
@@ -4417,57 +4421,71 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with BLCKSZ %d,"
-						   " but the server was compiled with BLCKSZ %d.",
-						   ControlFile->blcksz, BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "BLCKSZ", ControlFile->blcksz,
+						   "BLCKSZ", BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->relseg_size != RELSEG_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with RELSEG_SIZE %d,"
-						   " but the server was compiled with RELSEG_SIZE %d.",
-						   ControlFile->relseg_size, RELSEG_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "RELSEG_SIZE", ControlFile->relseg_size,
+						   "RELSEG_SIZE", RELSEG_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->xlog_blcksz != XLOG_BLCKSZ)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with XLOG_BLCKSZ %d,"
-						   " but the server was compiled with XLOG_BLCKSZ %d.",
-						   ControlFile->xlog_blcksz, XLOG_BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "XLOG_BLCKSZ", ControlFile->xlog_blcksz,
+						   "XLOG_BLCKSZ", XLOG_BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->nameDataLen != NAMEDATALEN)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with NAMEDATALEN %d,"
-						   " but the server was compiled with NAMEDATALEN %d.",
-						   ControlFile->nameDataLen, NAMEDATALEN),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "NAMEDATALEN", ControlFile->nameDataLen,
+						   "NAMEDATALEN", NAMEDATALEN),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
-						   " but the server was compiled with INDEX_MAX_KEYS %d.",
-						   ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "INDEX_MAX_KEYS", ControlFile->indexMaxKeys,
+						   "INDEX_MAX_KEYS", INDEX_MAX_KEYS),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
-						   " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
-						   ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "TOAST_MAX_CHUNK_SIZE", ControlFile->toast_max_chunk_size,
+						   "TOAST_MAX_CHUNK_SIZE", (int) TOAST_MAX_CHUNK_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->loblksize != LOBLKSIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with LOBLKSIZE %d,"
-						   " but the server was compiled with LOBLKSIZE %d.",
-						   ControlFile->loblksize, (int) LOBLKSIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "LOBLKSIZE", ControlFile->loblksize,
+						   "LOBLKSIZE", (int) LOBLKSIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef USE_FLOAT8_BYVAL
@@ -4505,11 +4523,13 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "min_wal_size", "wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "max_wal_size", "wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index ad817fb..36e3131 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -4794,7 +4794,7 @@ check_recovery_target(char **newval, void **extra, GucSource source)
 {
 	if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("The only allowed value is \"immediate\".");
+		GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");
 		return false;
 	}
 	return true;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 7b3ffe8..3aec2bf 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"%s\" specifications.", "DateStyle");
 		return false;
 	}
 
@@ -745,7 +745,8 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change \"%s\" now.",
+								"client_encoding");
 		}
 		return false;
 	}
@@ -1212,7 +1213,8 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"effective_io_concurrency\" must be set to 0 on platforms that lack support for issuing read-ahead advice.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
+							"effective_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1225,7 +1227,8 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"maintenance_io_concurrency\" must be set to 0 on platforms that lack support for issuing read-ahead advice.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
+							"maintenance_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 362a37d..eb2455b 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -581,7 +581,8 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be 0 on this platform.",
+							"huge_page_size");
 		return false;
 	}
 #endif
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index eeb73c8..e3db617 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -442,7 +442,8 @@ CheckpointerMain(char *startup_data, size_t startup_data_len)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"%s\".", "max_wal_size")));
+						 errhint("Consider increasing the configuration parameter \"%s\".",
+								 "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index fa5988c..59aa537 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1010,7 +1010,8 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("\"synchronous_standby_names\" parser failed");
+				GUC_check_errdetail("\"%s\" parser failed",
+									"synchronous_standby_names");
 			return false;
 		}
 
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index fbe9e57..3123b16 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3970,7 +3970,8 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported on this platform.");
+		GUC_check_errdetail("\"%s\" is not supported on this platform.",
+						   "debug_io_direct");
 		result = false;
 	}
 	flags = 0;
@@ -4017,14 +4018,16 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "XLOG_BLCKSZ");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "BLCKSZ");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index e24a0f2..366bdb6 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1678,8 +1678,10 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
-				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
+				 errdetail("\"%s\" is set to \"%s\".",
+						   "default_transaction_isolation", "serializable"),
+				 errhint("You can use \"%s\" to change the default.",
+						"SET default_transaction_isolation = 'repeatable read'")));
 
 	/*
 	 * A special optimization is available for SERIALIZABLE READ ONLY
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 8bc6bea..567a4b8 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3591,7 +3591,8 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("\"%s\" must not exceed %ldkB.",
+							"max_stack_depth",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3616,7 +3617,8 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on this platform.",
+							"client_connection_check_interval");
 		return false;
 	}
 	return true;
@@ -3637,7 +3639,8 @@ check_stage_log_stats(bool *newval, void **extra, GucSource source)
 {
 	if (*newval && log_statement_stats)
 	{
-		GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
+		GUC_check_errdetail("Cannot enable parameter when \"%s\" is true.",
+							"log_statement_stats");
 		return false;
 	}
 	return true;
@@ -3652,9 +3655,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable \"%s\" when \"%s\", \"%s\", or \"%s\" is true.",
+							"log_statement_stats",
+							"log_parser_stats", "log_planner_stats", "log_executor_stats");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 092004d..5248766 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -358,8 +358,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FUNC_MAX_ARGS = %d, library has %d."),
-						 magic_data.funcmaxargs,
+						 _("Server has %s = %d, library has %d."),
+						 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
 						 module_magic_data->funcmaxargs);
 	}
 	if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
@@ -367,8 +367,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has INDEX_MAX_KEYS = %d, library has %d."),
-						 magic_data.indexmaxkeys,
+						 _("Server has %s = %d, library has %d."),
+						 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
 						 module_magic_data->indexmaxkeys);
 	}
 	if (module_magic_data->namedatalen != magic_data.namedatalen)
@@ -376,8 +376,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has NAMEDATALEN = %d, library has %d."),
-						 magic_data.namedatalen,
+						 _("Server has %s = %d, library has %d."),
+						 "NAMEDATALEN", magic_data.namedatalen,
 						 module_magic_data->namedatalen);
 	}
 	if (module_magic_data->float8byval != magic_data.float8byval)
@@ -385,8 +385,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FLOAT8PASSBYVAL = %s, library has %s."),
-						 magic_data.float8byval ? "true" : "false",
+						 _("Server has %s = %s, library has %s."),
+						 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
 						 module_magic_data->float8byval ? "true" : "false");
 	}
 
-- 
1.8.3.1

#62Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#61)
Re: GUC names in messages

On Tue, Sep 03, 2024 at 12:00:19PM +1000, Peter Smith wrote:

Here is the rebased patch set v10*. Everything is the same as before
except now there are only 7 patches instead of 8. The previous v9-0001
("bool") patch no longer exists because those changes are now already
present in HEAD.

I hope these might be pushed soon to avoid further rebasing.

0001~0004 could just be merged, they're the same thing, for different
GUC types. The consensus mentioned in 17974ec25946 makes that clear.

0007 is a good thing for translators, indeed.. I'll see about doing
something here, at least.
--
Michael

#63Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#62)
4 attachment(s)
Re: GUC names in messages

On Tue, Sep 3, 2024 at 4:35 PM Michael Paquier <michael@paquier.xyz> wrote:

On Tue, Sep 03, 2024 at 12:00:19PM +1000, Peter Smith wrote:

Here is the rebased patch set v10*. Everything is the same as before
except now there are only 7 patches instead of 8. The previous v9-0001
("bool") patch no longer exists because those changes are now already
present in HEAD.

I hope these might be pushed soon to avoid further rebasing.

0001~0004 could just be merged, they're the same thing, for different
GUC types. The consensus mentioned in 17974ec25946 makes that clear.

0007 is a good thing for translators, indeed.. I'll see about doing
something here, at least.
--
Michael

Hi Michael, thanks for your interest.

I have merged the patches 0001-0004 as suggested. Please see v11 attachments.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v11-0001-Add-quotes-for-GUCs.patchapplication/octet-stream; name=v11-0001-Add-quotes-for-GUCs.patchDownload
From 8809c5f2aa66323c4f4c8f2dad505aa14550ae07 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Wed, 4 Sep 2024 09:06:31 +1000
Subject: [PATCH v11] Add quotes for GUCs

---
 src/backend/access/transam/xlog.c             |  2 +-
 src/backend/archive/shell_archive.c           |  2 +-
 src/backend/postmaster/bgworker.c             |  2 +-
 src/backend/postmaster/checkpointer.c         |  2 +-
 src/backend/replication/logical/launcher.c    |  2 +-
 src/backend/replication/logical/slotsync.c    |  6 +++---
 src/backend/storage/file/fd.c                 |  2 +-
 src/backend/utils/misc/guc_tables.c           | 10 +++++-----
 src/bin/pg_archivecleanup/pg_archivecleanup.c |  2 +-
 src/bin/pg_basebackup/pg_createsubscriber.c   |  4 ++--
 src/bin/pg_dump/pg_backup_db.c                |  2 +-
 src/bin/pg_rewind/pg_rewind.c                 |  2 +-
 src/include/libpq/libpq-be-fe-helpers.h       |  4 ++--
 13 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 5211e4e..c1def6f 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -9111,7 +9111,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
 		ereport(ERROR,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("WAL level not sufficient for making an online backup"),
-				 errhint("wal_level must be set to \"replica\" or \"logical\" at server start.")));
+				 errhint("\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
 
 	/*
 	 * OK to update backup counter and session-level lock.
diff --git a/src/backend/archive/shell_archive.c b/src/backend/archive/shell_archive.c
index 506c5a3..4de7e66 100644
--- a/src/backend/archive/shell_archive.c
+++ b/src/backend/archive/shell_archive.c
@@ -48,7 +48,7 @@ shell_archive_configured(ArchiveModuleState *state)
 	if (XLogArchiveCommand[0] != '\0')
 		return true;
 
-	arch_module_check_errdetail("%s is not set.",
+	arch_module_check_errdetail("\"%s\" is not set.",
 								"archive_command");
 	return false;
 }
diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c
index b83967c..07bc551 100644
--- a/src/backend/postmaster/bgworker.c
+++ b/src/backend/postmaster/bgworker.c
@@ -257,7 +257,7 @@ BackgroundWorkerStateChange(bool allow_new_workers)
 	if (max_worker_processes != BackgroundWorkerData->total_slots)
 	{
 		ereport(LOG,
-				(errmsg("inconsistent background worker state (max_worker_processes=%d, total_slots=%d)",
+				(errmsg("inconsistent background worker state (\"max_worker_processes\"=%d, total slots=%d)",
 						max_worker_processes,
 						BackgroundWorkerData->total_slots)));
 		return;
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index 199f008..eeb73c8 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -663,7 +663,7 @@ CheckArchiveTimeout(void)
 			 * assume nothing happened.
 			 */
 			if (XLogSegmentOffset(switchpoint, wal_segment_size) != 0)
-				elog(DEBUG1, "write-ahead log switch forced (archive_timeout=%d)",
+				elog(DEBUG1, "write-ahead log switch forced (\"archive_timeout\"=%d)",
 					 XLogArchiveTimeout);
 		}
 
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index c566d50..3df5ac5a 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -337,7 +337,7 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
 	if (max_replication_slots == 0)
 		ereport(ERROR,
 				(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-				 errmsg("cannot start logical replication workers when max_replication_slots = 0")));
+				 errmsg("cannot start logical replication workers when \"max_replication_slots\" = 0")));
 
 	/*
 	 * We need to do the modification of the shared memory under lock so that
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index 33378ba..f9649ee 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -962,14 +962,14 @@ validate_remote_info(WalReceiverConn *wrconn)
 
 	if (res->status != WALRCV_OK_TUPLES)
 		ereport(ERROR,
-				errmsg("could not fetch primary_slot_name \"%s\" info from the primary server: %s",
+				errmsg("could not fetch primary slot name \"%s\" info from the primary server: %s",
 					   PrimarySlotName, res->err),
-				errhint("Check if primary_slot_name is configured correctly."));
+				errhint("Check if \"primary_slot_name\" is configured correctly."));
 
 	tupslot = MakeSingleTupleTableSlot(res->tupledesc, &TTSOpsMinimalTuple);
 	if (!tuplestore_gettupleslot(res->tuplestore, true, false, tupslot))
 		elog(ERROR,
-			 "failed to fetch tuple for the primary server slot specified by primary_slot_name");
+			 "failed to fetch tuple for the primary server slot specified by \"primary_slot_name\"");
 
 	remote_in_recovery = DatumGetBool(slot_getattr(tupslot, 1, &isnull));
 	Assert(!isnull);
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index d5204b1..8df0e2f 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2254,7 +2254,7 @@ FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset,
 			if (newTotal > (uint64) temp_file_limit * (uint64) 1024)
 				ereport(ERROR,
 						(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-						 errmsg("temporary file size exceeds temp_file_limit (%dkB)",
+						 errmsg("temporary file size exceeds \"temp_file_limit\" (%dkB)",
 								temp_file_limit)));
 		}
 	}
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 521ec55..686309d 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -2356,7 +2356,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"commit_timestamp_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the commit timestamp cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&commit_timestamp_buffers,
@@ -2411,7 +2411,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"subtransaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the subtransaction cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&subtransaction_buffers,
@@ -2422,7 +2422,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"transaction_buffers", PGC_POSTMASTER, RESOURCES_MEM,
 			gettext_noop("Sets the size of the dedicated buffer pool used for the transaction status cache."),
-			gettext_noop("Specify 0 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify 0 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_BLOCKS
 		},
 		&transaction_buffers,
@@ -2942,7 +2942,7 @@ struct config_int ConfigureNamesInt[] =
 	{
 		{"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS,
 			gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."),
-			gettext_noop("Specify -1 to have this value determined as a fraction of shared_buffers."),
+			gettext_noop("Specify -1 to have this value determined as a fraction of \"shared_buffers\"."),
 			GUC_UNIT_XBLOCKS
 		},
 		&XLOGbuffers,
@@ -3068,7 +3068,7 @@ struct config_int ConfigureNamesInt[] =
 		{"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN,
 			gettext_noop("Sets the minimum execution time above which "
 						 "a sample of statements will be logged."
-						 " Sampling is determined by log_statement_sample_rate."),
+						 " Sampling is determined by \"log_statement_sample_rate\"."),
 			gettext_noop("Zero logs a sample of all queries. -1 turns this feature off."),
 			GUC_UNIT_MS
 		},
diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c
index 5a12438..c25348b 100644
--- a/src/bin/pg_archivecleanup/pg_archivecleanup.c
+++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c
@@ -270,7 +270,7 @@ usage(void)
 			 "                              clean up\n"));
 	printf(_("  -?, --help                  show this help, then exit\n"));
 	printf(_("\n"
-			 "For use as archive_cleanup_command in postgresql.conf:\n"
+			 "For use as \"archive_cleanup_command\" in postgresql.conf:\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
 			 "e.g.\n"
 			 "  archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 6b79393..e804b2a 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -523,7 +523,7 @@ connect_database(const char *conninfo, bool exit_on_error)
 	res = PQexec(conn, ALWAYS_SECURE_SEARCH_PATH_SQL);
 	if (PQresultStatus(res) != PGRES_TUPLES_OK)
 	{
-		pg_log_error("could not clear search_path: %s",
+		pg_log_error("could not clear \"search_path\": %s",
 					 PQresultErrorMessage(res));
 		PQclear(res);
 		PQfinish(conn);
@@ -911,7 +911,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo)
 
 	if (strcmp(wal_level, "logical") != 0)
 	{
-		pg_log_error("publisher requires wal_level >= \"logical\"");
+		pg_log_error("publisher requires \"wal_level\" >= \"logical\"");
 		failed = true;
 	}
 
diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c
index a02841c..4d1957a 100644
--- a/src/bin/pg_dump/pg_backup_db.c
+++ b/src/bin/pg_dump/pg_backup_db.c
@@ -39,7 +39,7 @@ _check_database_version(ArchiveHandle *AH)
 	remoteversion_str = PQparameterStatus(AH->connection, "server_version");
 	remoteversion = PQserverVersion(AH->connection);
 	if (remoteversion == 0 || !remoteversion_str)
-		pg_fatal("could not get server_version from libpq");
+		pg_fatal("could not get \"server_version\" from libpq");
 
 	AH->public.remoteVersionStr = pg_strdup(remoteversion_str);
 	AH->public.remoteVersion = remoteversion;
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 1027d23..960916a 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -1104,7 +1104,7 @@ getRestoreCommand(const char *argv0)
 
 	restore_command = pipe_read_line(postgres_cmd->data);
 	if (restore_command == NULL)
-		pg_fatal("could not read restore_command from target cluster");
+		pg_fatal("could not read \"restore_command\" from target cluster");
 
 	(void) pg_strip_crlf(restore_command);
 
diff --git a/src/include/libpq/libpq-be-fe-helpers.h b/src/include/libpq/libpq-be-fe-helpers.h
index fe50829..46a90df 100644
--- a/src/include/libpq/libpq-be-fe-helpers.h
+++ b/src/include/libpq/libpq-be-fe-helpers.h
@@ -142,13 +142,13 @@ libpqsrv_connect_prepare(void)
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process and/or \"ulimit -n\" limits.")));
+				 errhint("Raise the server's \"max_files_per_process\" and/or \"ulimit -n\" limits.")));
 #else
 		ereport(ERROR,
 				(errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION),
 				 errmsg("could not establish connection"),
 				 errdetail("There are too many open files on the local server."),
-				 errhint("Raise the server's max_files_per_process setting.")));
+				 errhint("Raise the server's \"max_files_per_process\" setting.")));
 #endif
 	}
 }
-- 
1.8.3.1

v11-0003-GUC-names-fix-case-datestyle.patchapplication/octet-stream; name=v11-0003-GUC-names-fix-case-datestyle.patchDownload
From 563d641354b64aca12e74b05990bd4ff3d21d6dd Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Wed, 4 Sep 2024 09:07:58 +1000
Subject: [PATCH v11] GUC names - fix case datestyle

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 136c584..7b3ffe8 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 7abdc62..600b591 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4107,7 +4107,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different \"DateStyle\" setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..e936f66 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index 241713c..13603f6 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

v11-0004-GUC-names-make-common-translatable-messages.patchapplication/octet-stream; name=v11-0004-GUC-names-make-common-translatable-messages.patchDownload
From 284ce83b550936d998f6e00552e292e58bf6469c Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Wed, 4 Sep 2024 09:08:49 +1000
Subject: [PATCH v11] GUC names - make common translatable messages

---
 src/backend/access/transam/xlog.c         | 78 +++++++++++++++++++------------
 src/backend/access/transam/xlogrecovery.c |  2 +-
 src/backend/commands/variable.c           | 11 +++--
 src/backend/port/sysv_shmem.c             |  3 +-
 src/backend/postmaster/checkpointer.c     |  3 +-
 src/backend/replication/syncrep.c         |  3 +-
 src/backend/storage/file/fd.c             |  9 ++--
 src/backend/storage/lmgr/predicate.c      |  6 ++-
 src/backend/tcop/postgres.c               | 15 +++---
 src/backend/utils/fmgr/dfmgr.c            | 16 +++----
 10 files changed, 90 insertions(+), 56 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c1def6f..5076e6e 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -4395,17 +4395,21 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d,"
-						   " but the server was compiled with CATALOG_VERSION_NO %d.",
-						   ControlFile->catalog_version_no, CATALOG_VERSION_NO),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "CATALOG_VERSION_NO", ControlFile->catalog_version_no,
+						   "CATALOG_VERSION_NO", CATALOG_VERSION_NO),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->maxAlign != MAXIMUM_ALIGNOF)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with MAXALIGN %d,"
-						   " but the server was compiled with MAXALIGN %d.",
-						   ControlFile->maxAlign, MAXIMUM_ALIGNOF),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "MAXALIGN", ControlFile->maxAlign,
+						   "MAXALIGN", MAXIMUM_ALIGNOF),
 				 errhint("It looks like you need to initdb.")));
 	if (ControlFile->floatFormat != FLOATFORMAT_VALUE)
 		ereport(FATAL,
@@ -4417,57 +4421,71 @@ ReadControlFile(void)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with BLCKSZ %d,"
-						   " but the server was compiled with BLCKSZ %d.",
-						   ControlFile->blcksz, BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "BLCKSZ", ControlFile->blcksz,
+						   "BLCKSZ", BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->relseg_size != RELSEG_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with RELSEG_SIZE %d,"
-						   " but the server was compiled with RELSEG_SIZE %d.",
-						   ControlFile->relseg_size, RELSEG_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "RELSEG_SIZE", ControlFile->relseg_size,
+						   "RELSEG_SIZE", RELSEG_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->xlog_blcksz != XLOG_BLCKSZ)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with XLOG_BLCKSZ %d,"
-						   " but the server was compiled with XLOG_BLCKSZ %d.",
-						   ControlFile->xlog_blcksz, XLOG_BLCKSZ),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "XLOG_BLCKSZ", ControlFile->xlog_blcksz,
+						   "XLOG_BLCKSZ", XLOG_BLCKSZ),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->nameDataLen != NAMEDATALEN)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with NAMEDATALEN %d,"
-						   " but the server was compiled with NAMEDATALEN %d.",
-						   ControlFile->nameDataLen, NAMEDATALEN),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "NAMEDATALEN", ControlFile->nameDataLen,
+						   "NAMEDATALEN", NAMEDATALEN),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d,"
-						   " but the server was compiled with INDEX_MAX_KEYS %d.",
-						   ControlFile->indexMaxKeys, INDEX_MAX_KEYS),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "INDEX_MAX_KEYS", ControlFile->indexMaxKeys,
+						   "INDEX_MAX_KEYS", INDEX_MAX_KEYS),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
-						   " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
-						   ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "TOAST_MAX_CHUNK_SIZE", ControlFile->toast_max_chunk_size,
+						   "TOAST_MAX_CHUNK_SIZE", (int) TOAST_MAX_CHUNK_SIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 	if (ControlFile->loblksize != LOBLKSIZE)
 		ereport(FATAL,
 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
 				 errmsg("database files are incompatible with server"),
-				 errdetail("The database cluster was initialized with LOBLKSIZE %d,"
-						   " but the server was compiled with LOBLKSIZE %d.",
-						   ControlFile->loblksize, (int) LOBLKSIZE),
+				 /*- translator: %s is a variable name and %d is its value */
+				 errdetail("The database cluster was initialized with %s %d,"
+						   " but the server was compiled with %s %d.",
+						   "LOBLKSIZE", ControlFile->loblksize,
+						   "LOBLKSIZE", (int) LOBLKSIZE),
 				 errhint("It looks like you need to recompile or initdb.")));
 
 #ifdef USE_FLOAT8_BYVAL
@@ -4505,11 +4523,13 @@ ReadControlFile(void)
 	/* check and update variables dependent on wal_segment_size */
 	if (ConvertToXSegs(min_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"min_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "min_wal_size", "wal_segment_size")));
 
 	if (ConvertToXSegs(max_wal_size_mb, wal_segment_size) < 2)
 		ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("\"max_wal_size\" must be at least twice \"wal_segment_size\"")));
+						errmsg("\"%s\" must be at least twice \"%s\"",
+							   "max_wal_size", "wal_segment_size")));
 
 	UsableBytesInSegment =
 		(wal_segment_size / XLOG_BLCKSZ * UsableBytesInPage) -
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 178491f..284a3ec 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -4795,7 +4795,7 @@ check_recovery_target(char **newval, void **extra, GucSource source)
 {
 	if (strcmp(*newval, "immediate") != 0 && strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("The only allowed value is \"immediate\".");
+		GUC_check_errdetail("The only allowed value is \"%s\".", "immediate");
 		return false;
 	}
 	return true;
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 7b3ffe8..3aec2bf 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"%s\" specifications.", "DateStyle");
 		return false;
 	}
 
@@ -745,7 +745,8 @@ check_client_encoding(char **newval, void **extra, GucSource source)
 		else
 		{
 			/* Provide a useful complaint */
-			GUC_check_errdetail("Cannot change \"client_encoding\" now.");
+			GUC_check_errdetail("Cannot change \"%s\" now.",
+								"client_encoding");
 		}
 		return false;
 	}
@@ -1212,7 +1213,8 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"effective_io_concurrency\" must be set to 0 on platforms that lack support for issuing read-ahead advice.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
+							"effective_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
@@ -1225,7 +1227,8 @@ check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
 #ifndef USE_PREFETCH
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"maintenance_io_concurrency\" must be set to 0 on platforms that lack support for issuing read-ahead advice.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
+							"maintenance_io_concurrency");
 		return false;
 	}
 #endif							/* USE_PREFETCH */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 362a37d..eb2455b 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -581,7 +581,8 @@ check_huge_page_size(int *newval, void **extra, GucSource source)
 	/* Recent enough Linux only, for now.  See GetHugePageSize(). */
 	if (*newval != 0)
 	{
-		GUC_check_errdetail("\"huge_page_size\" must be 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be 0 on this platform.",
+							"huge_page_size");
 		return false;
 	}
 #endif
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index eeb73c8..e3db617 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -442,7 +442,8 @@ CheckpointerMain(char *startup_data, size_t startup_data_len)
 									   "checkpoints are occurring too frequently (%d seconds apart)",
 									   elapsed_secs,
 									   elapsed_secs),
-						 errhint("Consider increasing the configuration parameter \"%s\".", "max_wal_size")));
+						 errhint("Consider increasing the configuration parameter \"%s\".",
+								 "max_wal_size")));
 
 			/*
 			 * Initialize checkpointer-private variables used during
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index fa5988c..59aa537 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1010,7 +1010,8 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
 			if (syncrep_parse_error_msg)
 				GUC_check_errdetail("%s", syncrep_parse_error_msg);
 			else
-				GUC_check_errdetail("\"synchronous_standby_names\" parser failed");
+				GUC_check_errdetail("\"%s\" parser failed",
+									"synchronous_standby_names");
 			return false;
 		}
 
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 8df0e2f..220a4ec 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3971,7 +3971,8 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
 	if (strcmp(*newval, "") != 0)
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported on this platform.");
+		GUC_check_errdetail("\"%s\" is not supported on this platform.",
+						   "debug_io_direct");
 		result = false;
 	}
 	flags = 0;
@@ -4018,14 +4019,16 @@ check_debug_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for WAL because XLOG_BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "XLOG_BLCKSZ");
 		result = false;
 	}
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
 	if (result && (flags & IO_DIRECT_DATA))
 	{
-		GUC_check_errdetail("\"debug_io_direct\" is not supported for data because BLCKSZ is too small");
+		GUC_check_errdetail("\"%s\" is not supported for WAL because %s is too small",
+						   "debug_io_direct", "BLCKSZ");
 		result = false;
 	}
 #endif
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index e24a0f2..366bdb6 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -1678,8 +1678,10 @@ GetSerializableTransactionSnapshot(Snapshot snapshot)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot use serializable mode in a hot standby"),
-				 errdetail("\"default_transaction_isolation\" is set to \"serializable\"."),
-				 errhint("You can use \"SET default_transaction_isolation = 'repeatable read'\" to change the default.")));
+				 errdetail("\"%s\" is set to \"%s\".",
+						   "default_transaction_isolation", "serializable"),
+				 errhint("You can use \"%s\" to change the default.",
+						"SET default_transaction_isolation = 'repeatable read'")));
 
 	/*
 	 * A special optimization is available for SERIALIZABLE READ ONLY
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 8bc6bea..567a4b8 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3591,7 +3591,8 @@ check_max_stack_depth(int *newval, void **extra, GucSource source)
 
 	if (stack_rlimit > 0 && newval_bytes > stack_rlimit - STACK_DEPTH_SLOP)
 	{
-		GUC_check_errdetail("\"max_stack_depth\" must not exceed %ldkB.",
+		GUC_check_errdetail("\"%s\" must not exceed %ldkB.",
+							"max_stack_depth",
 							(stack_rlimit - STACK_DEPTH_SLOP) / 1024L);
 		GUC_check_errhint("Increase the platform's stack depth limit via \"ulimit -s\" or local equivalent.");
 		return false;
@@ -3616,7 +3617,8 @@ check_client_connection_check_interval(int *newval, void **extra, GucSource sour
 {
 	if (!WaitEventSetCanReportClosed() && *newval != 0)
 	{
-		GUC_check_errdetail("\"client_connection_check_interval\" must be set to 0 on this platform.");
+		GUC_check_errdetail("\"%s\" must be set to 0 on this platform.",
+							"client_connection_check_interval");
 		return false;
 	}
 	return true;
@@ -3637,7 +3639,8 @@ check_stage_log_stats(bool *newval, void **extra, GucSource source)
 {
 	if (*newval && log_statement_stats)
 	{
-		GUC_check_errdetail("Cannot enable parameter when \"log_statement_stats\" is true.");
+		GUC_check_errdetail("Cannot enable parameter when \"%s\" is true.",
+							"log_statement_stats");
 		return false;
 	}
 	return true;
@@ -3652,9 +3655,9 @@ check_log_stats(bool *newval, void **extra, GucSource source)
 	if (*newval &&
 		(log_parser_stats || log_planner_stats || log_executor_stats))
 	{
-		GUC_check_errdetail("Cannot enable \"log_statement_stats\" when "
-							"\"log_parser_stats\", \"log_planner_stats\", "
-							"or \"log_executor_stats\" is true.");
+		GUC_check_errdetail("Cannot enable \"%s\" when \"%s\", \"%s\", or \"%s\" is true.",
+							"log_statement_stats",
+							"log_parser_stats", "log_planner_stats", "log_executor_stats");
 		return false;
 	}
 	return true;
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 092004d..5248766 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -358,8 +358,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FUNC_MAX_ARGS = %d, library has %d."),
-						 magic_data.funcmaxargs,
+						 _("Server has %s = %d, library has %d."),
+						 "FUNC_MAX_ARGS", magic_data.funcmaxargs,
 						 module_magic_data->funcmaxargs);
 	}
 	if (module_magic_data->indexmaxkeys != magic_data.indexmaxkeys)
@@ -367,8 +367,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has INDEX_MAX_KEYS = %d, library has %d."),
-						 magic_data.indexmaxkeys,
+						 _("Server has %s = %d, library has %d."),
+						 "INDEX_MAX_KEYS", magic_data.indexmaxkeys,
 						 module_magic_data->indexmaxkeys);
 	}
 	if (module_magic_data->namedatalen != magic_data.namedatalen)
@@ -376,8 +376,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has NAMEDATALEN = %d, library has %d."),
-						 magic_data.namedatalen,
+						 _("Server has %s = %d, library has %d."),
+						 "NAMEDATALEN", magic_data.namedatalen,
 						 module_magic_data->namedatalen);
 	}
 	if (module_magic_data->float8byval != magic_data.float8byval)
@@ -385,8 +385,8 @@ incompatible_module_error(const char *libname,
 		if (details.len)
 			appendStringInfoChar(&details, '\n');
 		appendStringInfo(&details,
-						 _("Server has FLOAT8PASSBYVAL = %s, library has %s."),
-						 magic_data.float8byval ? "true" : "false",
+						 _("Server has %s = %s, library has %s."),
+						 "FLOAT8PASSBYVAL", magic_data.float8byval ? "true" : "false",
 						 module_magic_data->float8byval ? "true" : "false");
 	}
 
-- 
1.8.3.1

v11-0002-GUC-names-fix-case-intervalstyle.patchapplication/octet-stream; name=v11-0002-GUC-names-fix-case-intervalstyle.patchDownload
From d3a0fdf2b3cec6cd56c8afed2bf051d669996b51 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Wed, 4 Sep 2024 09:07:17 +1000
Subject: [PATCH v11] GUC names - fix case intervalstyle

---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 13527fc..a68d3c5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3278,7 +3278,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 455b6d6..b5d94eb 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761..98d8ae4 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,7 +2,10 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
 -- SET to some nondefault value
+
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
 SHOW vacuum_cost_delay;
-- 
1.8.3.1

#64Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#63)
Re: GUC names in messages

On Wed, Sep 04, 2024 at 09:17:15AM +1000, Peter Smith wrote:

I have merged the patches 0001-0004 as suggested. Please see v11 attachments.

Thanks.

It took me some time to go through the whole tree for more
inconsistencies.

In 0001, search_path was missing quotes in vacuumlo.c and oid2name.c.
Not the most critical tools ever, still fixed these.

CheckRequiredParameterValues() has two "wal_level=minimal". Shouldn't
separate quotes be used for the GUC name and its value to be more
consistent with the rest? There are also two "full_page_writes=off"
in xlog.c. Point mentioned at [1]/messages/by-id/2162891.1715890833@sss.pgh.pa.us -- Michael by Daniel on v6, changed as they
are on HEAD by 17974ec25946.

In 0004, there are a couple of changes where this does not represent a
gain for translators, and it was even made worse. For example
huge_page_size updated for sysv but not WIN32, leading to two
messages. The changes in postgres.c, predicate.c, syncrep.c and
variable.c don't show a gain.

The changes in dfmgr.c should have a translator note, I think, because
it becomes unclear what these messages are about.

By the way, I don't get why we use "/*- translator:" in some places
while we document to use "/* translator:" in the NLS section of the
docs. One pattern is much more used than the other, guess which one.

0001 and 0004 have been applied with these tweaks. I am still not
sure about the changes for DateStyle and IntervalStyle in 0002 and
0003. Perhaps others have an opinion that could drive to a consensus.

[1]: /messages/by-id/2162891.1715890833@sss.pgh.pa.us -- Michael
--
Michael

#65Alexander Lakhin
exclusion@gmail.com
In reply to: Peter Eisentraut (#56)
Re: GUC names in messages

Hello Peter,

[ sorry for the kind of off-topic ]

17.05.2024 14:57, Peter Eisentraut wrote:

I committed your 0001 and 0002 now, with some small fixes.

There has also been quite a bit of new code, of course, since you posted your patches, so we'll probably find a few
more things that could use adjustment.

I'd be happy to consider the rest of your patch set after beta1 and/or for PG18.

While translating messages, I've encountered a weird message, updated by
17974ec25:
    printf(_("(in \"wal_sync_method\" preference order, except fdatasync is Linux's default)\n"));

Does "except ..." make sense here or it's just a copy-and-paste from docs?:
        The default is the first method in the above list that is supported
        by the platform, except that <literal>fdatasync</literal> is the default on
        Linux and FreeBSD.

Best regards,
Alexander

#66Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#64)
2 attachment(s)
Re: GUC names in messages

On Wed, Sep 4, 2024 at 3:54 PM Michael Paquier <michael@paquier.xyz> wrote:

...

0001 and 0004 have been applied with these tweaks. I am still not
sure about the changes for DateStyle and IntervalStyle in 0002 and
0003. Perhaps others have an opinion that could drive to a consensus.

Thanks for pushing the patches 0001 and 0004.

I have rebased the two remaining patches. See v12 attached.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v12-0002-GUC-names-fix-case-datestyle.patchapplication/octet-stream; name=v12-0002-GUC-names-fix-case-datestyle.patchDownload
From 06a0b0808f07ef00269805bdbeae46065ebe1f09 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 10 Sep 2024 16:23:51 +1000
Subject: [PATCH v12] GUC-names-fix-case-datestyle

---
 src/backend/commands/variable.c        |  2 +-
 src/backend/utils/adt/datetime.c       |  2 +-
 src/test/regress/expected/date.out     | 58 +++++++++++++++++-----------------
 src/test/regress/expected/horology.out |  2 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 27ce7d3..7df2694 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -182,7 +182,7 @@ check_datestyle(char **newval, void **extra, GucSource source)
 
 	if (!ok)
 	{
-		GUC_check_errdetail("Conflicting \"datestyle\" specifications.");
+		GUC_check_errdetail("Conflicting \"DateStyle\" specifications.");
 		return false;
 	}
 
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 7abdc62..600b591 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4107,7 +4107,7 @@ DateTimeParseError(int dterr, DateTimeErrorExtra *extra,
 					(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
 					 errmsg("date/time field value out of range: \"%s\"",
 							str),
-					 errhint("Perhaps you need a different \"datestyle\" setting.")));
+					 errhint("Perhaps you need a different \"DateStyle\" setting.")));
 			break;
 		case DTERR_INTERVAL_OVERFLOW:
 			errsave(escontext,
diff --git a/src/test/regress/expected/date.out b/src/test/regress/expected/date.out
index f5949f3..e936f66 100644
--- a/src/test/regress/expected/date.out
+++ b/src/test/regress/expected/date.out
@@ -94,17 +94,17 @@ SELECT date '1/8/1999';
 ERROR:  date/time field value out of range: "1/8/1999"
 LINE 1: SELECT date '1/8/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -139,7 +139,7 @@ SELECT date 'January 8, 99 BC';
 ERROR:  date/time field value out of range: "January 8, 99 BC"
 LINE 1: SELECT date 'January 8, 99 BC';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-Jan-08';
     date    
 ------------
@@ -156,7 +156,7 @@ SELECT date '08-Jan-99';
 ERROR:  date/time field value out of range: "08-Jan-99"
 LINE 1: SELECT date '08-Jan-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-Jan-1999';
     date    
 ------------
@@ -167,7 +167,7 @@ SELECT date 'Jan-08-99';
 ERROR:  date/time field value out of range: "Jan-08-99"
 LINE 1: SELECT date 'Jan-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan-08-1999';
     date    
 ------------
@@ -198,7 +198,7 @@ SELECT date '08 Jan 99';
 ERROR:  date/time field value out of range: "08 Jan 99"
 LINE 1: SELECT date '08 Jan 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 Jan 1999';
     date    
 ------------
@@ -209,7 +209,7 @@ SELECT date 'Jan 08 99';
 ERROR:  date/time field value out of range: "Jan 08 99"
 LINE 1: SELECT date 'Jan 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date 'Jan 08 1999';
     date    
 ------------
@@ -244,22 +244,22 @@ SELECT date '08-01-99';
 ERROR:  date/time field value out of range: "08-01-99"
 LINE 1: SELECT date '08-01-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08-01-1999';
 ERROR:  date/time field value out of range: "08-01-1999"
 LINE 1: SELECT date '08-01-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-99';
 ERROR:  date/time field value out of range: "01-08-99"
 LINE 1: SELECT date '01-08-99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01-08-1999';
 ERROR:  date/time field value out of range: "01-08-1999"
 LINE 1: SELECT date '01-08-1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99-08-01';
     date    
 ------------
@@ -288,22 +288,22 @@ SELECT date '08 01 99';
 ERROR:  date/time field value out of range: "08 01 99"
 LINE 1: SELECT date '08 01 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '08 01 1999';
 ERROR:  date/time field value out of range: "08 01 1999"
 LINE 1: SELECT date '08 01 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 99';
 ERROR:  date/time field value out of range: "01 08 99"
 LINE 1: SELECT date '01 08 99';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01 08 1999';
 ERROR:  date/time field value out of range: "01 08 1999"
 LINE 1: SELECT date '01 08 1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '99 08 01';
     date    
 ------------
@@ -345,7 +345,7 @@ SELECT date '1/18/1999';
 ERROR:  date/time field value out of range: "1/18/1999"
 LINE 1: SELECT date '1/18/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '18/1/1999';
     date    
 ------------
@@ -392,7 +392,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -435,7 +435,7 @@ SELECT date '99 Jan 08';
 ERROR:  date/time field value out of range: "99 Jan 08"
 LINE 1: SELECT date '99 Jan 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 Jan 08';
     date    
 ------------
@@ -480,7 +480,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -515,7 +515,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -526,7 +526,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -561,7 +561,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
@@ -603,7 +603,7 @@ SELECT date '18/1/1999';
 ERROR:  date/time field value out of range: "18/1/1999"
 LINE 1: SELECT date '18/1/1999';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '01/02/03';
     date    
 ------------
@@ -644,7 +644,7 @@ SELECT date '99-Jan-08';
 ERROR:  date/time field value out of range: "99-Jan-08"
 LINE 1: SELECT date '99-Jan-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-Jan-08';
     date    
 ------------
@@ -731,7 +731,7 @@ SELECT date '99-01-08';
 ERROR:  date/time field value out of range: "99-01-08"
 LINE 1: SELECT date '99-01-08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-01-08';
     date    
 ------------
@@ -766,7 +766,7 @@ SELECT date '99-08-01';
 ERROR:  date/time field value out of range: "99-08-01"
 LINE 1: SELECT date '99-08-01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999-08-01';
     date    
 ------------
@@ -777,7 +777,7 @@ SELECT date '99 01 08';
 ERROR:  date/time field value out of range: "99 01 08"
 LINE 1: SELECT date '99 01 08';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 01 08';
     date    
 ------------
@@ -812,7 +812,7 @@ SELECT date '99 08 01';
 ERROR:  date/time field value out of range: "99 08 01"
 LINE 1: SELECT date '99 08 01';
                     ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 SELECT date '1999 08 01';
     date    
 ------------
diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out
index 241713c..13603f6 100644
--- a/src/test/regress/expected/horology.out
+++ b/src/test/regress/expected/horology.out
@@ -100,7 +100,7 @@ SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
 ERROR:  date/time field value out of range: "27/12/2001 04:05:06.789-08"
 LINE 1: SELECT timestamp with time zone '27/12/2001 04:05:06.789-08'...
                                         ^
-HINT:  Perhaps you need a different "datestyle" setting.
+HINT:  Perhaps you need a different "DateStyle" setting.
 set datestyle to dmy;
 SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
            timestamptz            
-- 
1.8.3.1

v12-0001-GUC-names-fix-case-intervalstyle.patchapplication/octet-stream; name=v12-0001-GUC-names-fix-case-intervalstyle.patchDownload
From ea9aac98465d29b043164ec081f1003af5f17683 Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 10 Sep 2024 16:23:17 +1000
Subject: [PATCH v12] GUC-names-fix-case-intervalstyle

---
 src/backend/utils/misc/guc.c      | 2 +-
 src/test/regress/expected/guc.out | 4 ++++
 src/test/regress/sql/guc.sql      | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 13527fc..a68d3c5 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3278,7 +3278,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 455b6d6..b5d94eb 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index dc79761..98d8ae4 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,7 +2,10 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
 -- SET to some nondefault value
+
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
 SHOW vacuum_cost_delay;
-- 
1.8.3.1

#67Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#66)
1 attachment(s)
Re: GUC names in messages

On Tue, Sep 10, 2024 at 05:11:13PM +1000, Peter Smith wrote:

I have rebased the two remaining patches. See v12 attached.

I've looked over the patch set again, and applied 0002.

0001 could be more ambitious and more consistent, like:
- The GUC name coming from the table's record is only used for
PGC_ENUM, let's use conf->gen.name across the board so as this counts
for custom GUCs.
- Once we do the first bullet point, parse_and_validate_value() can be
simplified as it does not need its "name" argument anymore.
- Once the second bullet point is simplified, going one way up
reveals more in set_config_with_handle(). I was wondering about
pg_parameter_aclcheck() for a bit until I've noticed
convert_GUC_name_for_parameter_acl() that applies a conversion with
the contents of the catalogs when checking for a parameter ACL,
similar to guc_name_compare().

One limitation is in AlterSystemSetConfigFile() where the parameter
name comes from the command and not a GUC record as the ACL check
happens before the GUC table lookup, but we could live with that.

At the end, I get the attached revised 0001. WDYT?
--
Michael

Attachments:

v13-0001-Apply-GUC-name-from-central-table-in-more-places.patchtext/x-diff; charset=us-asciiDownload
From 3b3f4a241a2d127b421a968f5fb19d555e55b91c Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Mon, 7 Oct 2024 13:17:01 +0900
Subject: [PATCH v13] Apply GUC name from central table in more places of guc.c

---
 src/backend/utils/misc/guc.c      | 65 +++++++++++++++----------------
 src/test/regress/expected/guc.out |  4 ++
 src/test/regress/sql/guc.sql      |  3 ++
 3 files changed, 39 insertions(+), 33 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 13527fc258..507a5d329a 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3115,7 +3115,6 @@ config_enum_get_options(struct config_enum *record, const char *prefix,
  * and also calls any check hook the parameter may have.
  *
  * record: GUC variable's info record
- * name: variable name (should match the record of course)
  * value: proposed value, as a string
  * source: identifies source of value (check hooks may need this)
  * elevel: level to log any error reports at
@@ -3127,7 +3126,7 @@ config_enum_get_options(struct config_enum *record, const char *prefix,
  */
 static bool
 parse_and_validate_value(struct config_generic *record,
-						 const char *name, const char *value,
+						 const char *value,
 						 GucSource source, int elevel,
 						 union config_var_val *newval, void **newextra)
 {
@@ -3142,7 +3141,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("parameter \"%s\" requires a Boolean value",
-									name)));
+									conf->gen.name)));
 					return false;
 				}
 
@@ -3162,7 +3161,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3181,7 +3180,7 @@ parse_and_validate_value(struct config_generic *record,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("%d%s%s is outside the valid range for parameter \"%s\" (%d%s%s .. %d%s%s)",
 									newval->intval, unitspace, unit,
-									name,
+									conf->gen.name,
 									conf->min, unitspace, unit,
 									conf->max, unitspace, unit)));
 					return false;
@@ -3203,7 +3202,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3222,7 +3221,7 @@ parse_and_validate_value(struct config_generic *record,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("%g%s%s is outside the valid range for parameter \"%s\" (%g%s%s .. %g%s%s)",
 									newval->realval, unitspace, unit,
-									name,
+									conf->gen.name,
 									conf->min, unitspace, unit,
 									conf->max, unitspace, unit)));
 					return false;
@@ -3278,7 +3277,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
@@ -3460,7 +3459,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 		ereport(elevel,
 				(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
 				 errmsg("parameter \"%s\" cannot be set during a parallel operation",
-						name)));
+						record->name)));
 		return 0;
 	}
 
@@ -3476,7 +3475,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+								record->name)));
 				return 0;
 			}
 			break;
@@ -3499,7 +3498,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-								name)));
+								record->name)));
 				return 0;
 			}
 			break;
@@ -3509,7 +3508,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be changed now",
-								name)));
+								record->name)));
 				return 0;
 			}
 
@@ -3529,14 +3528,14 @@ set_config_with_handle(const char *name, config_handle *handle,
 				 */
 				AclResult	aclresult;
 
-				aclresult = pg_parameter_aclcheck(name, srole, ACL_SET);
+				aclresult = pg_parameter_aclcheck(record->name, srole, ACL_SET);
 				if (aclresult != ACLCHECK_OK)
 				{
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+									record->name)));
 					return 0;
 				}
 			}
@@ -3578,7 +3577,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be set after connection start",
-								name)));
+								record->name)));
 				return 0;
 			}
 			break;
@@ -3591,14 +3590,14 @@ set_config_with_handle(const char *name, config_handle *handle,
 				 */
 				AclResult	aclresult;
 
-				aclresult = pg_parameter_aclcheck(name, srole, ACL_SET);
+				aclresult = pg_parameter_aclcheck(record->name, srole, ACL_SET);
 				if (aclresult != ACLCHECK_OK)
 				{
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+									record->name)));
 					return 0;
 				}
 			}
@@ -3637,7 +3636,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 					 errmsg("cannot set parameter \"%s\" within security-definer function",
-							name)));
+							record->name)));
 			return 0;
 		}
 		if (InSecurityRestrictedOperation())
@@ -3645,7 +3644,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 					 errmsg("cannot set parameter \"%s\" within security-restricted operation",
-							name)));
+							record->name)));
 			return 0;
 		}
 	}
@@ -3657,7 +3656,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be reset", name)));
+					 errmsg("parameter \"%s\" cannot be reset", record->name)));
 			return 0;
 		}
 		if (action == GUC_ACTION_SAVE)
@@ -3665,7 +3664,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 					 errmsg("parameter \"%s\" cannot be set locally in functions",
-							name)));
+							record->name)));
 			return 0;
 		}
 	}
@@ -3691,7 +3690,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 		if (changeVal && !makeDefault)
 		{
 			elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority",
-				 name);
+				 record->name);
 			return -1;
 		}
 		changeVal = false;
@@ -3710,7 +3709,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -3743,7 +3742,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3808,7 +3807,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -3841,7 +3840,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3906,7 +3905,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -3939,7 +3938,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4004,7 +4003,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -4063,7 +4062,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4133,7 +4132,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -4166,7 +4165,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4660,7 +4659,7 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 				union config_var_val newval;
 				void	   *newextra = NULL;
 
-				if (!parse_and_validate_value(record, name, value,
+				if (!parse_and_validate_value(record, value,
 											  PGC_S_FILE, ERROR,
 											  &newval, &newextra))
 					ereport(ERROR,
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 14edb42704..7f9e29c765 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index 2be7ab2940..f65f84a263 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,6 +2,9 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
-- 
2.45.2

#68Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#67)
1 attachment(s)
Re: GUC names in messages

On Mon, Oct 7, 2024 at 3:22 PM Michael Paquier <michael@paquier.xyz> wrote:

On Tue, Sep 10, 2024 at 05:11:13PM +1000, Peter Smith wrote:

I have rebased the two remaining patches. See v12 attached.

I've looked over the patch set again, and applied 0002.

0001 could be more ambitious and more consistent, like:
- The GUC name coming from the table's record is only used for
PGC_ENUM, let's use conf->gen.name across the board so as this counts
for custom GUCs.
- Once we do the first bullet point, parse_and_validate_value() can be
simplified as it does not need its "name" argument anymore.
- Once the second bullet point is simplified, going one way up
reveals more in set_config_with_handle(). I was wondering about
pg_parameter_aclcheck() for a bit until I've noticed
convert_GUC_name_for_parameter_acl() that applies a conversion with
the contents of the catalogs when checking for a parameter ACL,
similar to guc_name_compare().

One limitation is in AlterSystemSetConfigFile() where the parameter
name comes from the command and not a GUC record as the ACL check
happens before the GUC table lookup, but we could live with that.

At the end, I get the attached revised 0001. WDYT?

Hi Michael.

Thanks for pushing my other patch.

As for what is left, I had made just the minimal patch to fix the
known "IntervalStyle" problem, but that assumed prior knowledge of
what were the only problem names in the first place. Your way is
better -- to always use the record name where possible.

One thing I thought remains not so good is how
set_config_with_handle(name...) function does
record=find_option(name,...) but then all subsequent names are
supposed to be coming from the record->name. It feels confusing to
have that parameter 'name' still in scope after the find(), e.g., when
you should not be using that anymore. So, I tried to separate this
logic into 2 functions -- set_config_with_handle() and
set_config_with_handle_guts(). There are no name overlaps now, but I
wonder if the fix was overkill. See v14.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachments:

v14-0001-Apply-GUC-name-from-central-table-in-more-places.patchapplication/octet-stream; name=v14-0001-Apply-GUC-name-from-central-table-in-more-places.patchDownload
From 73bf4330493b300baa67f758324062f4e673dd1d Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 8 Oct 2024 18:50:51 +1100
Subject: [PATCH v14] Apply GUC name from central table in more places of guc.c

---
 src/backend/utils/misc/guc.c      | 161 ++++++++++++++++++++------------------
 src/test/regress/expected/guc.out |   4 +
 src/test/regress/sql/guc.sql      |   3 +
 3 files changed, 93 insertions(+), 75 deletions(-)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 13527fc..bcf3996 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3115,7 +3115,6 @@ config_enum_get_options(struct config_enum *record, const char *prefix,
  * and also calls any check hook the parameter may have.
  *
  * record: GUC variable's info record
- * name: variable name (should match the record of course)
  * value: proposed value, as a string
  * source: identifies source of value (check hooks may need this)
  * elevel: level to log any error reports at
@@ -3127,7 +3126,7 @@ config_enum_get_options(struct config_enum *record, const char *prefix,
  */
 static bool
 parse_and_validate_value(struct config_generic *record,
-						 const char *name, const char *value,
+						 const char *value,
 						 GucSource source, int elevel,
 						 union config_var_val *newval, void **newextra)
 {
@@ -3142,7 +3141,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("parameter \"%s\" requires a Boolean value",
-									name)));
+									conf->gen.name)));
 					return false;
 				}
 
@@ -3162,7 +3161,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3181,7 +3180,7 @@ parse_and_validate_value(struct config_generic *record,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("%d%s%s is outside the valid range for parameter \"%s\" (%d%s%s .. %d%s%s)",
 									newval->intval, unitspace, unit,
-									name,
+									conf->gen.name,
 									conf->min, unitspace, unit,
 									conf->max, unitspace, unit)));
 					return false;
@@ -3203,7 +3202,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 					return false;
 				}
@@ -3222,7 +3221,7 @@ parse_and_validate_value(struct config_generic *record,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("%g%s%s is outside the valid range for parameter \"%s\" (%g%s%s .. %g%s%s)",
 									newval->realval, unitspace, unit,
-									name,
+									conf->gen.name,
 									conf->min, unitspace, unit,
 									conf->max, unitspace, unit)));
 					return false;
@@ -3278,7 +3277,7 @@ parse_and_validate_value(struct config_generic *record,
 					ereport(elevel,
 							(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 							 errmsg("invalid value for parameter \"%s\": \"%s\"",
-									name, value),
+									conf->gen.name, value),
 							 hintmsg ? errhint("%s", _(hintmsg)) : 0));
 
 					if (hintmsg)
@@ -3391,58 +3390,19 @@ set_config_option_ext(const char *name, const char *value,
 }
 
 
-/*
- * set_config_with_handle: sets option `name' to given value.
- *
- * This API adds the ability to pass a 'handle' argument, which can be
- * obtained by the caller from get_config_handle().  NULL has no effect,
- * but a non-null value avoids the need to search the GUC tables.
- *
- * This should be used by callers which repeatedly set the same config
- * option(s), and want to avoid the overhead of a hash lookup each time.
- */
-int
-set_config_with_handle(const char *name, config_handle *handle,
+/* see set_config_with_handle. */
+static int
+set_config_with_handle_guts(struct config_generic *record,
 					   const char *value,
 					   GucContext context, GucSource source, Oid srole,
 					   GucAction action, bool changeVal, int elevel,
 					   bool is_reload)
 {
-	struct config_generic *record;
 	union config_var_val newval_union;
 	void	   *newextra = NULL;
 	bool		prohibitValueChange = false;
 	bool		makeDefault;
 
-	if (elevel == 0)
-	{
-		if (source == PGC_S_DEFAULT || source == PGC_S_FILE)
-		{
-			/*
-			 * To avoid cluttering the log, only the postmaster bleats loudly
-			 * about problems with the config file.
-			 */
-			elevel = IsUnderPostmaster ? DEBUG3 : LOG;
-		}
-		else if (source == PGC_S_GLOBAL ||
-				 source == PGC_S_DATABASE ||
-				 source == PGC_S_USER ||
-				 source == PGC_S_DATABASE_USER)
-			elevel = WARNING;
-		else
-			elevel = ERROR;
-	}
-
-	/* if handle is specified, no need to look up option */
-	if (!handle)
-	{
-		record = find_option(name, true, false, elevel);
-		if (record == NULL)
-			return 0;
-	}
-	else
-		record = handle;
-
 	/*
 	 * GUC_ACTION_SAVE changes are acceptable during a parallel operation,
 	 * because the current worker will also pop the change.  We're probably
@@ -3460,7 +3420,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 		ereport(elevel,
 				(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
 				 errmsg("parameter \"%s\" cannot be set during a parallel operation",
-						name)));
+						record->name)));
 		return 0;
 	}
 
@@ -3476,7 +3436,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be changed",
-								name)));
+								record->name)));
 				return 0;
 			}
 			break;
@@ -3499,7 +3459,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-								name)));
+								record->name)));
 				return 0;
 			}
 			break;
@@ -3509,7 +3469,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be changed now",
-								name)));
+								record->name)));
 				return 0;
 			}
 
@@ -3529,14 +3489,14 @@ set_config_with_handle(const char *name, config_handle *handle,
 				 */
 				AclResult	aclresult;
 
-				aclresult = pg_parameter_aclcheck(name, srole, ACL_SET);
+				aclresult = pg_parameter_aclcheck(record->name, srole, ACL_SET);
 				if (aclresult != ACLCHECK_OK)
 				{
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+									record->name)));
 					return 0;
 				}
 			}
@@ -3578,7 +3538,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 				ereport(elevel,
 						(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 						 errmsg("parameter \"%s\" cannot be set after connection start",
-								name)));
+								record->name)));
 				return 0;
 			}
 			break;
@@ -3591,14 +3551,14 @@ set_config_with_handle(const char *name, config_handle *handle,
 				 */
 				AclResult	aclresult;
 
-				aclresult = pg_parameter_aclcheck(name, srole, ACL_SET);
+				aclresult = pg_parameter_aclcheck(record->name, srole, ACL_SET);
 				if (aclresult != ACLCHECK_OK)
 				{
 					/* No granted privilege */
 					ereport(elevel,
 							(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 							 errmsg("permission denied to set parameter \"%s\"",
-									name)));
+									record->name)));
 					return 0;
 				}
 			}
@@ -3637,7 +3597,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 					 errmsg("cannot set parameter \"%s\" within security-definer function",
-							name)));
+							record->name)));
 			return 0;
 		}
 		if (InSecurityRestrictedOperation())
@@ -3645,7 +3605,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 			ereport(elevel,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 					 errmsg("cannot set parameter \"%s\" within security-restricted operation",
-							name)));
+							record->name)));
 			return 0;
 		}
 	}
@@ -3657,7 +3617,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 		{
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-					 errmsg("parameter \"%s\" cannot be reset", name)));
+					 errmsg("parameter \"%s\" cannot be reset", record->name)));
 			return 0;
 		}
 		if (action == GUC_ACTION_SAVE)
@@ -3665,7 +3625,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 			ereport(elevel,
 					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 					 errmsg("parameter \"%s\" cannot be set locally in functions",
-							name)));
+							record->name)));
 			return 0;
 		}
 	}
@@ -3691,7 +3651,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 		if (changeVal && !makeDefault)
 		{
 			elog(DEBUG3, "\"%s\": setting ignored because previous source is higher priority",
-				 name);
+				 record->name);
 			return -1;
 		}
 		changeVal = false;
@@ -3710,7 +3670,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -3743,7 +3703,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3808,7 +3768,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -3841,7 +3801,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -3906,7 +3866,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -3939,7 +3899,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4004,7 +3964,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -4063,7 +4023,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4133,7 +4093,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 
 				if (value)
 				{
-					if (!parse_and_validate_value(record, name, value,
+					if (!parse_and_validate_value(record, value,
 												  source, elevel,
 												  &newval_union, &newextra))
 						return 0;
@@ -4166,7 +4126,7 @@ set_config_with_handle(const char *name, config_handle *handle,
 						ereport(elevel,
 								(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
 								 errmsg("parameter \"%s\" cannot be changed without restarting the server",
-										name)));
+										conf->gen.name)));
 						return 0;
 					}
 					record->status &= ~GUC_PENDING_RESTART;
@@ -4234,6 +4194,57 @@ set_config_with_handle(const char *name, config_handle *handle,
 	return changeVal ? 1 : -1;
 }
 
+/*
+ * set_config_with_handle: sets option `name' to given value.
+ *
+ * This API adds the ability to pass a 'handle' argument, which can be
+ * obtained by the caller from get_config_handle().  NULL has no effect,
+ * but a non-null value avoids the need to search the GUC tables.
+ *
+ * This should be used by callers which repeatedly set the same config
+ * option(s), and want to avoid the overhead of a hash lookup each time.
+ */
+int
+set_config_with_handle(const char *name, config_handle *handle,
+					   const char *value,
+					   GucContext context, GucSource source, Oid srole,
+					   GucAction action, bool changeVal, int elevel,
+					   bool is_reload)
+{
+	struct config_generic *record;
+
+	if (elevel == 0)
+	{
+		if (source == PGC_S_DEFAULT || source == PGC_S_FILE)
+		{
+			/*
+			 * To avoid cluttering the log, only the postmaster bleats loudly
+			 * about problems with the config file.
+			 */
+			elevel = IsUnderPostmaster ? DEBUG3 : LOG;
+		}
+		else if (source == PGC_S_GLOBAL ||
+				 source == PGC_S_DATABASE ||
+				 source == PGC_S_USER ||
+				 source == PGC_S_DATABASE_USER)
+			elevel = WARNING;
+		else
+			elevel = ERROR;
+	}
+
+	/* if handle is specified, no need to look up option */
+	if (!handle)
+	{
+		record = find_option(name, true, false, elevel);
+		if (record == NULL)
+			return 0;
+	}
+	else
+		record = handle;
+
+	return set_config_with_handle_guts(record,
+			   value, context, source, srole, action, changeVal, elevel, is_reload);
+}
 
 /*
  * Retrieve a config_handle for the given name, suitable for calling
@@ -4660,7 +4671,7 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
 				union config_var_val newval;
 				void	   *newextra = NULL;
 
-				if (!parse_and_validate_value(record, name, value,
+				if (!parse_and_validate_value(record, value,
 											  PGC_S_FILE, ERROR,
 											  &newval, &newextra))
 					ereport(ERROR,
diff --git a/src/test/regress/expected/guc.out b/src/test/regress/expected/guc.out
index 14edb42..7f9e29c 100644
--- a/src/test/regress/expected/guc.out
+++ b/src/test/regress/expected/guc.out
@@ -6,6 +6,10 @@ SHOW datestyle;
  Postgres, MDY
 (1 row)
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+ERROR:  invalid value for parameter "IntervalStyle": "asd"
+HINT:  Available values: postgres, postgres_verbose, sql_standard, iso_8601.
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
diff --git a/src/test/regress/sql/guc.sql b/src/test/regress/sql/guc.sql
index 2be7ab2..f65f84a 100644
--- a/src/test/regress/sql/guc.sql
+++ b/src/test/regress/sql/guc.sql
@@ -2,6 +2,9 @@
 -- we can't rely on any specific default value of vacuum_cost_delay
 SHOW datestyle;
 
+-- Check output style of CamelCase enum options
+SET intervalstyle to 'asd';
+
 -- SET to some nondefault value
 SET vacuum_cost_delay TO 40;
 SET datestyle = 'ISO, YMD';
-- 
1.8.3.1

#69Michael Paquier
michael@paquier.xyz
In reply to: Peter Smith (#68)
Re: GUC names in messages

On Tue, Oct 08, 2024 at 06:57:10PM +1100, Peter Smith wrote:

As for what is left, I had made just the minimal patch to fix the
known "IntervalStyle" problem, but that assumed prior knowledge of
what were the only problem names in the first place. Your way is
better -- to always use the record name where possible.

Yes, useful for custom GUCs, even if I doubt that many of them mix
character casing these days.

One thing I thought remains not so good is how
set_config_with_handle(name...) function does
record=find_option(name,...) but then all subsequent names are
supposed to be coming from the record->name. It feels confusing to
have that parameter 'name' still in scope after the find(), e.g., when
you should not be using that anymore. So, I tried to separate this
logic into 2 functions -- set_config_with_handle() and
set_config_with_handle_guts(). There are no name overlaps now, but I
wonder if the fix was overkill. See v14.

I was also looking at reducing the scope of the "name" variable in
this path, but that makes IMO the code a bit more confusing with the
existing wrapper set_config_option() and set_config_option_ext(),
while the handle is only used within fmgrs.

Applied the previous patch after looking at it again.
--
Michael

#70Peter Smith
smithpb2250@gmail.com
In reply to: Michael Paquier (#69)
Re: GUC names in messages

On Wed, Oct 9, 2024 at 8:54 PM Michael Paquier <michael@paquier.xyz> wrote:

Applied the previous patch after looking at it again.
--
Michael

AFAIK this brings my year-long "GUC names" thread to a conclusion.

Thanks, Michael for helping to get these last couple of patches
pushed, and thanks to everybody else who helped with the earlier ones.

I suspect there are plenty more "common" messages yet to be identified
but that can be a task for another thread.

This one is done.

======
Kind Regards,
Peter Smith.
Fujitsu Australia