pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Miscellaneous message fixes
11+ messages / 6 participants
[nested] [flat]

* Miscellaneous message fixes
@ 2026-02-10 05:37 Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  2026-02-10 06:18 ` Re: Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  2026-02-10 07:14 ` Re: Miscellaneous message fixes Michael Paquier <michael@paquier.xyz>
  2026-02-10 10:26 ` Re: Miscellaneous message fixes Álvaro Herrera <alvherre@kurilemu.de>
  2026-02-11 10:28 ` Re:Miscellaneous message fixes =?gb18030?B?emVuZ21hbg==?= <zengman@halodbtech.com>
  2026-03-10 06:05 ` Re: Miscellaneous message fixes Michael Paquier <michael@paquier.xyz>
  0 siblings, 5 replies; 11+ messages in thread

From: Kyotaro Horiguchi @ 2026-02-10 05:37 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org

Hello.

I noticed that some error messages have issues such as non-standard
wording, slightly odd output, and minor grammatical mistakes, and have
attached patches addressing each of the items below.

0001:
guc_table.c:
>		.name = "effective_wal_level",
>...
>		.short_desc = gettext_noop("Show effective WAL level."),

We use "shows" in that context.


0002:
partbounds.c:
> errhint("ALTER TABLE ... MERGE PARTITIONS requires the partition bounds to be adjacent."),
...
> errhint("ALTER TABLE ... SPLIT PARTITION requires the partition bounds to be adjacent."),

These messages share the same body only differ in the command name. On
the other hand we have the following message in the same file.

> errhint("%s require combined bounds of new partitions must exactly match the bound of the split partition",
>					"ALTER TABLE ... SPLIT PARTITION"),

So, I think that the first two messages shoud use the same structure
with the last one.


0003:

The last message above mistakenly uses the present tense, and some
other messages do the same. I think this should be fixed.


0004:

In the messages mentioned in 0002, the sentence structure is somewhat
hard to parse. Adding $B!H(Bthat$B!I(B after $B!H(Brequires$B!I(B should improve clarity,
as in several other messages with the same issue.


0005:

In wait.c, there are three error messages with inconsistent wording:
two use "timeout value", while one uses "timeout" to refer to the same
object. This makes translation slightly awkward, so I suggest unifying
the wording.


0006: 
In extended_stats_funcs.c:
> errmsg("could not find extended statistics object \"%s\".\"%s\"",
>        quote_identifier(nspname),
>        quote_identifier(stxname)));

Since quote_identifier() already adds quoting when needed, adding
"%s"."%s" in the format string results in double quoting. It would be
better to use %s.%s instead.  I think quoting should be applied only
when necessary here. I'm not sure we should use
quote_qualified_identifier() instead.. (It's not used in the attached
patch).

There's a similar inconsistency.

>	errmsg("could not clear extended statistics object \"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
>		   get_namespace_name(nspoid), stxname,
>		   relnspname, relname));

In this part, the names are not passed through quote_identifier().  It
would be better to unify this as well.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

  [text/x-patch] 0001-Use-third-person-singular-Shows-for-reporting-variab.patch (1.2K, ../../20260210.143752.1113524465620875233.horikyota.ntt@gmail.com/2-0001-Use-third-person-singular-Shows-for-reporting-variab.patch)
  download | inline diff:
From b2315b812b3ed5274a49bcaeeffe9e343cbd5a19 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Thu, 5 Feb 2026 13:09:00 +0900
Subject: [PATCH 1/6] =?UTF-8?q?Use=20third-person=20singular=20=E2=80=9CSh?=
 =?UTF-8?q?ows=E2=80=9D=20for=20reporting=20variable?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Align with the convention of using third-person singular $B!H(BShows$B!I(B in a
reporting variable description.
---
 src/backend/utils/misc/guc_parameters.dat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat
index 762b8efe6b0..1031c7dbe80 100644
--- a/src/backend/utils/misc/guc_parameters.dat
+++ b/src/backend/utils/misc/guc_parameters.dat
@@ -806,7 +806,7 @@
 },
 
 { name => 'effective_wal_level', type => 'enum', context => 'PGC_INTERNAL', group => 'PRESET_OPTIONS',
-  short_desc => 'Show effective WAL level.',
+  short_desc => 'Shows effective WAL level.',
   flags => 'GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE',
   variable => 'effective_wal_level',
   boot_val => 'WAL_LEVEL_REPLICA',
-- 
2.47.3

  [text/x-patch] 0002-Consolidate-target-only-message-variants.patch (1.7K, ../../20260210.143752.1113524465620875233.horikyota.ntt@gmail.com/3-0002-Consolidate-target-only-message-variants.patch)
  download | inline diff:
From cab8e36ef5ec98b0988b5b0115570fee61dec7b8 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Thu, 5 Feb 2026 13:17:58 +0900
Subject: [PATCH 2/6] Consolidate target-only message variants

Consolidate two messages that differ only in their targets into a
single translation unit.
---
 src/backend/partitioning/partbounds.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index 0ca312ac27d..d8f48cb0868 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -5033,7 +5033,8 @@ check_two_partitions_bounds_range(Relation parent,
 						   second_name->relname, first_name->relname),
 					errdetail("lower bound of partition \"%s\" is not equal to the upper bound of partition \"%s\"",
 							  second_name->relname, first_name->relname),
-					errhint("ALTER TABLE ... MERGE PARTITIONS requires the partition bounds to be adjacent."),
+					errhint("%s requires the partition bounds to be adjacent.",
+							"ALTER TABLE ... MERGE PARTITIONS"),
 					parser_errposition(pstate, datum->location));
 		else
 			ereport(ERROR,
@@ -5042,7 +5043,8 @@ check_two_partitions_bounds_range(Relation parent,
 						   second_name->relname, first_name->relname),
 					errdetail("lower bound of partition \"%s\" is not equal to the upper bound of partition \"%s\"",
 							  second_name->relname, first_name->relname),
-					errhint("ALTER TABLE ... SPLIT PARTITION requires the partition bounds to be adjacent."),
+					errhint("%s requires the partition bounds to be adjacent.",
+							"ALTER TABLE ... SPLIT PARTITION"),
 					parser_errposition(pstate, datum->location));
 	}
 }
-- 
2.47.3

  [text/x-patch] 0003-Fix-grammar-in-a-partition-related-message.patch (4.1K, ../../20260210.143752.1113524465620875233.horikyota.ntt@gmail.com/4-0003-Fix-grammar-in-a-partition-related-message.patch)
  download | inline diff:
From dc2214e460b19a105c2858362a8daa653ce38b17 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Tue, 10 Feb 2026 13:46:17 +0900
Subject: [PATCH 3/6] Fix grammar in a partition-related message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix subject–verb agreement.
---
 src/backend/partitioning/partbounds.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index d8f48cb0868..a4487521a67 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -5406,7 +5406,7 @@ check_partition_bounds_for_split_range(Relation parent,
 							errmsg("lower bound of partition \"%s\" is not equal to lower bound of split partition \"%s\"",
 								   relname,
 								   get_rel_name(splitPartOid)),
-							errhint("%s require combined bounds of new partitions must exactly match the bound of the split partition",
+							errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
 									"ALTER TABLE ... SPLIT PARTITION"),
 							parser_errposition(pstate, exprLocation((Node *) datum)));
 			}
@@ -5416,7 +5416,7 @@ check_partition_bounds_for_split_range(Relation parent,
 						errmsg("lower bound of partition \"%s\" is less than lower bound of split partition \"%s\"",
 							   relname,
 							   get_rel_name(splitPartOid)),
-						errhint("%s require combined bounds of new partitions must exactly match the bound of the split partition",
+						errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
 								"ALTER TABLE ... SPLIT PARTITION"),
 						parser_errposition(pstate, exprLocation((Node *) datum)));
 		}
@@ -5448,7 +5448,7 @@ check_partition_bounds_for_split_range(Relation parent,
 							errmsg("upper bound of partition \"%s\" is not equal to upper bound of split partition \"%s\"",
 								   relname,
 								   get_rel_name(splitPartOid)),
-							errhint("%s require combined bounds of new partitions must exactly match the bound of the split partition",
+							errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
 									"ALTER TABLE ... SPLIT PARTITION"),
 							parser_errposition(pstate, exprLocation((Node *) datum)));
 			}
@@ -5458,7 +5458,7 @@ check_partition_bounds_for_split_range(Relation parent,
 						errmsg("upper bound of partition \"%s\" is greater than upper bound of split partition \"%s\"",
 							   relname,
 							   get_rel_name(splitPartOid)),
-						errhint("%s require combined bounds of new partitions must exactly match the bound of the split partition",
+						errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
 								"ALTER TABLE ... SPLIT PARTITION"),
 						parser_errposition(pstate, exprLocation((Node *) datum)));
 		}
@@ -5654,7 +5654,7 @@ check_parent_values_in_new_partitions(Relation parent,
 				errmsg("new partitions combined partition bounds do not contain value (%s) but split partition \"%s\" does",
 					   "NULL",
 					   get_rel_name(partOid)),
-				errhint("%s require combined bounds of new partitions must exactly match the bound of the split partition",
+				errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
 						"ALTER TABLE ... SPLIT PARTITION"));
 
 	/*
@@ -5697,7 +5697,7 @@ check_parent_values_in_new_partitions(Relation parent,
 				errmsg("new partitions combined partition bounds do not contain value (%s) but split partition \"%s\" does",
 					   deparse_expression((Node *) notFoundVal, NIL, false, false),
 					   get_rel_name(partOid)),
-				errhint("%s require combined bounds of new partitions must exactly match the bound of the split partition",
+				errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
 						"ALTER TABLE ... SPLIT PARTITION"));
 	}
 }
-- 
2.47.3



  [text/x-patch] 0004-Add-omitted-that-for-clarity-in-some-messages.patch (4.2K, ../../20260210.143752.1113524465620875233.horikyota.ntt@gmail.com/5-0004-Add-omitted-that-for-clarity-in-some-messages.patch)
  download | inline diff:
From 7a3524600fa589565b0cc4b5f00196d60213dff6 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Tue, 10 Feb 2026 13:48:25 +0900
Subject: [PATCH 4/6] Add omitted "that" for clarity in some messages
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch inserts $B!H(Bthat$B!I(B in several message where it had been
omitted, improving readability and reducing ambiguity.
---
 src/backend/partitioning/partbounds.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index a4487521a67..be3a3dc80f0 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -5406,7 +5406,7 @@ check_partition_bounds_for_split_range(Relation parent,
 							errmsg("lower bound of partition \"%s\" is not equal to lower bound of split partition \"%s\"",
 								   relname,
 								   get_rel_name(splitPartOid)),
-							errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
+							errhint("%s requires that combined bounds of new partitions must exactly match the bound of the split partition",
 									"ALTER TABLE ... SPLIT PARTITION"),
 							parser_errposition(pstate, exprLocation((Node *) datum)));
 			}
@@ -5416,7 +5416,7 @@ check_partition_bounds_for_split_range(Relation parent,
 						errmsg("lower bound of partition \"%s\" is less than lower bound of split partition \"%s\"",
 							   relname,
 							   get_rel_name(splitPartOid)),
-						errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
+						errhint("%s requires that combined bounds of new partitions must exactly match the bound of the split partition",
 								"ALTER TABLE ... SPLIT PARTITION"),
 						parser_errposition(pstate, exprLocation((Node *) datum)));
 		}
@@ -5448,7 +5448,7 @@ check_partition_bounds_for_split_range(Relation parent,
 							errmsg("upper bound of partition \"%s\" is not equal to upper bound of split partition \"%s\"",
 								   relname,
 								   get_rel_name(splitPartOid)),
-							errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
+							errhint("%s requires that combined bounds of new partitions must exactly match the bound of the split partition",
 									"ALTER TABLE ... SPLIT PARTITION"),
 							parser_errposition(pstate, exprLocation((Node *) datum)));
 			}
@@ -5458,7 +5458,7 @@ check_partition_bounds_for_split_range(Relation parent,
 						errmsg("upper bound of partition \"%s\" is greater than upper bound of split partition \"%s\"",
 							   relname,
 							   get_rel_name(splitPartOid)),
-						errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
+						errhint("%s requires that combined bounds of new partitions must exactly match the bound of the split partition",
 								"ALTER TABLE ... SPLIT PARTITION"),
 						parser_errposition(pstate, exprLocation((Node *) datum)));
 		}
@@ -5654,7 +5654,7 @@ check_parent_values_in_new_partitions(Relation parent,
 				errmsg("new partitions combined partition bounds do not contain value (%s) but split partition \"%s\" does",
 					   "NULL",
 					   get_rel_name(partOid)),
-				errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
+				errhint("%s requires that combined bounds of new partitions must exactly match the bound of the split partition",
 						"ALTER TABLE ... SPLIT PARTITION"));
 
 	/*
@@ -5697,7 +5697,7 @@ check_parent_values_in_new_partitions(Relation parent,
 				errmsg("new partitions combined partition bounds do not contain value (%s) but split partition \"%s\" does",
 					   deparse_expression((Node *) notFoundVal, NIL, false, false),
 					   get_rel_name(partOid)),
-				errhint("%s requires combined bounds of new partitions must exactly match the bound of the split partition",
+				errhint("%s requires that combined bounds of new partitions must exactly match the bound of the split partition",
 						"ALTER TABLE ... SPLIT PARTITION"));
 	}
 }
-- 
2.47.3

  [text/x-patch] 0005-Unify-wording-of-timeout-error-messages.patch (899B, ../../20260210.143752.1113524465620875233.horikyota.ntt@gmail.com/6-0005-Unify-wording-of-timeout-error-messages.patch)
  download | inline diff:
From 945b925964407c5f7527d0d942862d83fba63fbf Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Thu, 5 Feb 2026 16:55:21 +0900
Subject: [PATCH 5/6] Unify wording of timeout error messages

Align the wording of timeout-related error messages by using
"timeout value" consistently.
---
 src/backend/commands/wait.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/commands/wait.c b/src/backend/commands/wait.c
index 1290df10c6f..5218ce4c7fe 100644
--- a/src/backend/commands/wait.c
+++ b/src/backend/commands/wait.c
@@ -111,7 +111,7 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, DestReceiver *dest)
 			if (result < 0)
 				ereport(ERROR,
 						errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-						errmsg("timeout cannot be negative"));
+						errmsg("timeout value cannot be negative"));
 
 			timeout = (int64) result;
 		}
-- 
2.47.3

  [text/x-patch] 0006-Fix-double-quoting-in-extended-statistics-error-mess.patch (2.1K, ../../20260210.143752.1113524465620875233.horikyota.ntt@gmail.com/7-0006-Fix-double-quoting-in-extended-statistics-error-mess.patch)
  download | inline diff:
From b78d758fb6d44aa4a5e99f9a6250cd8c57c1fe16 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Mon, 9 Feb 2026 16:16:06 +0900
Subject: [PATCH 6/6] Fix double quoting in extended statistics error message

Remove extra quoting for identifiers already quoted by
quote_identifier().
---
 src/backend/statistics/extended_stats_funcs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/backend/statistics/extended_stats_funcs.c b/src/backend/statistics/extended_stats_funcs.c
index b640941a9cc..c718ffa95c6 100644
--- a/src/backend/statistics/extended_stats_funcs.c
+++ b/src/backend/statistics/extended_stats_funcs.c
@@ -347,7 +347,7 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_UNDEFINED_OBJECT),
-				errmsg("could not find extended statistics object \"%s\".\"%s\"",
+				errmsg("could not find extended statistics object %s.%s",
 					   quote_identifier(nspname),
 					   quote_identifier(stxname)));
 		success = false;
@@ -420,7 +420,7 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 				errmsg("cannot specify parameter \"%s\"",
 					   extarginfo[NDISTINCT_ARG].argname),
-				errhint("Extended statistics object \"%s\".\"%s\" does not support statistics of this type.",
+				errhint("Extended statistics object %s.%s does not support statistics of this type.",
 						quote_identifier(nspname),
 						quote_identifier(stxname)));
 
@@ -904,9 +904,11 @@ pg_clear_extended_stats(PG_FUNCTION_ARGS)
 		table_close(pg_stext, RowExclusiveLock);
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not clear extended statistics object \"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
-					   get_namespace_name(nspoid), stxname,
-					   relnspname, relname));
+				errmsg("could not clear extended statistics object %s.%s: incorrect relation %s.%s specified",
+					   quote_identifier(get_namespace_name(nspoid)),
+					   quote_identifier(stxname),
+					   quote_identifier(relnspname),
+					   quote_identifier(relname)));
 		PG_RETURN_VOID();
 	}
 
-- 
2.47.3

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2026-02-10 06:18 ` Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  4 siblings, 0 replies; 11+ messages in thread

From: Kyotaro Horiguchi @ 2026-02-10 06:18 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org

At Tue, 10 Feb 2026 14:37:52 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in 
> Hello.
> 
> I noticed that some error messages have issues such as non-standard
> wording, slightly odd output, and minor grammatical mistakes, and have
> attached patches addressing each of the items below.

Oops, sorry, the patch set causes a test failure.
I¢ll look into it.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2026-02-10 07:14 ` Michael Paquier <michael@paquier.xyz>
  4 siblings, 0 replies; 11+ messages in thread

From: Michael Paquier @ 2026-02-10 07:14 UTC (permalink / raw)
  To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org

On Tue, Feb 10, 2026 at 02:37:52PM +0900, Kyotaro Horiguchi wrote:
> 0006: 
> In extended_stats_funcs.c:
>> errmsg("could not find extended statistics object \"%s\".\"%s\"",
>>        quote_identifier(nspname),
>>        quote_identifier(stxname)));
> 
> Since quote_identifier() already adds quoting when needed, adding
> "%s"."%s" in the format string results in double quoting. It would be
> better to use %s.%s instead.  I think quoting should be applied only
> when necessary here. I'm not sure we should use
> quote_qualified_identifier() instead.. (It's not used in the attached
> patch).
> 
> There's a similar inconsistency.
> 
>>	errmsg("could not clear extended statistics object \"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
>>		   get_namespace_name(nspoid), stxname,
>>		   relnspname, relname));
> 
> In this part, the names are not passed through quote_identifier().  It
> would be better to unify this as well.

0006 relates to some of my recent business, so I'll go look and
address this part.  Thanks for the report. 
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../../aYrayZUfXKup-eEb@paquier.xyz/2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2026-02-10 10:26 ` Álvaro Herrera <alvherre@kurilemu.de>
  2026-02-10 14:55   ` Re: Miscellaneous message fixes Tom Lane <tgl@sss.pgh.pa.us>
  4 siblings, 1 reply; 11+ messages in thread

From: Álvaro Herrera @ 2026-02-10 10:26 UTC (permalink / raw)
  To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org

On 2026-Feb-10, Kyotaro Horiguchi wrote:

Hello,

> 0006: 
> In extended_stats_funcs.c:
> > errmsg("could not find extended statistics object \"%s\".\"%s\"",
> >        quote_identifier(nspname),
> >        quote_identifier(stxname)));
> 
> Since quote_identifier() already adds quoting when needed, adding
> "%s"."%s" in the format string results in double quoting. It would be
> better to use %s.%s instead.  I think quoting should be applied only
> when necessary here. I'm not sure we should use
> quote_qualified_identifier() instead.. (It's not used in the attached
> patch).
> 
> There's a similar inconsistency.
> 
> >	errmsg("could not clear extended statistics object \"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
> >		   get_namespace_name(nspoid), stxname,
> >		   relnspname, relname));
> 
> In this part, the names are not passed through quote_identifier().  It
> would be better to unify this as well.

Hmm, in the vast majority of messages, the quotes are in the literal
string, and we do not add quote_identifier().  This way, the names are
always quoted, not just when they are funny identifiers; also the
translator chooses the quoting style they want, which is not necessarily
the same as the one used in English.

So my recommendation would be to remove the quote_identifier() calls and
leave the quotes in the message.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  2026-02-10 10:26 ` Re: Miscellaneous message fixes Álvaro Herrera <alvherre@kurilemu.de>
@ 2026-02-10 14:55   ` Tom Lane <tgl@sss.pgh.pa.us>
  2026-02-10 22:03     ` Re: Miscellaneous message fixes Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 11+ messages in thread

From: Tom Lane @ 2026-02-10 14:55 UTC (permalink / raw)
  To: Álvaro Herrera <alvherre@kurilemu.de>; +Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org

=?utf-8?Q?=C3=81lvaro?= Herrera <alvherre@kurilemu.de> writes:
> On 2026-Feb-10, Kyotaro Horiguchi wrote:
>> In extended_stats_funcs.c:
>>> errmsg("could not find extended statistics object \"%s\".\"%s\"",
>>>        quote_identifier(nspname),
>>>        quote_identifier(stxname)));
>> 
>> Since quote_identifier() already adds quoting when needed, adding
>> "%s"."%s" in the format string results in double quoting. It would be
>> better to use %s.%s instead.  I think quoting should be applied only
>> when necessary here. I'm not sure we should use
>> quote_qualified_identifier() instead.

> Hmm, in the vast majority of messages, the quotes are in the literal
> string, and we do not add quote_identifier().  This way, the names are
> always quoted, not just when they are funny identifiers; also the
> translator chooses the quoting style they want, which is not necessarily
> the same as the one used in English.

Yeah, this code is simply wrong.  You should remove the
quote_identifier() calls and otherwise leave it as-is.

quote_identifier(), quote_qualified_identifier(), etc are meant for
building valid SQL strings.  However, an error message is a totally
different animal.  We decided years ago that the preferred style is
to wrap "..." around the unadorned identifier *in the error text*,
not by using quote_identifier(), so that translators could replace
the double-quote marks with appropriate marks for their language.
Is the English version 100% consistent in the presence of identifiers
containing double-quote marks?  No.  But we'd be making matters
worse not better for other languages if we did it differently.

This choice is documented at

https://www.postgresql.org/docs/devel/error-style-guide.html#ERROR-STYLE-GUIDE-QUOTATION-MARKS

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  2026-02-10 10:26 ` Re: Miscellaneous message fixes Álvaro Herrera <alvherre@kurilemu.de>
  2026-02-10 14:55   ` Re: Miscellaneous message fixes Tom Lane <tgl@sss.pgh.pa.us>
@ 2026-02-10 22:03     ` Michael Paquier <michael@paquier.xyz>
  2026-02-10 22:17       ` Re: Miscellaneous message fixes Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 11+ messages in thread

From: Michael Paquier @ 2026-02-10 22:03 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Álvaro Herrera <alvherre@kurilemu.de>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org

On Tue, Feb 10, 2026 at 09:55:23AM -0500, Tom Lane wrote:
> Yeah, this code is simply wrong.  You should remove the
> quote_identifier() calls and otherwise leave it as-is.
> 
> quote_identifier(), quote_qualified_identifier(), etc are meant for
> building valid SQL strings.  However, an error message is a totally
> different animal.  We decided years ago that the preferred style is
> to wrap "..." around the unadorned identifier *in the error text*,
> not by using quote_identifier(), so that translators could replace
> the double-quote marks with appropriate marks for their language.
> Is the English version 100% consistent in the presence of identifiers
> containing double-quote marks?  No.  But we'd be making matters
> worse not better for other languages if we did it differently.

Right, I had a brain fart on this one.  Using "%s"."%s" where the
namespace and object names were independently quoted is also not
project style.  At the end, I have removed the quote_identifier()
calls altogether, and reduced the number of quotes in the error
strings, leading to f33c58577422 as a result.  If there is anything
else, please let me know. 
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../../aYurQ_SLbysSvD0n@paquier.xyz/2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  2026-02-10 10:26 ` Re: Miscellaneous message fixes Álvaro Herrera <alvherre@kurilemu.de>
  2026-02-10 14:55   ` Re: Miscellaneous message fixes Tom Lane <tgl@sss.pgh.pa.us>
  2026-02-10 22:03     ` Re: Miscellaneous message fixes Michael Paquier <michael@paquier.xyz>
@ 2026-02-10 22:17       ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 11+ messages in thread

From: Tom Lane @ 2026-02-10 22:17 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Álvaro Herrera <alvherre@kurilemu.de>; Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org

Michael Paquier <michael@paquier.xyz> writes:
> Right, I had a brain fart on this one.  Using "%s"."%s" where the
> namespace and object names were independently quoted is also not
> project style.  At the end, I have removed the quote_identifier()
> calls altogether, and reduced the number of quotes in the error
> strings, leading to f33c58577422 as a result.  If there is anything
> else, please let me know. 

Yeah, f33c58577422 looks like what we've done elsewhere.  OK by me.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re:Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2026-02-11 10:28 ` =?gb18030?B?emVuZ21hbg==?= <zengman@halodbtech.com>
  4 siblings, 0 replies; 11+ messages in thread

From: zengman @ 2026-02-11 10:28 UTC (permalink / raw)
  To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; +Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>

Hi,

Per (https://www.postgresql.org/docs/devel/error-style-guide.html#ERROR-STYLE-GUIDE-TRICKY-WORDS) where it says: 
```
Avoid contractions, like “can't”; use “cannot” instead.
```
could we add an extra 0007 patch for this?

--
regards,
Man Zeng

Attachments:

  [application/octet-stream] 0007-Replace-can-t-with-cannot-in-error-messages-for-cons.patch (6.5K, ../../tencent_1FDB2824329E99410C2EEC7F@qq.com/2-0007-Replace-can-t-with-cannot-in-error-messages-for-cons.patch)
  download | inline diff:
From e6d26826027447c897dcf07e0f306878dd450fb0 Mon Sep 17 00:00:00 2001
From: Man Zeng <zengman@halodbtech.com>
Date: Wed, 11 Feb 2026 15:02:03 +0800
Subject: [PATCH] Replace "can't" with "cannot" in error messages for
 consistency

---
 contrib/amcheck/verify_nbtree.c           | 4 ++--
 contrib/cube/cube.c                       | 6 +++---
 src/backend/access/transam/xlog.c         | 2 +-
 src/backend/commands/tablecmds.c          | 2 +-
 src/backend/optimizer/prep/prepqual.c     | 2 +-
 src/backend/storage/aio/method_io_uring.c | 2 +-
 src/backend/storage/ipc/dsm.c             | 2 +-
 src/backend/storage/page/bufpage.c        | 2 +-
 src/bin/pg_basebackup/walmethods.c        | 2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c
index 34433e819d4..cbde10aa84d 100644
--- a/contrib/amcheck/verify_nbtree.c
+++ b/contrib/amcheck/verify_nbtree.c
@@ -2204,7 +2204,7 @@ bt_child_highkey_check(BtreeCheckState *state,
 		if (blkno == P_NONE)
 			ereport(ERROR,
 					(errcode(ERRCODE_INDEX_CORRUPTED),
-					 errmsg("can't traverse from downlink %u to downlink %u of index \"%s\"",
+					 errmsg("cannot traverse from downlink %u to downlink %u of index \"%s\"",
 							state->prevrightlink, downlink,
 							RelationGetRelationName(state->rel))));
 
@@ -2337,7 +2337,7 @@ bt_child_highkey_check(BtreeCheckState *state,
 				if (!state->lowkey)
 					ereport(ERROR,
 							(errcode(ERRCODE_INDEX_CORRUPTED),
-							 errmsg("can't find left sibling high key in index \"%s\"",
+							 errmsg("cannot find left sibling high key in index \"%s\"",
 									RelationGetRelationName(state->rel)),
 							 errdetail_internal("Target block=%u child block=%u target page lsn=%X/%08X.",
 												state->targetblock, blkno,
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index 77263ab277f..99886999e98 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -161,7 +161,7 @@ cube_a_f8_f8(PG_FUNCTION_ARGS)
 	if (dim > CUBE_MAX_DIM)
 		ereport(ERROR,
 				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-				 errmsg("can't extend cube"),
+				 errmsg("cannot extend cube"),
 				 errdetail("A cube cannot have more than %d dimensions.",
 						   CUBE_MAX_DIM)));
 
@@ -1831,7 +1831,7 @@ cube_c_f8(PG_FUNCTION_ARGS)
 	if (DIM(cube) + 1 > CUBE_MAX_DIM)
 		ereport(ERROR,
 				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-				 errmsg("can't extend cube"),
+				 errmsg("cannot extend cube"),
 				 errdetail("A cube cannot have more than %d dimensions.",
 						   CUBE_MAX_DIM)));
 
@@ -1879,7 +1879,7 @@ cube_c_f8_f8(PG_FUNCTION_ARGS)
 	if (DIM(cube) + 1 > CUBE_MAX_DIM)
 		ereport(ERROR,
 				(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-				 errmsg("can't extend cube"),
+				 errmsg("cannot extend cube"),
 				 errdetail("A cube cannot have more than %d dimensions.",
 						   CUBE_MAX_DIM)));
 
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 13ec6225b85..4f173274542 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7037,7 +7037,7 @@ CreateCheckPoint(int flags)
 
 	/* sanity check */
 	if (RecoveryInProgress() && (flags & CHECKPOINT_END_OF_RECOVERY) == 0)
-		elog(ERROR, "can't create a checkpoint during recovery");
+		elog(ERROR, "cannot create a checkpoint during recovery");
 
 	/*
 	 * Prepare to accumulate statistics.
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index f976c0e5c7e..c1b168fa92f 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -21086,7 +21086,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
 		if (rel == NULL)
 		{
 			if (partRel != NULL)	/* shouldn't happen */
-				elog(WARNING, "dangling partition \"%s\" remains, can't fix",
+				elog(WARNING, "dangling partition \"%s\" remains, cannot fix",
 					 partrelname);
 			ereport(ERROR,
 					(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
diff --git a/src/backend/optimizer/prep/prepqual.c b/src/backend/optimizer/prep/prepqual.c
index c71729bb1b0..0c5b0112624 100644
--- a/src/backend/optimizer/prep/prepqual.c
+++ b/src/backend/optimizer/prep/prepqual.c
@@ -73,7 +73,7 @@ Node *
 negate_clause(Node *node)
 {
 	if (node == NULL)			/* should not happen */
-		elog(ERROR, "can't negate an empty subexpression");
+		elog(ERROR, "cannot negate an empty subexpression");
 	switch (nodeTag(node))
 	{
 		case T_Const:
diff --git a/src/backend/storage/aio/method_io_uring.c b/src/backend/storage/aio/method_io_uring.c
index ed6e71bcd46..3a2bccfa7e3 100644
--- a/src/backend/storage/aio/method_io_uring.c
+++ b/src/backend/storage/aio/method_io_uring.c
@@ -218,7 +218,7 @@ pgaio_uring_check_capabilities(void)
 #else
 	{
 		elog(DEBUG1,
-			 "can't use combined memory mapping for io_uring, kernel or liburing too old");
+			 "cannot use combined memory mapping for io_uring, kernel or liburing too old");
 	}
 #endif
 
diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c
index 6a5b16392f7..2cdbcda1c8d 100644
--- a/src/backend/storage/ipc/dsm.c
+++ b/src/backend/storage/ipc/dsm.c
@@ -689,7 +689,7 @@ dsm_attach(dsm_handle h)
 	{
 		seg = dlist_container(dsm_segment, node, iter.cur);
 		if (seg->handle == h)
-			elog(ERROR, "can't attach the same segment more than once");
+			elog(ERROR, "cannot attach the same segment more than once");
 	}
 
 	/* Create a new segment descriptor. */
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c
index de85911e3ac..d1ce699934f 100644
--- a/src/backend/storage/page/bufpage.c
+++ b/src/backend/storage/page/bufpage.c
@@ -296,7 +296,7 @@ PageAddItemExtended(Page page,
 	/* Reject placing items beyond heap boundary, if heap */
 	if ((flags & PAI_IS_HEAP) != 0 && offsetNumber > MaxHeapTuplesPerPage)
 	{
-		elog(WARNING, "can't put more than MaxHeapTuplesPerPage items in a heap page");
+		elog(WARNING, "cannot put more than MaxHeapTuplesPerPage items in a heap page");
 		return InvalidOffsetNumber;
 	}
 
diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c
index 17d22c79f68..7bbd475fb63 100644
--- a/src/bin/pg_basebackup/walmethods.c
+++ b/src/bin/pg_basebackup/walmethods.c
@@ -889,7 +889,7 @@ tar_open_for_write(WalWriteMethod *wwmethod, const char *pathname,
 	if (tar_data->currentfile != NULL)
 	{
 		wwmethod->lasterrstring =
-			_("implementation error: tar files can't have more than one open file");
+			_("implementation error: tar files cannot have more than one open file");
 		return NULL;
 	}
 
-- 
2.45.2



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2026-03-10 06:05 ` Michael Paquier <michael@paquier.xyz>
  2026-03-10 18:20   ` Re: Miscellaneous message fixes Masahiko Sawada <sawada.mshk@gmail.com>
  4 siblings, 1 reply; 11+ messages in thread

From: Michael Paquier @ 2026-03-10 06:05 UTC (permalink / raw)
  To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org, Masahiko Sawada <sawada.mshk@gmail.com>; Alexander Korotkov <aekorotkov@gmail.com>

On Tue, Feb 10, 2026 at 02:37:52PM +0900, Kyotaro Horiguchi wrote:
> I noticed that some error messages have issues such as non-standard
> wording, slightly odd output, and minor grammatical mistakes, and have
> attached patches addressing each of the items below.

In the set of patches that Horiguchi-san has sent, I have taken care
of 0006 as it was my own business.

Added in CC the two committers that own the other items reported.

Sawada-san, could you take care of 0001 as effective_wal_level is your
thing?

Alexander-san, could you take take of 0002~0005?  These relate to the
WAIT command and the partition manipulation patches.

Thanks,
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../../aa-0kDWXbuUZD19r@paquier.xyz/2-signature.asc)
  download

^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  2026-03-10 06:05 ` Re: Miscellaneous message fixes Michael Paquier <michael@paquier.xyz>
@ 2026-03-10 18:20   ` Masahiko Sawada <sawada.mshk@gmail.com>
  2026-03-10 18:39     ` Re: Miscellaneous message fixes Masahiko Sawada <sawada.mshk@gmail.com>
  0 siblings, 1 reply; 11+ messages in thread

From: Masahiko Sawada @ 2026-03-10 18:20 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org, Alexander Korotkov <aekorotkov@gmail.com>

On Mon, Mar 9, 2026 at 11:05 PM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Tue, Feb 10, 2026 at 02:37:52PM +0900, Kyotaro Horiguchi wrote:
> > I noticed that some error messages have issues such as non-standard
> > wording, slightly odd output, and minor grammatical mistakes, and have
> > attached patches addressing each of the items below.
>
> In the set of patches that Horiguchi-san has sent, I have taken care
> of 0006 as it was my own business.
>
> Added in CC the two committers that own the other items reported.
>
> Sawada-san, could you take care of 0001 as effective_wal_level is your
> thing?

Sure, I'll take care of it.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: Miscellaneous message fixes
  2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
  2026-03-10 06:05 ` Re: Miscellaneous message fixes Michael Paquier <michael@paquier.xyz>
  2026-03-10 18:20   ` Re: Miscellaneous message fixes Masahiko Sawada <sawada.mshk@gmail.com>
@ 2026-03-10 18:39     ` Masahiko Sawada <sawada.mshk@gmail.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Masahiko Sawada @ 2026-03-10 18:39 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; pgsql-hackers@lists.postgresql.org, Alexander Korotkov <aekorotkov@gmail.com>

On Tue, Mar 10, 2026 at 11:20 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> On Mon, Mar 9, 2026 at 11:05 PM Michael Paquier <michael@paquier.xyz> wrote:
> >
> > On Tue, Feb 10, 2026 at 02:37:52PM +0900, Kyotaro Horiguchi wrote:
> > > I noticed that some error messages have issues such as non-standard
> > > wording, slightly odd output, and minor grammatical mistakes, and have
> > > attached patches addressing each of the items below.
> >
> > In the set of patches that Horiguchi-san has sent, I have taken care
> > of 0006 as it was my own business.
> >
> > Added in CC the two committers that own the other items reported.
> >
> > Sawada-san, could you take care of 0001 as effective_wal_level is your
> > thing?
>
> Sure, I'll take care of it.

Pushed. Thank you for the report!

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com





^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2026-03-10 18:39 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-02-10 05:37 Miscellaneous message fixes Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-02-10 06:18 ` Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2026-02-10 07:14 ` Michael Paquier <michael@paquier.xyz>
2026-02-10 10:26 ` Álvaro Herrera <alvherre@kurilemu.de>
2026-02-10 14:55   ` Tom Lane <tgl@sss.pgh.pa.us>
2026-02-10 22:03     ` Michael Paquier <michael@paquier.xyz>
2026-02-10 22:17       ` Tom Lane <tgl@sss.pgh.pa.us>
2026-02-11 10:28 ` =?gb18030?B?emVuZ21hbg==?= <zengman@halodbtech.com>
2026-03-10 06:05 ` Michael Paquier <michael@paquier.xyz>
2026-03-10 18:20   ` Masahiko Sawada <sawada.mshk@gmail.com>
2026-03-10 18:39     ` Masahiko Sawada <sawada.mshk@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox