Re: psql: Could we get "-- " prefixing on the **** QUERY **** outputs? (ECHO_HIDDEN)

From: Kirk Wolak <wolakk(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql: Could we get "-- " prefixing on the **** QUERY **** outputs? (ECHO_HIDDEN)
Date: 2023-05-16 01:05:19
Message-ID: CACLU5mSYSC-7waxNE0bsrph7QW9Bq9Dw5M26swmQ6x6iSd1tdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 15, 2023 at 10:28 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > It's worth considering what will readline history do with the comment.
> > As I recall, we keep /* comments */ together with the query that
> > follows, but the -- comments are keep in a separate history entry.
> > So that's one more reason to prefer /* */
>
> Good point.
>
> > (To me, that also suggests to remove the asterisk line after each query,
> > and to keep just the one before.)
>
> Meh ... the one after serves to separate a query from its output.
>
> regards, tom lane
>

Actually, I love the feedback!

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]

Further Testing:

calling with: psql -f -- no output of the comments (or the query is seen)
-- Windows/Linux

with \e editing... In Linux nothing is displayed from the query!

with \e editing in Windows... I found it buggy when I tossed in (\pset
pager 0) as the first line. It blew everything up (LOL)
\pset: extra argument "attcollation," ignored
\pset: extra argument "a.attidentity," ignored
\pset: extra argument "a.attgenerated" ignored
\pset: extra argument "FROM" ignored
\pset: extra argument "pg_catalog.pg_attribute" ignored

With that said, I DEFINITELY Move to Remove the secondary comment. It's
just noise.
and /* */ comments it will be for the topside.

Also, I will take a quick peek at the parse failure that is in windows \e
[Which always does this weird doubling of lines]. But no promises here.
It will be good enough to identify the problem.

Kirk...

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirk Wolak 2023-05-16 01:26:16 Re: Adding SHOW CREATE TABLE
Previous Message Andres Freund 2023-05-16 01:01:02 Re: Introduce WAIT_EVENT_EXTENSION and WAIT_EVENT_BUFFER_PIN