Search Postgresql Archives

Re: question about window function in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dan S <strd911@xxxxxxxxx> writes:
> 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.

Hmm ... why do you feel you need to do that?  The window function's input
should already be sorted according to the window specification.

> 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.

Unsurprising.

> 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.

I don't think there is one :-(.  WindowAgg has a per-input-tuple econtext,
and a per-output-tuple econtext, but what you'd need for this is a
partition-lifespan econtext, which doesn't exist.

It's possible that we could promote the "partcontext" memory context into
a full econtext so as to support this sort of behavior.  But I'd want to
see a reasonably convincing use-case for it.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux