psql --echo-queries does not echo all queries
| От | Gavin Wahl | 
|---|---|
| Тема | psql --echo-queries does not echo all queries | 
| Дата | |
| Msg-id | CACPudh2Xf1OSPaFD0tcBMoGAjqyUz_PXCwKWKW4XcAUozsR=4g@mail.gmail.com обсуждение исходный текст  | 
		
| Ответы | 
                	
            		Re: psql --echo-queries does not echo all queries
            		
            		 | 
		
| Список | 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.
		
	В списке pgsql-bugs по дате отправления: