Hi !
I'm trying to write a window function in C .Now when I'm running the function I get this: 'WARNING: temporary file leak: File 43 still referenced'
The warning comes from my failure to call tuplesort_end at the appropriate time.
>From the beginning I thought that calling tuplesort_end when current_pos in the window approched WinGetPartitionRowCount would do it.
So I think I need to use some callback mechanism to get that to work.
I've found some reference in the postgres source code to RegisterExprContextCallback which seemed promising but I have no idea how to get the right _expression_ context to put in as the first argument to that function.
So my question is, how do I shut down the tuplesort properly after the last call to my window function ?
I'm running "PostgreSQL 9.3.5 on i686-pc-linux-gnu, compiled by gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 32-bit"
Best Regards
Dan S