Re: table functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Eric B(dot)Ridge" <ebr(at)tcdi(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: table functions
Date: 2002-12-09 15:13:02
Message-ID: 7701.1039446782@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Eric B.Ridge" <ebr(at)tcdi(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-12-09 15:17:09 Re: table functions
Previous Message Tom Lane 2002-12-09 14:45:58 Re: pg 7.3 memory error