A suspicious code in PQconnectPoll()

Поиск
Список
Период
Сортировка
От Matsumura, Ryo
Тема A suspicious code in PQconnectPoll()
Дата
Msg-id 03040DFF97E6E54E88D3BFEE5F5480F74AC1541C@G01JPEXMBYT04
обсуждение исходный текст
Список pgsql-hackers
Hi

I find a suspicious code in libpq:PQconnectPoll(). I think it should be
fixed, but I could not produce a concrete problem.
What do you think about it?

I understand that PQconnectPoll() returns PGRES_POLLING_WRITING or
PGRES_POLLING_READ until state machine reaches terminal state(OK or BAD).
The return value indicates for users which event they should wait for
before next PQconnectPoll().
But PQconnectPoll() calls PQsendQuery("SHOW transaction_read_only")
in CONNECTION_AUTH_OK without returning PGRES_POLLING_WRITING before.


My idea is as following:

case CONNECTION_AWAITING_RESPONSE:
  receive authetication OK, transit state machine to AUTH_OK and
  return PGRES_POLLING_READING.

case CONNECTION_AUTH_OK:
  clear any data from backend using PQisBusy(), transit to
  CHECK_WRITABLE_STARTED(new state!), and return PGRES_POLLING_WRITING.

case CONNECTION_CHECK_WRITABLE_STARTED (new state!):
  call PQsendQuery("SHOW transaction_read_only"), and transit to
  CONNECTION_CHECK_WRITABLE, and return CONNECTION_CHECK_READING.


Regards
Ryo Matsumura



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

Предыдущее
От: Жарков Роман
Дата:
Сообщение: Re: Intermittent pg_ctl failures on Windows
Следующее
От: Michael Paquier
Дата:
Сообщение: Compiler warnings with MinGW