| From: | Gavin Wahl <gavinwahl(at)gmail(dot)com> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | psql --echo-queries does not echo all queries |
| Date: | 2025-10-24 18:16:57 |
| Message-ID: | CACPudh2Xf1OSPaFD0tcBMoGAjqyUz_PXCwKWKW4XcAUozsR=4g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
The -e/--echo-queries psql option is documented to "Copy all SQL
commands sent to the server to standard output as well." However, it
does not show queries sent to the server by -1/--single-transaction or
by ON_ERROR_ROLLBACK.
For example:
$ psql -e -1 -c 'SELECT 1'
SELECT 1
?column?
----------
1
(1 row)
While the server log reports:
2025-10-24 12:01:57.937 MDT [1970796] LOG: duration: 0.035 ms statement: BEGIN
2025-10-24 12:01:57.937 MDT [1970796] LOG: duration: 0.085 ms
statement: SELECT 1
2025-10-24 12:01:57.937 MDT [1970796] LOG: duration: 0.004 ms
statement: COMMIT
The BEGIN/END are not reported by psql.
$ psql -e -v ON_ERROR_ROLLBACK=on
psql (16.9)
Type "help" for help.
# BEGIN;
BEGIN;
BEGIN
# SELECT 1;
SELECT 1;
?column?
----------
1
(1 row)
While the server log reports:
2025-10-24 12:12:21.517 MDT [1974726] LOG: duration: 0.077 ms
statement: BEGIN;
2025-10-24 12:12:25.757 MDT [1974726] LOG: duration: 0.048 ms
statement: SAVEPOINT pg_psql_temporary_savepoint
2025-10-24 12:12:25.757 MDT [1974726] LOG: duration: 0.156 ms
statement: SELECT 1;
2025-10-24 12:12:25.757 MDT [1974726] LOG: duration: 0.012 ms
statement: RELEASE pg_psql_temporary_savepoint
The savepoints are not reported by psql.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2025-10-24 22:26:01 | Re: BUG #19042: Option --help not recognized at the end of command line in pg_restore |
| Previous Message | Euler Taveira | 2025-10-24 15:11:22 | Re: BUG #19093: Behavioral change in walreceiver termination between PostgreSQL 14.17 and 14.18 |