Re: [GENERAL] Version 1 Calling convention

2006-08-30 Thread Martijn van Oosterhout
On Wed, Aug 30, 2006 at 06:05:18AM -0400, Jasbinder Bali wrote: > Does that mean if I am passing a char value to the version 1 function from a > function in the database then in the version 1 function it needs to be > treated as text*?? It depends on what type you're passing: char-> PG_GETARG

Re: [GENERAL] Version 1 Calling convention

2006-08-30 Thread Jasbinder Bali
Does that mean if I am passing a char value to the version 1 function from a function in the database then in the version 1 function it needs to be treated as text*??On 8/30/06, Martijn van Oosterhout wrote: On Wed, Aug 30, 2006 at 05:38:34AM -0400, Jasbinder Bali wrote:> PG_FU

Re: [GENERAL] Version 1 Calling convention

2006-08-30 Thread Martijn van Oosterhout
On Wed, Aug 30, 2006 at 05:38:34AM -0400, Jasbinder Bali wrote: > PG_FUNCTION_INFO_V1 (test); > > char *raw_rawemail1 = PG_GETARG_CHAR_P(1); //line 6 (warning > thrown for this line) > Was trying to test the code given in the postgres manual. > The only diff being that i changed the

Re: [GENERAL] Version 1 Calling convention

2006-08-30 Thread Jasbinder Bali
PG_FUNCTION_INFO_V1 (test);Datumtest (PG_FUNCTION_ARGS){   int id = PG_GETARG_INT(0);    char *raw_rawemail1 = PG_GETARG_CHAR_P(1); //line 6 (warning thrown for this line)   char *rawemail1 = (char *)  palloc (VARSIZE(rawemail1));   VARATT_SIZEP ( rawemail1 ) = VARSI

Re: [GENERAL] Version 1 Calling convention

2006-08-30 Thread Martijn van Oosterhout
On Wed, Aug 30, 2006 at 04:34:17AM -0400, Jasbinder Bali wrote: > How does the SPI manager know which database to connect using SPI_CONNECT() > As there can be more than one datbase in the postgres server, how does it > make out which database to connect as we don't specify the datbase name we > in

Re: [GENERAL] Version 1 Calling convention

2006-08-30 Thread Jasbinder Bali
How does the SPI manager know which database to connect using SPI_CONNECT()As there can be more than one datbase in the postgres server, how does it make out which database to connect as we don't specify the datbase name we intend to connect. ~JasOn 8/30/06, Jasbinder Bali <[EMAIL PROTECTED]> wrote

Re: [GENERAL] Version 1 Calling convention

2006-08-29 Thread Jasbinder Bali
OK..i got it..spi.h was in /usr/include/pgsql/server/executorJasOn 8/30/06, Jasbinder Bali <[EMAIL PROTECTED] > wrote:Isn't there any rpm to download the SPI ?? On 8/30/06, Martijn van Oosterhout < kleptog@svana.org> wrote: On Wed, Aug 30, 2006 at 01:01:32AM -0400, Jasbinder Bali wrote: > Do i need

Re: [GENERAL] Version 1 Calling convention

2006-08-29 Thread Jasbinder Bali
Isn't there any rpm to download the SPI ??On 8/30/06, Martijn van Oosterhout wrote: On Wed, Aug 30, 2006 at 01:01:32AM -0400, Jasbinder Bali wrote:> Do i need to download spi.h from somewhere or what? I can't see it anywhereYou need the backend header files. In Debian they're i

Re: [GENERAL] Version 1 Calling convention

2006-08-29 Thread Martijn van Oosterhout
On Wed, Aug 30, 2006 at 01:01:32AM -0400, Jasbinder Bali wrote: > Do i need to download spi.h from somewhere or what? I can't see it anywhere You need the backend header files. In Debian they're in the postgresql-dev package. You'll need to add -I/usr/include/postgresql/server to your compile comm

Re: [GENERAL] Version 1 Calling convention

2006-08-29 Thread Jasbinder Bali
Do i need to download spi.h from somewhere or what? I can't see it anywhereOn 8/30/06, Jasbinder Bali <[EMAIL PROTECTED] > wrote:OK. I've removed the ECPG code and error has gone away.Thanks jasOn 8/30/06, Alvaro Herrera < [EMAIL PROTECTED] > wrote:Jasbinder Bali wrote: > I have a .pgc file and i h

Re: [GENERAL] Version 1 Calling convention

2006-08-29 Thread Jasbinder Bali
OK. I've removed the ECPG code and error has gone away.ThanksjasOn 8/30/06, Alvaro Herrera <[EMAIL PROTECTED] > wrote:Jasbinder Bali wrote:> I have a .pgc file and i have the following code snippet in it: >> PG_FUNCTION_INFO_V1 (test);>> Datum> test (PG_FUNCTION_ARGS)> {>  EXEC SQL BEGIN DECLARE SE

Re: [GENERAL] Version 1 Calling convention

2006-08-29 Thread Jasbinder Bali
Well I think I can because so far its been working fine.Anyways, as suggested by others too, I'm going to change it to SPI but right now the matter of concern is the error that I'm getting. Is it because I'm using ECPG in server side code or something else? On 8/30/06, Alvaro Herrera <[EMAIL PROTEC

Re: [GENERAL] Version 1 Calling convention

2006-08-29 Thread Alvaro Herrera
Jasbinder Bali wrote: > I have a .pgc file and i have the following code snippet in it: > > PG_FUNCTION_INFO_V1 (test); > > Datum > test (PG_FUNCTION_ARGS) > { > EXEC SQL BEGIN DECLARE SECTION; You can't use ecpg in server-side functions. You need to use the SPI interface. -- Alvaro Herrera

[GENERAL] Version 1 Calling convention

2006-08-29 Thread Jasbinder Bali
I have a .pgc file and i have the following code snippet in it:PG_FUNCTION_INFO_V1 (test);Datumtest (PG_FUNCTION_ARGS){  EXEC SQL BEGIN DECLARE SECTION;   int id = PG_GETARG_INT(0);    char *raw_rawemail1 = PG_GETARG_CHAR_P(1);   char *rawemail1 = (char *)  palloc (VARSIZE(r