"Eric B.Ridge" <ebr@tcdi.com> writes:
> Is it possible for me to get the FROM, WHERE, and AS ... clauses from
> within my table function code?
AS: yes, as Joe already mentioned.
FROM/WHERE: No, and I think it would be quite inappropriate for the
function's behavior to depend on any such info. To work correctly,
you'd need to encode virtually a complete understanding of SQL into your
function --- consider cases like outer joins or grouping that intervene
between your function call and the FROM/WHERE clauses. And those are
just the simpler cases.
> Also, in psql, if I press ^C while a table function is executing, the
> function doesn't actually stop, but psql does say "Cancel request
> sent". What processes this request? How do I tell postgres that I
> want to be notified too?
You can throw a
CHECK_FOR_INTERRUPTS();
into your main loop whereever it seems safe to be killed by an
interrupt.
regards, tom lane