Re: trailing comment ghost-timing - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: trailing comment ghost-timing
Date
Msg-id 52B8E4B4.4050001@proxel.se
Whole thread Raw
In response to trailing comment ghost-timing  ("Erik Rijkers" <er@xs4all.nl>)
Responses Re: trailing comment ghost-timing
List pgsql-hackers
On 12/24/2013 02:05 AM, Erik Rijkers wrote:
> With \timing on, a trailing comment yields a timing.
>
> # test.sql
> select 1;
>
> /*
> select 2
> */
>
> $ psql -f test.sql
>   ?column?
> ----------
>          1
> (1 row)
>
> Time: 0.651 ms
> Time: 0.089 ms
>
> I assume it is timing something about that comment (right?).
>
> Confusing and annoying, IMHO.  Is there any chance such trailing ghost-timings can be removed?

This seems to be caused by psql sending the comment to the server to 
evaluate as a query. I personally think timing should always output 
something for every command sent to the server. To fix this problem I 
guess one would have to modify psql_scan() to check if a scanned query 
only contains comments and then not send it to the server at all.

The minimal file to reproduce it is:

/**/

-- 
Andreas Karlsson



pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Planning time in explain/explain analyze
Next
From: Andreas Karlsson
Date:
Subject: Re: PoC: Partial sort