X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6BF9CD1C927 for ; Fri, 25 Jul 2003 15:34:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 49128-06 for ; Fri, 25 Jul 2003 12:33:15 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 002F6D1C922 for ; Fri, 25 Jul 2003 12:34:01 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 14407; Fri, 25 Jul 2003 07:58:00 -0700 Message-ID: <3F214D42.1040702@joeconway.com> Date: Fri, 25 Jul 2003 08:31:14 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: "Hackers (PostgreSQL)" Subject: Re: best way to determine start of new statement within References: <3F206EB3.9010904@joeconway.com> <5630.1059108791@sss.pgh.pa.us> In-Reply-To: <5630.1059108791@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/793 X-Sequence-Number: 41398 Tom Lane wrote: > Joe Conway 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