Re: Unexpected behavior with transition tables in update statement trigger
Tom Kazimiers <tom@voodoo-arts.net>
From: Tom Kazimiers <tom@voodoo-arts.net>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: PG-General Mailing List <pgsql-general@postgresql.org>
Date: 2018-02-26T15:18:07Z
Lists: pgsql-hackers, pgsql-general
Hi Thomas, On Mon, Feb 26, 2018 at 11:15:44PM +1300, Thomas Munro wrote: >On Sat, Feb 24, 2018 at 4:47 PM, Tom Kazimiers <tom@voodoo-arts.net> wrote: >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. Thanks very much for investigating this. I can confirm that applying your patch results in the tuples I expected in both my test trigger and my actual trigger function. It would be great if this or a similar fix would make it into the next official release. Cheers, Tom
Commits
-
Use the correct tuplestore read pointer in a NamedTuplestoreScan.
- e98a4de7d23a 11.0 landed
- b9dac4a6eb41 10.4 landed