Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOmER-008uYC-A4 for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Jul 2023 21:39:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qOmEP-006P1z-BE for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Jul 2023 21:39:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOmEP-006P1r-1S for pgsql-hackers@lists.postgresql.org; Wed, 26 Jul 2023 21:39:41 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qOmED-000YIc-Ln for pgsql-hackers@lists.postgresql.org; Wed, 26 Jul 2023 21:39:40 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1b89cfb4571so2066855ad.3 for ; Wed, 26 Jul 2023 14:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690407567; x=1691012367; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=zp6Yf0l/r+Zi93+KuxBSKqcTtqC4Qd0fmJJoJm3eDEc=; b=stz7lRs50ukE2EZG2GXIHqURZ8bYerQh0FsjAuTHkhn1hgZ9c6KEBT+Ui+P1ofdx3j hjQAKVJ7CbMSIOPDaoRXem3Y1EnCsfh8wSC6pYb65e9IlhA4lmwDEiVFJ+kYyZydGmPW tWAUg2tSUMjPRuk7SVMMseMxfukRRkydQun5gEs1ApSBta8SJS+ahcV3NOqd/Z7NL1q0 0PxjVRFtDUqZen1tNcEDGoBJC/45uspJJTSIKpnY9T+4hx99Pr5vWFFZp/q+y3WHQwwA UJe8LyvNByymALf2v7bd0K9oU864uWh9JdjL27t5sn7T0F3/smRNOooL0+4cKEcSCXIm Nk1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690407567; x=1691012367; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zp6Yf0l/r+Zi93+KuxBSKqcTtqC4Qd0fmJJoJm3eDEc=; b=XajQ+drNsJ7p7IHlohh0BUSFM9LBZpEVsE/XpehBLaqzq3ysjJXIqHklmXotoqTD+u lLh4vmxJchLIL2WfTKcEXV94pxDLnNd+AyE+Vm3/zkJljSL5vXMRMd9iFVMsHqDj6b6W Jl3S1zNJYtrVX1FGKiGPCW5puA2qGV5CgAK8bjVOQtmzemP0QbTh74dYY5UQDbGTTeZh tnbR2eDJY4ncJMw7oG4ykhJ0nBEWTTSb+Vwa1WTLQlLNkjcY+lViMtQweVj9PfPn/vtK bePEN5GWq9Db/oSZv6J2ZGvDy4S9kCotahl9zigYmPr/qq+OJWIvzGZh0lMCSZT7JZDC 7e5w== X-Gm-Message-State: ABy/qLY/BOS38OHHJMCl+KJrsCemZkPdKu5ex7Ql8pYr9PUKrKuB+xM2 0pkeu/ABtkgHTOHwpTTUhtU= X-Google-Smtp-Source: APBJJlH9A9lkEkqR4KUbmSux4gg1iGkFN5dnInJrsiM6tWGMPa8iyvnQv8cpvUZfvjqVaP2vLiFbJA== X-Received: by 2002:a17:902:ba8c:b0:1aa:d971:4623 with SMTP id k12-20020a170902ba8c00b001aad9714623mr2932151pls.38.1690407567394; Wed, 26 Jul 2023 14:39:27 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id 19-20020a170902c15300b001b8307c81c8sm17775plj.121.2023.07.26.14.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 14:39:26 -0700 (PDT) Date: Wed, 26 Jul 2023 14:39:25 -0700 From: Nathan Bossart To: Pavel Stehule Cc: Alvaro Herrera , "Andrey M. Borodin" , Kirk Wolak , Tom Lane , Laurenz Albe , PostgreSQL Hackers Subject: Re: psql: Could we get "-- " prefixing on the **** QUERY **** outputs? (ECHO_HIDDEN) Message-ID: <20230726213925.GF3310393@nathanxps13> References: <20230519171616.snpyqyf7lxilteoa@alvherre.pgsql> <20230726042222.GA3211130@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Wed, Jul 26, 2023 at 08:06:37AM +0200, Pavel Stehule wrote: > st 26. 7. 2023 v 6:22 odesílatel Nathan Bossart > 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 --UlVJffcvxoiEqYs2 Content-Type: text/x-diff; charset=iso-8859-1 Content-Disposition: attachment; filename="v4-0001-Adjust-extra-lines-generated-by-psql-to-be-valid-.patch" Content-Transfer-Encoding: 8bit From 50dbc196d19f4716bc9cb59bd36661d3e4cd299e Mon Sep 17 00:00:00 2001 From: Nathan Bossart 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 --UlVJffcvxoiEqYs2--