Hi # I rewrote my previous mail.
PQconnectPoll() is used as method for asynchronous using externally or internally. If a caller confirms a socket ready for writing or reading that is requested by return value of previous PQconnectPoll(), next PQconnectPoll() must not be blocked. But if the caller specifies target_session_attrs to 'read-write', PQconnectPoll() may be blocked. Detail: If target_session_attrs is set to read-write, PQconnectPoll() calls PQsendQuery("SHOW transaction_read_only") althogh previous return value was PGRES_POLLING_READING not WRITING. In result, PQsendQuery() may be blocked in pqsecure_raw_write(). I attach a patch. Regards Ryo Matsumura
libpq_state_change_bugfix.ver1.0.patch
Description: libpq_state_change_bugfix.ver1.0.patch