libpq sendQuery -- getResult not returning until all queries complete - Mailing list pgsql-general

From Kelly Burkhart
Subject libpq sendQuery -- getResult not returning until all queries complete
Date
Msg-id AANLkTik4zFQsB+iZyi-h95qpeBHJ+Qe0kFO9xaHU+A-e@mail.gmail.com
Whole thread Raw
Responses Re: libpq sendQuery -- getResult not returning until all queries complete  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
List pgsql-general
Hello, I'm sending a group of queries to the database with PQsendQuery
and using PQgetResult to return results similar to this:

PQsendQuery( "select current_timestamp; select pg_sleep(1); select
current_timestamp" );

while( result = PQgetResult() )
    doSomethingWith( result )

I'm finding that PQgetResult() will not return the first result until
all three results are ready.  In real life I would be sending
consequential queries and would like the front end to be processing
one result while the backend is producing the next one.  The
documentation for PQgetResult in section 30.4 of the 8.4.5 manual
suggests that this is what should happen.

Can anyone explain if sendQuery/getResult is intended to work as
documented?  And if so what my problem may be?  (perhaps my pg_sleep
is preventing the first result from being written?)

Thanks,

-Kelly

pgsql-general by date:

Previous
From: Richard Broersma
Date:
Subject: Re: Constraining overlapping date ranges
Next
From: Tomas Vondra
Date:
Subject: Re: Can the query planner create indexes?