diff options
author | Bruce Momjian <bruce@momjian.us> | 2019-12-21 17:02:38 -0500 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2019-12-21 17:02:38 -0500 |
commit | 4376fdbae11de9333012a31ba8d3a4f4b5d7a692 (patch) | |
tree | 652959bdef7aeeb11ec868bfd1085e233b38c206 /src | |
parent | 4cab43ec806a6298a545a399415ee8c4fe9307a8 (diff) | |
download | postgresql-4376fdbae11de9333012a31ba8d3a4f4b5d7a692.tar.gz postgresql-4376fdbae11de9333012a31ba8d3a4f4b5d7a692.zip |
C comment: clarify why psql's help/exit/quit must alone
Document why no indentation and why no non-whitespace postfix is
supported.
Backpatch-through: master
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/mainloop.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index f7b1b94599d..440bcd7df4d 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -237,7 +237,13 @@ MainLoop(FILE *source) bool found_exit_or_quit = false; bool found_q = false; - /* Search for the words we recognize; must be first word */ + /* + * The assistance words, help/exit/quit, must have no + * whitespace before them, and only whitespace after, with an + * optional semicolon. This prevents indented use of these + * words, perhaps as identifiers, from invoking the assistance + * behavior. + */ if (pg_strncasecmp(first_word, "help", 4) == 0) { rest_of_line = first_word + 4; @@ -249,7 +255,6 @@ MainLoop(FILE *source) rest_of_line = first_word + 4; found_exit_or_quit = true; } - else if (strncmp(first_word, "\\q", 2) == 0) { rest_of_line = first_word + 2; |