Re: trailing comment ghost-timing

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: trailing comment ghost-timing
Date: 2013-12-24 02:40:58
Message-ID: 52B8F43A.4050504@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/24/2013 03:17 AM, David Johnston wrote:
> I need to be convinced that the server should not just silently ignore
> trailing comments. I'd consider an exception if the only text sent is a
> comment ( in such a case we should throw an error ) but if valid commands
> are sent and there is just some comment text at the end it should be ignored
> the same as if the comments were embedded in the middle of the query text.
>
> I've encountered other clients that output phantom results in this situation
> and solving it at the server seems worthwhile so client applications do not
> have to care.
>
> In the example case, I think, putting the comment before the command results
> in only one timing. This inconsistency is a symptom of this situation being
> handled incorrectly.

It is not sent to the server as a trailing comment. The following file
is sent to the server like this.

File:
/**/;
/**/

Commands:
PQexec(..., "/**/;");
PQexec(..., "/**/");

If this has to be fixed it should be in the client. I think people would
complain if we broke the API by starting to throw an exception on PQexec
with a string containing no actual query.

--
Andreas Karlsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2013-12-24 02:44:53 Re: Planning time in explain/explain analyze
Previous Message Tom Lane 2013-12-24 02:33:04 Re: Planning time in explain/explain analyze