On Mon, May 15, 2023 at 9:05 PM Kirk Wolak <wol...@gmail.com> wrote:
> On Mon, May 15, 2023 at 10:28 AM Tom Lane <t...@sss.pgh.pa.us> wrote: > >> Alvaro Herrera <alvhe...@alvh.no-ip.org> writes: >> > It's worth considering what will readline history do with the comment. >> > Hmmm... We could put a SPACE before the comment, that usually stops readline from saving it? > >> Meh ... the one after serves to separate a query from its output. >> >> regards, tom lane >> > > > I just tested whether or not you see the trailing comment line. And I > ONLY see it in the windows version of PSQL. > And ONLY if you paste it directly in at the command line. > [Because it sends the text line by line, I assume] > > ,,,With that said, I DEFINITELY Move to Remove the secondary comment. > It's just noise. > and /* */ comments it will be for the topside. > > Here's the patch. I removed touching on .po files. I made the change apply to the logging (fair warning) for consistency. All feedback is welcome. These small patches help me work through the process. Kirk... OUTPUT: /********* QUERY **********/ SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid = i.inhparent AND i.inhrelid = '24577' AND c.relkind != 'p' AND c.relkind != 'I' ORDER BY inhseqno; /********* QUERY **********/ SELECT c.oid::pg_catalog.regclass, c.relkind, inhdetachpending, pg_catalog.pg_get_expr(c.relpartbound, c.oid) FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid = i.inhrelid AND i.inhparent = '24577' ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT', c.oid::pg_catalog.regclass::pg_catalog.text; Table "public.t1" Column | Type | Collation | Nullable | Default --------+--------+-----------+----------+------------------------------ id | bigint | | not null | generated always as identity Indexes: "t1_pkey" PRIMARY KEY, btree (id)
From 31d85797a45e86660266e693d6c23c30b34935cc Mon Sep 17 00:00:00 2001 From: Kirk Wolak <wol...@gmail.com> Date: Wed, 17 May 2023 13:15:57 -0400 Subject: [PATCH] Change output of ECHO_HIDDEN comments to be SQL comments Simply Add the "/" Required before/after the ********* QUERY ********** (SHOW_HIDDEN on) so that they are comments and are ignored if you copy and paste a series of them. Also removed the trailing row of asterisks. When you have more than one query they are just noise. The query ends with an extra \n for spacing. Author: Kirk Wolak <wol...@gmail.com> Reviewed-By: "ok...@github.com" <ok...@github.com> Thread: https://postgr.es/m/caclu5msysc-7waxne0bsrph7qw9bq9dw5m26swmq6x6isd1...@mail.gmail.com --- src/bin/psql/command.c | 10 ++++------ src/bin/psql/common.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 607a57715a..c26b807590 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -5388,16 +5388,14 @@ echo_hidden_command(const char *query) { if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF) { - printf(_("********* QUERY **********\n" - "%s\n" - "**************************\n\n"), query); + printf(_("/********* QUERY **********/\n" + "%s\n\n"), query); fflush(stdout); if (pset.logfile) { fprintf(pset.logfile, - _("********* QUERY **********\n" - "%s\n" - "**************************\n\n"), query); + _("/********* QUERY **********/\n" + "%s\n\n"), query); fflush(pset.logfile); } diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index c0e6e8e6ed..39155ca0d8 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -589,16 +589,14 @@ PSQLexec(const char *query) if (pset.echo_hidden != PSQL_ECHO_HIDDEN_OFF) { - printf(_("********* QUERY **********\n" - "%s\n" - "**************************\n\n"), query); + printf(_("/********* QUERY **********/\n" + "%s\n\n"), query); fflush(stdout); if (pset.logfile) { fprintf(pset.logfile, - _("********* QUERY **********\n" - "%s\n" - "**************************\n\n"), query); + _("/********* QUERY **********/\n" + "%s\n\n"), query); fflush(pset.logfile); } -- 2.34.1