Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

SRF calls not correctly reset on rescan #65

Open
RhodiumToad opened this issue Nov 27, 2017 · 0 comments
Open

SRF calls not correctly reset on rescan #65

RhodiumToad opened this issue Nov 27, 2017 · 0 comments

Comments

@RhodiumToad
Copy link
Member

Given this function:

create function tf2()
  returns setof integer
  language pllua
  as $f$
    for i = 1,4 do coroutine.yield(i) end
$f$;

This query:

select * from generate_series(1,3) i, lateral (select tf2() limit i) s;

gives this result

 i | tf2 
---+-----
 1 |   1
 2 |   2
 2 |   3
 3 |   4
(4 rows)

when it should give this result:

 i | tf2 
---+-----
 1 |   1
 2 |   1
 2 |   2
 3 |   1
 3 |   2
 3 |   3
(6 rows)

The problem is that the SRF call isn't being shut down on a rescan of the enclosing exprcontext, because it didn't register a callback to do so (the standard SRF_* utility macros do it, but pllua doesn't use these).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant