-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable nonblocking mode while large object calls
libpq's "lo_*" calls fail when a bigger amount of data is transferred and the connection is set to nonblocking mode. According to some discussion here https://www.postgresql.org/message-id/20130606.082048.998330612674120762.t-ishii%40sraoss.co.jp the large object interface isn't intended to be used with nonblocking mode. It works to some extend with small data (< 8000 Bytes), but fails after lo_write of bigger data at the next exec call on the same connection like so: ``` message type 0x56 arrived from server while idle message type 0x5a arrived from server while idle message type 0x43 arrived from server while idle message type 0x5a arrived from server while idle PG::UnableToSend: unexpected response from server; first received character was "V" ``` I think the best solution is to disable nonblocking mode for the time of the lo_* call. Calling PQisnonblocking and PQsetnonblocking is very low overhead, since these functions do a few memory operations only. Fixes #460
- Loading branch information
Showing
2 changed files
with
108 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters