Re: [SQL] pl/pgsql, cursors and C function

2003-09-23 Thread Tom Lane
Tomasz Myrta <[EMAIL PROTECTED]> writes: > Do you know anything about good source of C functions documentation and > examples? Look in the main sources (backend/utils/adt/, mostly) and/or contrib modules for functions that do something like what you need. The only difference between a builtin fu

Re: [SQL] pl/pgsql, cursors and C function

2003-09-23 Thread Tomasz Myrta
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_fin

Re: [SQL] pl/pgsql, cursors and C function

2003-09-23 Thread Tom Lane
Tomasz Myrta <[EMAIL PROTECTED]> writes: > 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 func

[SQL] pl/pgsql, cursors and C function

2003-09-23 Thread Tomasz Myrta
Hi I'm making my first steps in C functions. I want to avoid doing all the SQL job in them, pl/pgsql looks a better choice. I tried to do this by passing opened cursor from pl/pgsql function to C function. Here is simple C function: #include #include PG_FUNCTION_INFO_V1(test2); Datum test2(PG_