Re: [HACKERS] [Bug fix] PQsendQuery occurs error whentarget_session_attrs is set to read-write

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [HACKERS] [Bug fix] PQsendQuery occurs error whentarget_session_attrs is set to read-write
Дата
Msg-id CAB7nPqQk7F+bJEa983tVdfjBSqwaXQNgx0O_Lz69Gvxe67D+-w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] [Bug fix] PQsendQuery occurs error whentarget_session_attrs is set to read-write  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Ответы Re: [HACKERS] [Bug fix] PQsendQuery occurs error whentarget_session_attrs is set to read-write  ("Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com>)
Список pgsql-hackers
On Thu, Feb 2, 2017 at 1:34 PM, Ashutosh Bapat
<ashutosh.bapat@enterprisedb.com> wrote:
> On Thu, Feb 2, 2017 at 10:04 AM, Ashutosh Bapat
> <ashutosh.bapat@enterprisedb.com> wrote:
>> [1] https://www.postgresql.org/docs/devel/static/libpq-exec.html: PQgetvalue().
> The code expects that there will be two PQgetResult() calls required.
> One to fetch the result of SHOW command and the other to extract NULL.
> If we require more calls or unexpected results, we should throw and
> error. The patch just checks the first result and consumes the
> remaining without verifying them. Also, it looks like we can not clear
> result of PQgetResult() before using the values or copying them
> somewhere else [1]. Here's updated patch which tries to do that.
> Please let me know if this looks good to you.

This has not been added yet to the next CF. As Ashutosh mentioned
things tend to be easily forgotten. So I have added it here:
https://commitfest.postgresql.org/13/982/

I have noticed this typo on the way => s/requisted/requested/:
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -2908,7 +2908,7 @@ keep_going:                       /* We will
come back to here until there is           }
           /*
-            * If a read-write connection is requisted check for same.
+            * If a read-write connection is requested check for same.            */           if
(conn->target_session_attrs!= NULL &&               strcmp(conn->target_session_attrs, "read-write") == 0)
 

Looking at the patch, I agree with Ashutosh. Any fix should be located
in the code path of CONNECTION_CHECK_WRITABLE which is the one
consuming the results.
-- 
Michael



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] Enabling replication connections by default inpg_hba.conf
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] Should `pg_upgrade --check` check relation filenodesare present?