psql: Split extended query protocol meta-commands in --help=commands
authorMichael Paquier <michael@paquier.xyz>
Sat, 19 Apr 2025 23:34:38 +0000 (08:34 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 19 Apr 2025 23:34:38 +0000 (08:34 +0900)
Compared to v17 with only \bind able to do extended query protocol work,
v18 has now a total of 11 meta-commands related to the extended query
protocol.  These were all listed under the "General" section of the
--help=commands output and are specialized, bloating the output
generated.

All these meta-commands are moved into a new section called "Extended
Query Protocol", listed at the end of --help=commands.

This split has been suggested by Noah Misch.

Discussion: https://postgr.es/m/20250415213450.1f.nmisch@google.com

src/bin/psql/help.c

index 8c917e61f49058bcd862d405b3a0de16c8f84951..403b51325a72c20b4bcb77d9c0c1d5a9cf2e1539 100644 (file)
@@ -161,29 +161,16 @@ slashUsage(unsigned short int pager)
    initPQExpBuffer(&buf);
 
    HELP0("General\n");
-   HELP0("  \\bind [PARAM]...       set query parameters\n");
-   HELP0("  \\bind_named STMT_NAME [PARAM]...\n"
-         "                         set query parameters for an existing prepared statement\n");
-   HELP0("  \\close STMT_NAME       close an existing prepared statement\n");
    HELP0("  \\copyright             show PostgreSQL usage and distribution terms\n");
    HELP0("  \\crosstabview [COLUMNS] execute query and display result in crosstab\n");
-   HELP0("  \\endpipeline           exit pipeline mode\n");
    HELP0("  \\errverbose            show most recent error message at maximum verbosity\n");
-   HELP0("  \\flush                 flush output data to the server\n");
-   HELP0("  \\flushrequest          send request to the server to flush its output buffer\n");
    HELP0("  \\g [(OPTIONS)] [FILE]  execute query (and send result to file or |pipe);\n"
          "                         \\g with no arguments is equivalent to a semicolon\n");
    HELP0("  \\gdesc                 describe result of query, without executing it\n");
-   HELP0("  \\getresults [NUM_RES]  read NUM_RES pending results. All pending results are\n"
-         "                         read if no argument is provided\n");
    HELP0("  \\gexec                 execute query, then execute each value in its result\n");
    HELP0("  \\gset [PREFIX]         execute query and store result in psql variables\n");
    HELP0("  \\gx [(OPTIONS)] [FILE] as \\g, but forces expanded output mode\n");
-   HELP0("  \\parse STMT_NAME       create a prepared statement\n");
    HELP0("  \\q                     quit psql\n");
-   HELP0("  \\sendpipeline          send an extended query to an ongoing pipeline\n");
-   HELP0("  \\startpipeline         enter pipeline mode\n");
-   HELP0("  \\syncpipeline          add a synchronisation point to an ongoing pipeline\n");
    HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n"
          "                         execute query every SEC seconds, up to N times,\n"
          "                         stop if less than MIN rows are returned\n");
@@ -337,6 +324,22 @@ slashUsage(unsigned short int pager)
    HELP0("  \\prompt [TEXT] NAME    prompt user to set internal variable\n");
    HELP0("  \\set [NAME [VALUE]]    set internal variable, or list all if no parameters\n");
    HELP0("  \\unset NAME            unset (delete) internal variable\n");
+   HELP0("\n");
+
+   HELP0("Extended Query Protocol\n");
+   HELP0("  \\bind [PARAM]...       set query parameters\n");
+   HELP0("  \\bind_named STMT_NAME [PARAM]...\n"
+         "                         set query parameters for an existing prepared statement\n");
+   HELP0("  \\close STMT_NAME       close an existing prepared statement\n");
+   HELP0("  \\endpipeline           exit pipeline mode\n");
+   HELP0("  \\flush                 flush output data to the server\n");
+   HELP0("  \\flushrequest          send request to the server to flush its output buffer\n");
+   HELP0("  \\getresults [NUM_RES]  read NUM_RES pending results. All pending results are\n"
+         "                         read if no argument is provided\n");
+   HELP0("  \\parse STMT_NAME       create a prepared statement\n");
+   HELP0("  \\sendpipeline          send an extended query to an ongoing pipeline\n");
+   HELP0("  \\startpipeline         enter pipeline mode\n");
+   HELP0("  \\syncpipeline          add a synchronisation point to an ongoing pipeline\n");
 
    /* Now we can count the lines. */
    nlcount = 0;