public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nathan Bossart <[email protected]>
To: Pavel Stehule <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Andrey M. Borodin <[email protected]>
Cc: Kirk Wolak <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: psql: Could we get "-- " prefixing on the **** QUERY **** outputs? (ECHO_HIDDEN)
Date: Wed, 26 Jul 2023 14:39:25 -0700
Message-ID: <20230726213925.GF3310393@nathanxps13> (raw)
In-Reply-To: <CAFj8pRDKpaFmi1AcAVbdfRso9xaqdQTojL+OidGmNWU+J4yC-g@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<20230726042222.GA3211130@nathanxps13>
<CAFj8pRDKpaFmi1AcAVbdfRso9xaqdQTojL+OidGmNWU+J4yC-g@mail.gmail.com>
On Wed, Jul 26, 2023 at 08:06:37AM +0200, Pavel Stehule wrote:
> st 26. 7. 2023 v 6:22 odesílatel Nathan Bossart <[email protected]>
> napsal:
>> Barring additional feedback, I think this is ready for commit.
>>
>>
> +1
Great. I spent some time on the commit message in v4. I plan to commit
this shortly.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
Attachments:
[text/x-diff] v4-0001-Adjust-extra-lines-generated-by-psql-to-be-valid-.patch (3.5K, ../20230726213925.GF3310393@nathanxps13/2-v4-0001-Adjust-extra-lines-generated-by-psql-to-be-valid-.patch)
download | inline diff:
From 50dbc196d19f4716bc9cb59bd36661d3e4cd299e Mon Sep 17 00:00:00 2001
From: Nathan Bossart <[email protected]>
Date: Wed, 26 Jul 2023 14:35:07 -0700
Subject: [PATCH v4 1/1] Adjust extra lines generated by psql to be valid SQL
comments.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 these decorated
queries into a client. 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, Álvaro Herrera, Andrey Borodin
Discussion: https://postgr.es/m/CACLU5mTFJRJYtbvmZ26txGgmXWQo0hkGhH2o3hEquUPmSbGtBw%40mail.gmail.com
---
src/bin/psql/command.c | 8 ++++----
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);
}
--
2.25.1
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: psql: Could we get "-- " prefixing on the **** QUERY **** outputs? (ECHO_HIDDEN)
In-Reply-To: <20230726213925.GF3310393@nathanxps13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox