SPI_getvalue gives a core dump - Mailing list pgsql-interfaces

From
Subject SPI_getvalue gives a core dump
Date
Msg-id 200607281535.k6SFZ5EV014757@mail009.ownmail.com
Whole thread Raw
Responses Re: SPI_getvalue gives a core dump  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-interfaces
I am using postgresql:-PostgreSQL 8.0.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.4
I am trying to trigger a function on insert. I get the following error:-


LOG:  statement: INSERT INTO ast_cdr
(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield)
VALUES('2006-07-28 20:35:14','"15554216325" <15554216325>','15554216325','889','from_box',
'SIP/15554216325-5914','SIP/69.54.75.50-da64','Playback','vivek/myfile'|noanswer',3,0,'NO
ANSWER',3,'0','1154099114.198','vivek'

LOG:  statement: SELECT count(*) FROM ast_cdr
CONTEXT:  SQL statement "SELECT count(*) FROM ast_cdr"
LOG:  server process (PID 5561) was terminated by signal 11
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has command
ed this server process to roll back the current transaction and exit, because another server process exited abnormally
andpossibly corrupted shared memory.
 


I tried executing this:- 
SELECT count(*) FROM ast_cdr;
-[ RECORD 1 ]
count | 2

I dont know where am i going wrong. Here is the source.

TriggerData *trigdata = (TriggerData *) fcinfo->context;
TupleDesc   tupdesc;
if (CALLED_AS_TRIGGER(fcinfo)) {  ==================== it comes here and enters inside.
userfield=SPI_getvalue(trigdata->tg_trigtuple,tupdesc,17);================== it fails here because i tried to get logs
beforethis statement and it succeeded. 
 

Please help this newbie.





With warm regards.

Vivek J. Joshi.

vivek@staff.ownmail.com
Trikon electronics Pvt. Ltd.

All science is either physics or stamp collecting.               -- Ernest Rutherford





pgsql-interfaces by date:

Previous
From: John DeSoi
Date:
Subject: Re: How do I get started?
Next
From: Tom Lane
Date:
Subject: Re: SPI_getvalue gives a core dump