From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ian Pye <ianpye(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Stateful pointers in set-returning functions |
Date: | 2012-05-24 18:21:50 |
Message-ID: | 27186.1337883710@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Ian Pye <ianpye(at)gmail(dot)com> writes:
> I'm writing a set-returning function which places a file handle into
> PG's FuncCallContext's user_fctx space. My problem is that when the
> function is ran with a limit clause (SELECT * FROM foo() LIMIT 10) the
> server will stop calling the function automatically, not giving me a
> chance to close the file handle. Is there a way to get the limit value
> inside of foo() and set the max max_calls parameter correctly?
No, and even if there were, this would be a very unsafe practice,
since errors or other issues could result in early termination of the
query.
You would likely be better off using tuplestore return mode so that you
can do all the reading during one call and not have to assume that
you'll get control back again.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2012-05-24 18:22:25 | Re: Changing the concept of a DATABASE |
Previous Message | Sergey Koposov | 2012-05-24 18:19:51 | Re: 9.2beta1, parallel queries, ReleasePredicateLocks, CheckForSerializableConflictIn in the oprofile |