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-17 17:39:12
Message-ID: CACLU5mRhBiYjh-Cq7yvnGUA3VqX44Gh3QFkzmViP4ZNjdiJ7mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 15, 2023 at 9:05 PM Kirk Wolak <wolakk(at)gmail(dot)com> wrote:

> 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.
>>
>
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)

Attachment Content-Type Size
0001-Change-output-of-ECHO_HIDDEN-comments-to-be-SQL-comm.patch text/plain 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-05-17 17:42:08 Re: Should CSV parsing be stricter about mid-field quotes?
Previous Message Alexander Korotkov 2023-05-17 17:30:41 Re: Possible regression setting GUCs on \connect