| From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Guo <guofenglinux(at)gmail(dot)com> |
| Cc: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: psql now shows zero elapsed time after an error |
| Date: | 2022-05-10 13:42:41 |
| Message-ID: | alpine.DEB.2.22.394.2205101526240.1550767@pseudo |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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.
| Attachment | Content-Type | Size |
|---|---|---|
| psql-timing-update-2.patch | text/x-diff | 1.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Bapat | 2022-05-10 13:47:35 | Re: Allowing REINDEX to have an optional name |
| Previous Message | Ashutosh Bapat | 2022-05-10 13:19:54 | Re: Proposal: add a debug message about using geqo |