X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4B431D1BBA4 for ; Tue, 23 Sep 2003 16:43:39 +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 19928-02 for ; Tue, 23 Sep 2003 13:43:29 -0300 (ADT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by svr1.postgresql.org (Postfix) with ESMTP id E7FCDD1B8DE for ; Tue, 23 Sep 2003 13:43:27 -0300 (ADT) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 0C5B02B3F3; Tue, 23 Sep 2003 18:43:14 +0200 (CEST) Message-ID: <3F707820.1000100@klaster.net> Date: Tue, 23 Sep 2003 18:43:12 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5a) Gecko/20030718 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Lista dyskusyjna pgsql-sql Subject: Re: pl/pgsql, cursors and C function References: <3F70314C.30507@klaster.net> <16949.1064330109@sss.pgh.pa.us> In-Reply-To: <16949.1064330109@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: 200309/273 X-Sequence-Number: 15251 >>I don't understand ERROR message at all: >> ERROR: SPI_prepare() failed on "SELECT $1 " > > > > This is a bug. Or two bugs, actually: one of yours and one of PG's. > I have repaired the PG bug with the attached patch. The bug in your > code is that your C function needs to call SPI_connect and SPI_finish > if it's going to use any SPI operations. > > regards, tom lane Thanks a lot. The first answer helped me, the second one - the others. Do you know anything about good source of C functions documentation and examples? Currently I'm walking over .h headers to find some useful functions and macros. Regads, Tomasz Myrta