Re: [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: 'Ashutosh Bapat' <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [Bug fix] PQsendQuery occurs error when target_session_attrs is set to read-write
Date: 2017-02-02 02:41:04
Message-ID: 1803D792815FC24D871C00D17AE95905AC945B@g01jpexmbkw24
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: Ashutosh Bapat [mailto:ashutosh(dot)bapat(at)enterprisedb(dot)com]
> Per the documentation [1], "PQgetResult must be called repeatedly
> until it returns a null pointer, indicating that the command is
> done.". The code in PQgetResult() under CONNECTION_CHECK_WRITABLE
> case, violates that. The patch fixes it. The patch however jumps to
> keep_going without changing conn->status, which means that it will end
> up again in the same case. While that's fine, may be we should use a
> local loop on PQgetResult() to keep the code readable.
Thank you for reviewing the patch.
I created it with reference to pqSetenvPoll() in interfaces/libpq/fe-protocol2.c,
but I certainly thought that readability is not good.
I updated the patch, so I will add this to the next commitfest.

Regards,
Daisuke, Higuchi

Attachment Content-Type Size
PQsendQuery_for_target_session_attrs_v2.patch application/octet-stream 931 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2017-02-02 02:47:05 Re: Time to up bgwriter_lru_maxpages?
Previous Message Kyotaro HORIGUCHI 2017-02-02 02:28:29 Re: [HACKERS] Bug in Physical Replication Slots (at least 9.5)?