Re: psql --echo-queries does not echo all queries

From: Gavin Wahl <gavinwahl(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: psql --echo-queries does not echo all queries
Date: 2025-10-27 22:24:32
Message-ID: CACPudh0VOsmkbYW2EdqmHt_ZoAVWCKiVhQZDYS=ZR5LSMrWCOA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I tried with -E and it does echo the BEGIN/END used to implement
-1/--single-transaction, but not the SAVEPOINT queries for
ON_ERROR_ROLLBACK. It looks like SendQuery is calling PQexec directly
instead of calling the PSQLexec wrapper function that does the
logging. I happened to notice that the queries emitted by \watch, nor
the BEGIN for autocommit, aren't logged by either option as well.

I think this may be a documentation bug as well? I would expect -e to
be a superset of -E:

-E
--echo-hidden
Echo the actual queries generated by \d and other backslash commands.

-e
--echo-queries
Copy *ALL* [emphasis mine] SQL commands sent to the server to
standard output as well

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Guo 2025-10-28 00:58:50 Re: [EXTERNAL]Re: BUG #19094: select statement on postgres 17 vs postgres 18 is returning different/duplicate results
Previous Message Nathan Bossart 2025-10-27 21:21:08 Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore