Re: psql now shows zero elapsed time after an error

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql now shows zero elapsed time after an error
Date: 2022-05-23 08:13:40
Message-ID: 31e904d3-59d8-1052-967e-f38f752dca12@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10.05.22 15:42, Fabien COELHO wrote:
>
> 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.

committed with a test

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chirag Karkera 2022-05-23 08:16:29 Use Dblink without column defination
Previous Message Michael Paquier 2022-05-23 07:29:50 Re: Add --{no-,}bypassrls flags to createuser