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.


Reply via email to