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@xxxxxxxxxxxxxxx> 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