Re: table functions - Mailing list pgsql-general

From Tom Lane
Subject Re: table functions
Date
Msg-id 7701.1039446782@sss.pgh.pa.us
Whole thread Raw
In response to table functions  (Eric B.Ridge <ebr@tcdi.com>)
Responses Re: table functions  (Eric B.Ridge <ebr@tcdi.com>)
List pgsql-general
"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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg 7.3 memory error
Next
From: pginfo
Date:
Subject: Re: pg 7.3 memory error