When I use 2 or more triggers (body written in C) with trigger parameters, triggered within the same psql connection the backend crashes randomly. Previous triggers execute without any problems, the triggers, which should be fired do not even start.
Postgresql version 7.1.3 (had the same problem with previous ones as well) version info: (PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.3) postmaster run with params: nohup postmaster -i -D homes/ab374/scratch/DataBaseHome </dev/null >> homes/ab374/scratch/DataBaseHome/postmaster.log 2>&1 Simple example trigger body in the end, it has really nothing inside! After the backend crashes the following can be seen on the screen of psql: t5=# insert into b1 values (1,2,3); pqReadData() -- backend closed the channel unexpectedly. This probably means the backend terminated abnormally before or while processing the request. The connection to the server was lost. Attempting reset: Failed. the log has nothing about the crash (only the last successfull trigger message), after restart the message in the log: Server process (pid 20469) exited with status 11 at Fri Oct 19 18:51:07 2001 Terminating any active server processes... Server processes were terminated at Fri Oct 19 18:51:07 2001 Reinitializing shared memory and semaphores DEBUG: database system was interrupted at 2001-10-19 16:04:00 BST DEBUG: CheckPoint record at (0, 46986884) DEBUG: Redo record at (0, 46986884); Undo record at (0, 0); Shutdown FALSE DEBUG: NextTransactionId: 34938; NextOid: 913546 DEBUG: database system was not properly shut down; automatic recovery in progre ss... The Data Base System is starting up DEBUG: redo starts at (0, 46986948) DEBUG: ReadRecord: record with zero len at (0, 47003564) DEBUG: redo done at (0, 47003528) DEBUG: database system is in production state the crash occures usually when there are two different triggers (even simple ones, with similar body as attached), let's say A and B, are invoked in the following order within the same backend process: A B B crash (the second instance of the second fired trigger, viz. same when B A A is invoked) The two triggers are independent, on diff tables, ... . In different backend processes arbitrary number of repetition of a single trigger works fine i.e. A* or B*) Even the most simple triggers seem to fail sometimes (example for their simplicity: include "executor/spi.h" /* this is what you need to work with SPI */ include "commands/trigger.h" /* -"- and triggers */ extern Datum aat(PG_FUNCTION_ARGS) ; Datum aat(PG_FUNCTION_ARGS) { TriggerData *trigdata = (TriggerData *) fcinfo->context; TupleDesc tupdesc; HeapTuple rettuple; Relation rel; Trigger *trigger; /* to get trigger name */ int nargs; // trigger argument numbers char ** args; // trigger arguments int funnr; // numbers of functions elog(NOTICE, "AA Trigger fired"); if (!CALLED_AS_TRIGGER(fcinfo)) elog(ERROR, "blah blah"); if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event)) { rettuple = trigdata->tg_trigtuple; else { elog(ERROR,"blah blah"); trigger = trigdata->tg_trigger; nargs = trigger->tgnargs; args = trigger->tgargs; rel = trigdata->tg_relation; tupdesc = trigdata->tg_relation->rd_att; trigdata = NULL; if(nargs!=1) elog(ERROR, "TemlateTrigger: Trigger must have one argument"); elog(NOTICE, "Template trigger finished"); return PointerGetDatum(rettuple); Hope my report is not too confusing, if needed I'd be happy to send complete source with makefiles, and sql statements that seemed to cause the backend process crash every time best wishes, Andras _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html