Craig Brozefsky <craig@red-bean.com> writes:
> We have two situations that have arisen while using libpq thru CMUCL
> bindings in our UncommonSQL package. We have a multi-processing
> application which uses a pool of database connections to perform DB
> queries.
> The first one is that we are getting unexpected retun values from
> pgresultstatus after calling pgexec, a value of PGRES_TUPLES_OK. The
> thing is that we're not sending a SELECT, just UPDATES, INSERTS and
> DELETES. My understanding is that none of those return tuples.
They don't. I think you must have some kind of multithreading bug
on the client side (whether it's in libpq or your code is hard to say).
A quick look at libpq's source shows that it can only generate
PGRES_TUPLES_OK after seeing a 'T' (row descriptor) message from the
backend, and the backend will surely not send such a thing except for
SELECT or FETCH.
> Also, unrelated, I think, to the above issue, we are getting the
> following message intermittently:
> Backend message type 0x50 arrived while idle
That would be a 'P' (CursorResponse) message, which is a normal (if
not very useful) part of the query cycle. Something's definitely
out of sync in the frontend/backend protocol, it seems. You might
find it helpful to read
http://www.postgresql.org/devel-corner/docs/postgres/protocol.htm
regards, tom lane