Re: best way to determine start of new statement within - Mailing list pgsql-hackers

From Joe Conway
Subject Re: best way to determine start of new statement within
Date
Msg-id 3F214D42.1040702@joeconway.com
Whole thread Raw
In response to Re: best way to determine start of new statement within a function?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: best way to determine start of new statement within  (elein <elein@varlena.com>)
List pgsql-hackers
Tom Lane wrote:
> Joe Conway <mail@joeconway.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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: flex 2.5.31
Next
From: Bruce Momjian
Date:
Subject: Re: libpq_r