[Bug fix] PQsendQuery occurs error when target_session_attrs is set to read-write

From: "Higuchi, Daisuke" <higuchi(dot)daisuke(at)jp(dot)fujitsu(dot)com>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: [Bug fix] PQsendQuery occurs error when target_session_attrs is set to read-write
Date: 2017-01-31 04:23:49
Message-ID: 1803D792815FC24D871C00D17AE95905AC5FAE@g01jpexmbkw24
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

This this is my first posting to the mailing list.

I am interested in multiple hosts of libpq [1], then I found the bug in this feature.
When I set "target_session_attrs" to "any" and call PQsendQuery, my application is succeeded.
However, when I set "target_session_attrs" to "read-write" and call PQsendQuery, "another command is already in progress" is occurred.
I attached the test application to reproduce this problem.

I think this is because PQgetResult is not called until PQgetResult has returned a null pointer.
So, I attached the patch for fix this.

[1] https://www.postgresql.org/message-id/flat/20150818041850(dot)GA5092(at)wagner(dot)pp(dot)ru#20150818041850(dot)GA5092@wagner.pp.ru

Regards,
Daisuke Higuchi

Attachment Content-Type Size
multiple_hosts_test.c text/plain 1.6 KB
PQsendQuery_for_target_session_attrs_v1.patch application/octet-stream 591 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-01-31 04:26:46 Re: Crash on promotion when recovery.conf is renamed
Previous Message Michael Paquier 2017-01-31 04:21:44 Re: multivariate statistics (v19)