Skip to content

Commit 19c590f

Browse files
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
1 parent 03734a7 commit 19c590f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/bin/psql/command.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5395,16 +5395,16 @@ echo_hidden_command(const char *query)
53955395
{
53965396
if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
53975397
{
5398-
printf(_("********* QUERY **********\n"
5398+
printf(_("/******** QUERY *********/\n"
53995399
"%s\n"
5400-
"**************************\n\n"), query);
5400+
"/************************/\n\n"), query);
54015401
fflush(stdout);
54025402
if (pset.logfile)
54035403
{
54045404
fprintf(pset.logfile,
5405-
_("********* QUERY **********\n"
5405+
_("/******** QUERY *********/\n"
54065406
"%s\n"
5407-
"**************************\n\n"), query);
5407+
"/************************/\n\n"), query);
54085408
fflush(pset.logfile);
54095409
}
54105410

src/bin/psql/common.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -589,16 +589,16 @@ PSQLexec(const char *query)
589589

590590
if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
591591
{
592-
printf(_("********* QUERY **********\n"
592+
printf(_("/******** QUERY *********/\n"
593593
"%s\n"
594-
"**************************\n\n"), query);
594+
"/************************/\n\n"), query);
595595
fflush(stdout);
596596
if (pset.logfile)
597597
{
598598
fprintf(pset.logfile,
599-
_("********* QUERY **********\n"
599+
_("/******** QUERY *********/\n"
600600
"%s\n"
601-
"**************************\n\n"), query);
601+
"/************************/\n\n"), query);
602602
fflush(pset.logfile);
603603
}
604604

@@ -1060,9 +1060,9 @@ SendQuery(const char *query)
10601060
char buf[3];
10611061

10621062
fflush(stderr);
1063-
printf(_("***(Single step mode: verify command)*******************************************\n"
1063+
printf(_("/**(Single step mode: verify command)******************************************/\n"
10641064
"%s\n"
1065-
"***(press return to proceed or enter x and return to cancel)********************\n"),
1065+
"/**(press return to proceed or enter x and return to cancel)*******************/\n"),
10661066
query);
10671067
fflush(stdout);
10681068
if (fgets(buf, sizeof(buf), stdin) != NULL)
@@ -1080,9 +1080,9 @@ SendQuery(const char *query)
10801080
if (pset.logfile)
10811081
{
10821082
fprintf(pset.logfile,
1083-
_("********* QUERY **********\n"
1083+
_("/******** QUERY *********/\n"
10841084
"%s\n"
1085-
"**************************\n\n"), query);
1085+
"/************************/\n\n"), query);
10861086
fflush(pset.logfile);
10871087
}
10881088

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy