mirror of
https://github.com/postgres/postgres.git
synced 2025-05-15 19:15:29 +03:00
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
This commit is contained in:
parent
03734a7fed
commit
19c590f6a7
@ -5395,16 +5395,16 @@ echo_hidden_command(const char *query)
|
|||||||
{
|
{
|
||||||
if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
|
if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
|
||||||
{
|
{
|
||||||
printf(_("********* QUERY **********\n"
|
printf(_("/******** QUERY *********/\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"**************************\n\n"), query);
|
"/************************/\n\n"), query);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (pset.logfile)
|
if (pset.logfile)
|
||||||
{
|
{
|
||||||
fprintf(pset.logfile,
|
fprintf(pset.logfile,
|
||||||
_("********* QUERY **********\n"
|
_("/******** QUERY *********/\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"**************************\n\n"), query);
|
"/************************/\n\n"), query);
|
||||||
fflush(pset.logfile);
|
fflush(pset.logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,16 +589,16 @@ PSQLexec(const char *query)
|
|||||||
|
|
||||||
if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
|
if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF)
|
||||||
{
|
{
|
||||||
printf(_("********* QUERY **********\n"
|
printf(_("/******** QUERY *********/\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"**************************\n\n"), query);
|
"/************************/\n\n"), query);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (pset.logfile)
|
if (pset.logfile)
|
||||||
{
|
{
|
||||||
fprintf(pset.logfile,
|
fprintf(pset.logfile,
|
||||||
_("********* QUERY **********\n"
|
_("/******** QUERY *********/\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"**************************\n\n"), query);
|
"/************************/\n\n"), query);
|
||||||
fflush(pset.logfile);
|
fflush(pset.logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,9 +1060,9 @@ SendQuery(const char *query)
|
|||||||
char buf[3];
|
char buf[3];
|
||||||
|
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
printf(_("***(Single step mode: verify command)*******************************************\n"
|
printf(_("/**(Single step mode: verify command)******************************************/\n"
|
||||||
"%s\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);
|
query);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (fgets(buf, sizeof(buf), stdin) != NULL)
|
if (fgets(buf, sizeof(buf), stdin) != NULL)
|
||||||
@ -1080,9 +1080,9 @@ SendQuery(const char *query)
|
|||||||
if (pset.logfile)
|
if (pset.logfile)
|
||||||
{
|
{
|
||||||
fprintf(pset.logfile,
|
fprintf(pset.logfile,
|
||||||
_("********* QUERY **********\n"
|
_("/******** QUERY *********/\n"
|
||||||
"%s\n"
|
"%s\n"
|
||||||
"**************************\n\n"), query);
|
"/************************/\n\n"), query);
|
||||||
fflush(pset.logfile);
|
fflush(pset.logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user