Re: active queries

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Miklosi Attila <amiklosi(at)freemail(dot)hu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: active queries
Date: 2008-05-27 16:59:34
Message-ID: 20080527165934.GC2859@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 27, 2008 at 11:35:49AM +0200, Miklosi Attila wrote:
> Hi!
>
> Our company has a long last problem by using libpq in multi-threaded
> programs. The libpq usually closes the programs without any error
> message or rarely giving the 'Invalid frontend message type 87' error.
> When asked you about this error message you gave the reply below. In the
> reply there is only one thing which is not clear... What does an
> 'active' query mean? Or how can we detect active queries on a PGconn?
> We have tried PQcancel() and PQreset() functions too, but they didn't
> help solving the problem.
> Our programs retrieve every result (PQgetResult() and PQclear()
> functions) that is pending on the server before reusing a PGconn.

The basic rule is: libpq is not reentrant. So you can't have two calls
referring to the same PGConn going at the same time. If you really are
serialising properly then it shouldn't be a problem. Are you doing
things like sending multiple queries in a single PQexec? Or something
else where the server might still be doing stuff?

Have a niec day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Hunter 2008-05-27 17:04:37 Re: Open Source CRM - Options?
Previous Message Joshua D. Drake 2008-05-27 16:58:08 Re: Open Source CRM - Options?