Improve version detection for online help URL

From: Japin Li <japinli(at)hotmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Improve version detection for online help URL
Date: 2026-06-04 03:19:02
Message-ID: SY7PR01MB1092124777CDA5FA4022B6D17B6102@SY7PR01MB10921.ausprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi hackers,

Currently, we are on 19beta1, and I found an invalid URL for an SQL command.

postgres=# \h SET SESSION
Command: SET SESSION AUTHORIZATION
Description: set the session user identifier and the current user identifier of the current session
Syntax:
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION user_name
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION DEFAULT
RESET SESSION AUTHORIZATION

URL: https://www.postgresql.org/docs/19/sql-set-session-authorization.html

postgres=# SHOW server_version;
server_version
----------------
19beta1
(1 row)

The expected correct URL is:

https://www.postgresql.org/docs/devel/sql-set-session-authorization.html

In helpSQL(), the URL is currently formatted as:

url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION,
QL_HELP[i].docbook_id);

According to the version_stamp.pl script, only released versions contain a dot
in PG_VERSION. Therefore, I think we should fix it as follows:

diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 5e0d8f3aae1..b80564debf0 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -714,7 +714,7 @@ helpSQL(const char *topic, unsigned short int pager)
initPQExpBuffer(&buffer);
QL_HELP[i].syntaxfunc(&buffer);
url = psprintf("https://www.postgresql.org/docs/%s/%s.html",
- strstr(PG_VERSION, "devel") ? "devel" : PG_MAJORVERSION,
+ strstr(PG_VERSION, ".") ? PG_MAJORVERSION : "devel",
QL_HELP[i].docbook_id);
/* # of newlines in format must match constant above! */
fprintf(output, _("Command: %s\n"

Any thoughts?

--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-06-04 03:43:52 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication
Previous Message Ewan Young 2026-06-04 03:00:34 Re: [PATCH] Clarify that ssl_groups is for any key exchange groups