Re: Unexpected behavior with transition tables in update statement trigger

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Unexpected behavior with transition tables in update statement trigger
Дата
Msg-id CAEepm=3di-ptmkz5UmF=-VW65k3SPGMB8FaaDNkKokc0XQDtAw@mail.gmail.com
обсуждение исходный текст
Ответ на Unexpected behavior with transition tables in update statementtrigger  (Tom Kazimiers <tom@voodoo-arts.net>)
Ответы Re: Unexpected behavior with transition tables in update statementtrigger  (Tom Kazimiers <tom@voodoo-arts.net>)
Список pgsql-general
On Sat, Feb 24, 2018 at 4:47 PM, Tom Kazimiers <tom@voodoo-arts.net> wrote:
> I am on Postgres 10.2 and try to get a statement level trigger to work that
> is executed after UPDATE statements on a particular table. This trigger
> references both the old and new transition table and for some reason I am
> unable to reference each transition table multiple times in a CTE or
> subquery. E.g. forming a UNION ALL with all rows of the new transition table
> with itself, does only use the new table row once. I don't understand why
> and would appreciate some insight.

Thanks for the reproducer.  Yeah, that seems to be a bug.
nodeNamedTuplestorescan.c allocates a new read pointer for each
separate scan of the named tuplestore, but it doesn't call
tuplestore_select_read_pointer() so that the two scans that appear in
your UNION ALL plan are sharing the same read pointer.  At first
glance the attached seems to fix the problem, but I'll need to look
more carefully tomorrow.

-- 
Thomas Munro
http://www.enterprisedb.com

Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: is libpq and openssl 1.1.* compatible?
Следующее
От: Łukasz Jarych
Дата:
Сообщение: Creating complex track changes database - challenge!