diff options
author | Nathan Bossart | 2023-07-27 00:02:39 +0000 |
---|---|---|
committer | Nathan Bossart | 2023-07-27 00:02:39 +0000 |
commit | 19c590f6a795831b34782a4d69fa6a52dc9d03c3 (patch) | |
tree | 9c215aa77ca5b662f8db70a7e079b5088f0a6797 | |
parent | 03734a7fed7d924679770adb78a7db8a37d14188 (diff) |
Adjust extra lines generated by psql to be valid SQL comments.
psql's --echo-hidden, --log-file, and --single-step options
generate extra lines to clearly separate queries from other output.
Presently, these extra lines are not valid SQL comments, which
makes them a hazard for anyone trying to copy/paste the decorated
queries into a client or query editor. This commit replaces the
starting and ending asterisks in these extra lines with forward
slashes so that they are valid SQL comments that can be copy/pasted
without incident.
Author: Kirk Wolak
Reviewed-by: Pavel Stehule, Laurenz Albe, Tom Lane, Alvaro Herrera, Andrey Borodin
Discussion: https://postgr.es/m/CACLU5mTFJRJYtbvmZ26txGgmXWQo0hkGhH2o3hEquUPmSbGtBw%40mail.gmail.com
-rw-r--r-- | src/bin/psql/command.c | 8 | ||||
-rw-r--r-- | src/bin/psql/common.c | 16 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 6733f008fd..1300869d79 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -5395,16 +5395,16 @@ echo_hidden_command(const char *query) { if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF) { - printf(_("********* QUERY **********\n" + printf(_("/******** QUERY *********/\n" "%s\n" - "**************************\n\n"), query); + "/************************/\n\n"), query); fflush(stdout); if (pset.logfile) { fprintf(pset.logfile, - _("********* QUERY **********\n" + _("/******** QUERY *********/\n" "%s\n" - "**************************\n\n"), query); + "/************************/\n\n"), query); fflush(pset.logfile); } diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 5973df2e39..10ad1f2538 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -589,16 +589,16 @@ PSQLexec(const char *query) if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF) { - printf(_("********* QUERY **********\n" + printf(_("/******** QUERY *********/\n" "%s\n" - "**************************\n\n"), query); + "/************************/\n\n"), query); fflush(stdout); if (pset.logfile) { fprintf(pset.logfile, - _("********* QUERY **********\n" + _("/******** QUERY *********/\n" "%s\n" - "**************************\n\n"), query); + "/************************/\n\n"), query); fflush(pset.logfile); } @@ -1060,9 +1060,9 @@ SendQuery(const char *query) char buf[3]; fflush(stderr); - printf(_("***(Single step mode: verify command)*******************************************\n" + printf(_("/**(Single step mode: verify command)******************************************/\n" "%s\n" - "***(press return to proceed or enter x and return to cancel)********************\n"), + "/**(press return to proceed or enter x and return to cancel)*******************/\n"), query); fflush(stdout); if (fgets(buf, sizeof(buf), stdin) != NULL) @@ -1080,9 +1080,9 @@ SendQuery(const char *query) if (pset.logfile) { fprintf(pset.logfile, - _("********* QUERY **********\n" + _("/******** QUERY *********/\n" "%s\n" - "**************************\n\n"), query); + "/************************/\n\n"), query); fflush(pset.logfile); } |