diff options
author | Tom Lane | 2024-01-10 19:20:09 +0000 |
---|---|---|
committer | Tom Lane | 2024-01-10 19:20:09 +0000 |
commit | 390298f0806588ceb131dd47760208bd2cd6298f (patch) | |
tree | bbf4288f085b0143941dda3d08e1455339365b3b /src/bin/psql/command.c | |
parent | add673b897c3d76767cec5ac1619fad6b1eb7582 (diff) |
Allow noise semicolons ending psql \sf, \ef, \sv, \ev commands.
Many psql backslash commands tolerate trailing semicolons, even
though that's not part of the official syntax. These did not.
They tried to, by passing semicolon = true to psql_scan_slash_option,
but that function ignored this parameter in OT_WHOLE_LINE mode.
Teach it to do the right thing, and remove the now-duplicative
logic in exec_command_help.
Discussion: https://postgr.es/m/2012251.1704746912@sss.pgh.pa.us
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index eb216b7c09e..9ad911e28d5 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -1640,18 +1640,7 @@ exec_command_help(PsqlScanState scan_state, bool active_branch) if (active_branch) { char *opt = psql_scan_slash_option(scan_state, - OT_WHOLE_LINE, NULL, false); - size_t len; - - /* strip any trailing spaces and semicolons */ - if (opt) - { - len = strlen(opt); - while (len > 0 && - (isspace((unsigned char) opt[len - 1]) - || opt[len - 1] == ';')) - opt[--len] = '\0'; - } + OT_WHOLE_LINE, NULL, true); helpSQL(opt, pset.popt.topt.pager); free(opt); @@ -3151,6 +3140,10 @@ ignore_slash_filepipe(PsqlScanState scan_state) * This *MUST* be used for inactive-branch processing of any slash command * that takes an OT_WHOLE_LINE option. Otherwise we might consume a different * amount of option text in active and inactive cases. + * + * Note: although callers might pass "semicolon" as either true or false, + * we need not duplicate that here, since it doesn't affect the amount of + * input text consumed. */ static void ignore_slash_whole_line(PsqlScanState scan_state) |