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: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, 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 21:23:00
Message-ID: CACLU5mTw+RX-yhkgHLqEfMXhSk66MnV=_5Ev9McYoGiR-W8jXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, May 17, 2023 at 2:13 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> > You removed the ******** QUERY ******** at the end of the query.
>
> Fixed
Also Fixed Pavel's name.
Also Added Laurenze as a Reviewed By: (not sure, never want to NOT ack
someone)

>
> Also, you'd have to avoid copying-and-pasting the query output
> anyway, so I'm not entirely sold that there's much of
> a usability gain here.
>

My output never contains query output results intermixed. I get a handful
of queries.
Then I get the output of the "\d t1" (Which makes me wonder if I am doing
something wrong,
or there is another use case I should be testing).

I labelled this v2. I also edited the Thread: (I realized I can find the
thread, go to the Whole Thread,
and then include the link to the first item in the thread. I assume that
is what's expected).

Kirk...

psql>
create table t1(id bigint not null primary key generated always as
identity);
\set ECHO_HIDDEN on
\d t1

Generates:
/********* QUERY **********/
... Clipped ...
FROM pg_catalog.pg_publication p
WHERE p.puballtables AND pg_catalog.pg_relation_is_publishable('24577')
ORDER BY 1;
/**************************/

/********* 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"
... End Clip...
-- NOTICE: there is no output between queries using ECHO_HIDDEN

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2023-05-17 21:45:54 Re: Should CSV parsing be stricter about mid-field quotes?
Previous Message Tom Lane 2023-05-17 21:10:48 Re: run pgindent on a regular basis / scripted manner