Re: psql now shows zero elapsed time after an error
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>, Richard Guo <guofenglinux@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-05-10T13:42:41Z
Lists: pgsql-hackers
Attachments
- psql-timing-update-2.patch (text/x-diff) patch
Hello, Thanks for the catch and the proposed fix! Indeed, on errors the timing is not updated appropriately. ISTM that the best course is to update the elapsed time whenever a result is obtained, so that a sensible value is always available. See attached patch which is a variant of Richard's version. fabien=# SELECT 1 as one \; SELECT 1/0 \; SELECT 2 as two; ┌─────┐ │ one │ ├─────┤ │ 1 │ └─────┘ (1 row) ERROR: division by zero Time: 0,352 ms Probably it would be appropriate to add a test case. I'll propose something later. -- Fabien.
Commits
-
psql: Update \timing also in case of an error
- 9520f8d92a86 15.0 landed