On Tue, Dec 24, 2013 at 5:53 AM, Martijn van Oosterhout <klep...@svana.org> wrote: > > On Tue, Dec 24, 2013 at 03:40:58AM +0100, Andreas Karlsson wrote: > > On 12/24/2013 03:17 AM, David Johnston wrote: > > 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. > > (Untested). Isn't this just a case of psql not printing out a timing if > the server responds with PGRES_EMPTY_QUERY? >
Works... look to the attached patch! Regards, -- Fabrízio de Royes Mello Consultoria/Coaching PostgreSQL >> Timbira: http://www.timbira.com.br >> Blog sobre TI: http://fabriziomello.blogspot.com >> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello >> Twitter: http://twitter.com/fabriziomello
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index bbdafab..7320f31 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1023,12 +1023,12 @@ SendQuery(const char *query) } } - PQclear(results); - /* Possible microtiming output */ - if (pset.timing) + if (pset.timing && PQresultStatus(results) != PGRES_EMPTY_QUERY) printf(_("Time: %.3f ms\n"), elapsed_msec); + PQclear(results); + /* check for events that may occur during query execution */ if (pset.encoding != PQclientEncoding(pset.db) &&
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers