Re: dynamic result sets support in extended query protocol

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: dynamic result sets support in extended query protocol
Дата
Msg-id 20221221194120.wttku6u7cbd6e574@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: dynamic result sets support in extended query protocol  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Ответы Re: dynamic result sets support in extended query protocol  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
On 2022-Nov-22, Peter Eisentraut wrote:

> I added tests using the new psql \bind command to test this functionality in
> the extended query protocol, which showed that this got broken since I first
> wrote this patch.  This "blame" is on the pipeline mode in libpq patch
> (acb7e4eb6b1c614c68a62fb3a6a5bba1af0a2659).  I need to spend more time on
> this and figure out how to repair it.  In the meantime, here is an updated
> patch set with the current status.

I looked at this a little bit to understand why it fails with \bind.  As
you say, it does interact badly with pipeline mode -- more precisely, it
collides with the queue handling that was added for pipeline.  The
problem is that in extended query mode, we "advance" the queue in
PQgetResult when asyncStatus is READY -- fe-exec.c line 2110 ff.  But
the protocol relies on returning READY when the second RowDescriptor
message is received (fe-protocol3.c line 319), so libpq gets confused
and everything blows up.  libpq needs the queue to stay put until all
the results from that query have been consumed.

If you comment out the pqCommandQueueAdvance() in fe-exec.c line 2124,
your example works correctly and no longer throws a libpq error (but of
course, other things break).

I suppose that in order for this to work, we would have to find another
way to "advance" the queue that doesn't rely on the status being
PGASYNC_READY.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/



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

Предыдущее
От: Nikita Malakhov
Дата:
Сообщение: Re: Array initialisation notation in syscache.c
Следующее
От: Justin Pryzby
Дата:
Сообщение: Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser)