Re: Pipeline mode and PQpipelineSync()
Alvaro Herrera <alvaro.herrera@2ndquadrant.com>
From: Alvaro Herrera <alvaro.herrera@2ndquadrant.com>
To: Boris Kolpackov <boris@codesynthesis.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2021-06-24T15:54:50Z
Lists: pgsql-hackers
On 2021-Jun-23, Boris Kolpackov wrote: > If, however, I execute it by checking for results before sending the > next INSERT, I get the following call sequence: > > PQsendQueryPrepared() # INSERT #1 > PQflush() > PQsendQueryPrepared() # INSERT #2 > PQflush() > ... > PQsendQueryPrepared() # INSERT #~400 > PQflush() > PQconsumeInput() # At this point select() indicates we can read. > PQgetResult() # NULL (???) > PQgetResult() # INSERT #1 > PQgetResult() # NULL > PQgetResult() # INSERT #2 > PQgetResult() # NULL > ... > > > What's strange here is that the first PQgetResult() call (marked with ???) > returns NULL instead of result for INSERT #1 as in the first call sequence. > Interestingly, if I skip it, the rest seems to progress as expected. Yeah, I agree that there's a problem in the libpq state machine. I'm looking into it now. -- Álvaro Herrera 39°49'30"S 73°17'W
Commits
-
libpq: Fix sending queries in pipeline aborted state
- ab0967942900 15.0 landed
- 1beaa654da61 14.0 landed
-
Fix libpq state machine in pipeline mode
- b71a9cb31e46 15.0 landed
- 690339fcd587 14.0 landed
-
Add PQsendFlushRequest to libpq
- a7192326c74d 15.0 landed
- 69cf1d5429d4 14.0 landed