Re: Using PQexecQuery in pipeline mode produces unexpected Close messages

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: Using PQexecQuery in pipeline mode produces unexpected Close messages
Дата
Msg-id 20220610.152544.1597540405935332165.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответы Re: Using PQexecQuery in pipeline mode produces unexpected Close messages  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Re: Using PQexecQuery in pipeline mode produces unexpected Close messages  (Álvaro Herrera <alvherre@alvh.no-ip.org>)
Re: Using PQexecQuery in pipeline mode produces unexpected Close messages  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
(Moved to -hackers)

At Wed, 8 Jun 2022 17:08:47 +0200, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote in 
> What that Close message is doing is closing the unnamed portal, which
> is otherwise closed implicitly when the next one is opened.  That's how
> single-query mode works: if you run a single portal, it'll be kept open.
> 
> I believe that the right fix is to not send that Close message in
> PQsendQuery.

Agreed. At least Close message in that context is useless and
PQsendQueryGuts doesn't send it. And removes the Close message surely
fixes the issue.

The doc [1] says:

[1] https://www.postgresql.org/docs/14/protocol-flow.html

> The simple Query message is approximately equivalent to the series
> Parse, Bind, portal Describe, Execute, Close, Sync, using the
> unnamed prepared statement and portal objects and no parameters. One

The current implement of PQsendQueryInternal looks like the result of
a misunderstanding of the doc.  In the regression tests, that path is
excercised only for an error case, where no CloseComplete comes.

The attached adds a test for the normal-path of pipelined
PQsendQuery() to simple_pipeline test then modifies that function not
to send Close message. Without the fix, the test fails by "unexpected
notice" even if the trace matches the "expected" content.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Вложения

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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: Collation version tracking for macOS
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Support logical replication of DDLs