From: | Dan S <strd911(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | question about window function in C |
Date: | 2014-12-26 16:41:30 |
Message-ID: | CAPpdapcmuKbb20GSXKfBSVgNc-pZJJaMFBqNcRPumfLT8v50Tg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi !
I'm trying to write a window function in C .
In the function I'm using a tuplesort to sort the window data and then do
some processing.
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.
That seemed to work at first but when I put a limit-clause in the query
that doesn't work.
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-12-26 17:57:34 | Re: question about window function in C |
Previous Message | Adrian Klaver | 2014-12-26 16:27:33 | Re: Check constraint on foreign table using SQL function |