[GENERAL] invalid memory alloc after insert with c trigger function

2007-05-31 Thread Dudás József
Hello Everybody! I know that something doing wrong, but I can't find out what is it. This is a part from trigger function: / attnum[3] = SPI_fnumber( tupdesc, "arfolyam" ); datums[3] = _selectFunctionB( "SELECT ertek FROM foo WHERE parameter='rate'" ); // this come back with Datum type from se

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-05-31 Thread Dudás József
Thanks for your reply! I was run gdb and errfinish but didn't get much help because I write to list. Yes the first datas ( datums[0-2] ) are char* / VARCHAR types and if I call SPI_modifytuple( ( trigdata->tg_relation, tmptuple, 3, &attnum[0], &datums[0], &isNull[0] ) than everything is OK. Jus

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-06-01 Thread Dudás József
Here is the output from gdb: #0 errfinish (dummy=0) at elog.c:312 #1 0x0827f378 in elog_finish (elevel=20, fmt=0x83586d8 "invalid memory alloc request size %lu") at elog.c:937 #2 0x082983d7 in MemoryContextAlloc (context=0x843a1ac, size=4294967293) at mcxt.c:504 #3 0x0825751d in varchar

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-06-01 Thread Dudás József
This is the debug of last varcharout routine: Breakpoint 1, varcharout (fcinfo=0xbf8a1e7c) at varchar.c:441 441 VarChar*s = PG_GETARG_VARCHAR_P(0); 440 { (gdb) print fcinfo $25 = (FunctionCallInfo) 0xbf8a1e7c 441 VarChar*s = PG_GETARG_VARCHAR_P(0); 446

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-06-01 Thread Dudás József
atums[3] = _selectFunctionB( "SELECT ertek FROM foo WHERE parameter='rate'" ); Dudás József <[EMAIL PROTECTED]> writes: elog( INFO, "2.5.1 Datums[3] = %f", DatumGetFloat8( datums[3] ) ); rettuple = SPI_modifytuple( trigdata->tg_relation, tmptuple, 4,

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-06-01 Thread Dudás József
database function. Are you compiling with warnings? Because this should have blown up on you: On Fri, Jun 01, 2007 at 02:03:26PM +0200, Dudás József wrote: PG_FUNCTION_INFO_V1(_selectFunctionB); Datum _selectFunctionB( char *sql ) If you've declared your function V1 then it doesn&

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-06-01 Thread Dudás József
Yes! You are right! Now must me find out how to convert char* to numeric datum and double to numeric datum and numeric datum to double :) =?ISO-8859-2?Q?Dud=E1s_J=F3zsef?= <[EMAIL PROTECTED]> writes: Just have problem with this conversion from TEXT - double - Datum ( NUMERIC ) where in TEX

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-06-01 Thread Dudás József
This is the debug of last varcharout routine: Breakpoint 1, varcharout (fcinfo=0xbf8a1e7c) at varchar.c:441 441 VarChar*s = PG_GETARG_VARCHAR_P(0); 440 { (gdb) print fcinfo $25 = (FunctionCallInfo) 0xbf8a1e7c 441 VarChar*s = PG_GETARG_VARCHAR_P(0); 446

Re: [GENERAL] invalid memory alloc after insert with c trigger function

2007-06-01 Thread Dudás József
Thank you and other helpfully peoples the interest about my first steps in your world. I learned more than I hope. This function work fine now. Can you to offer me place where I find these information, because I read the postgresql source code to find these macros. Regards, Josef Dudás