Re: I want to send comments to the backend!

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Gerhard Häring <lists(at)ghaering(dot)de>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: I want to send comments to the backend!
Date: 2003-03-20 18:43:08
Message-ID: 25054.1048185788@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Could we change the backend to return NullCommand() if the query string
> was empty, rather than checking for whitespace directly? I thought the
> whitespace test was there only as a performance hack.

It's not a performance hack; it's a performance loss, because 99.99999%
of the time the strspn test is wasted. Don't tell me that empty queries
are an important case to optimize ;-).

The only reason that code is still there is that old versions of libpq
used to need to see a special NullCommand response when they
deliberately sent empty queries (which IIRC they used to do for NOTIFY
checks, many years ago before the backend would send NOTIFYs
unprompted). I'd prefer to take NullCommand out of the protocol, not
generalize it to understand about comments. Right now seems to be a
fine time to think about this, in fact, given that we're hacking the
protocol anyway.

If we were only dealing with libpq, I think I'd take that code out of
the backend and modify PQexec to produce a PGRES_EMPTY_QUERY on getting
only ReadyForQuery from the backend. I'm not sure whether JDBC or ODBC
might care about NullCommand responses, though --- anyone know?

regards, tom lane

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Bruce Momjian 2003-03-20 18:48:41 Re: I want to send comments to the backend!
Previous Message Bruce Momjian 2003-03-20 18:04:03 Re: I want to send comments to the backend!