Re: consequent PQsendQueryPrepared() failed: another command is already in progress - Mailing list pgsql-general

From Tom Lane
Subject Re: consequent PQsendQueryPrepared() failed: another command is already in progress
Date
Msg-id 6768.1276699160@sss.pgh.pa.us
Whole thread Raw
In response to consequent PQsendQueryPrepared() failed: another command is already in progress  (Anton Maksimenkov <anton200@gmail.com>)
Responses Re: consequent PQsendQueryPrepared() failed: another command is already in progress  (Anton Maksimenkov <anton200@gmail.com>)
List pgsql-general
Anton Maksimenkov <anton200@gmail.com> writes:
> I'm using libpq C Library. I prepared some query and trying to call it
> many times.
> But it success only at first time, and then fail with error:
> ... "another command is already in progress"
> [ PQsendQuery followed by just one PQgetResult ]

IIRC, you need to keep calling PQgetResult until it returns NULL
before the connection is considered cleared and ready for another query.
In this example you should get a NULL on the very next call, but
you didn't make that call.

            regards, tom lane

pgsql-general by date:

Previous
From: Stephen Frost
Date:
Subject: Re: GSS Authentication
Next
From: sunpeng
Date:
Subject: hi,i write a function in postgresql source code, how to register this function?