From 8f314ab957f411023e76764d971f0597bd7a052a Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Mon, 19 Oct 2026 16:58:40 +0900 Subject: [PATCH v1] doc: Correct psql's \d+x documentation for sequences Commit 00f4c2959d6 added the x modifier to psql's list commands, making \d+x display sequence descriptions in expanded mode. However, the documentation and \? help indicate that x applies only without a pattern. Clarify that \d+x also uses expanded mode when describing sequences matched by a name or pattern, and update the command help accordingly. Also clarify that the same restriction applies to \x on and \x auto. Backpatch to v18, where the x modifier was introduced. Reported-by: George MacKerron Author: Fujii Masao Discussion: https://postgr.es/m/FEA91EA9-CF32-4920-9674-F2C3E01C3807@databricks.com Backpatch-through: 18 --- doc/src/sgml/ref/psql-ref.sgml | 11 +++++++---- src/bin/psql/help.c | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index bb9e009e719..4058caf061b 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1340,10 +1340,13 @@ SELECT $1 \parse stmt1 As with many other commands, if x is appended to - the command name, the results are displayed in expanded mode, but note - that this only applies when \d is used without a - pattern argument, and - the x modifier cannot appear immediately after the + the command name, the results are displayed in expanded mode for this + command only, but note that this only applies when \d + is used without a pattern + argument or to describe a sequence. + The same limitation on expanded output applies to + \x on and \x auto. + The x modifier cannot appear immediately after the \d (because \dx is a different command); the x modifier may only appear after an S or + modifier. For example, diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 6b599c4705a..0def23418d5 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -220,7 +220,8 @@ slashUsage(unsigned short int pager) HELP0("Informational\n"); HELP0(" (options: S = show system objects, x = expanded mode, + = additional detail)\n"); HELP0(" \\d[Sx+] list tables, views, and sequences\n"); - HELP0(" \\d[S+] NAME describe table, view, sequence, or index\n"); + HELP0(" \\d[Sx+] NAME describe table, view, sequence, or index\n"); + HELP0(" (x applies only to sequences)\n"); HELP0(" \\da[Sx] [PATTERN] list aggregates\n"); HELP0(" \\dA[x+] [PATTERN] list access methods\n"); HELP0(" \\dAc[x+] [AMPTRN [TYPEPTRN]] list operator classes\n"); -- 2.56.0