Re: best way to determine start of new statement within

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: best way to determine start of new statement within
Date: 2003-07-25 15:31:14
Message-ID: 3F214D42.1040702@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>>Specifically I'd like to reset a variable within my PL/R interpreter
>>each time a new SQL statement begins.
>
> Define "new SQL statement". In particular, what of a PL function
> executing multiple SQL statements inside an outer SQL statement that
> invoked the function? Unless you've got a clear idea of the semantics
> you want, it's not going to be very profitable to discuss
> implementations ...
>

Well, I guess in a situation like this:
a) SELECT * FROM myfunc1()...
where myfunc1() executes via spi
b) SELECT * FROM myfunc2()...

I'd be interested in being able to detect when outer statement (a)
starts, as well as the fact that it is at nesting level 0. And similarly
it would be nice to be able to detect when statement (b) starts along
with the fact that it is at nesting level 1. But for the moment, I'd be
happy with just the former.

Joe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-07-25 15:35:54 Re: libpq_r
Previous Message greg 2003-07-25 15:12:13 Re: Datetime patch