Hi, I have a problem (I wrote about it before, but here is a complete example). When I have two triggers with parameters the backend crashes after a certain sequence of invocations. Attached are two very simple triggers in C (they might contain some unnecessary lines, they are a stripped version of an application I'm working on), how to compile, how to bootstrap, ... how to crash the backend

Postgresql info:

PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.3

A sample makefile (extract from mine)

 

SRC3 = t5_pred_general_trig
SRC4 = t5_template_trig
CC = gcc
CC_COMPILE = gcc
CC_INCLUDE = -I/homes/ab374/scratch/postgresql-7.1/include -I/homes/ab374/scratch/postgresql-7.1/src/include
.PHONY: 3 4
3:
        $(CC_COMPILE) -c $(CC_INCLUDE) $(SRC3).c
        $(CC) -shared -o $(SRC3).so $(SRC3).o
4:
        $(CC_COMPILE) -c  $(CC_INCLUDE) $(SRC4).c
        $(CC) -shared -o $(SRC4).so $(SRC4).o

 

-- to bootstrap the database:

create table t5_predicate_type (
        predname text primary key,
        parameter text[],
        templatetable text,
        notify text[],
        version text
);

create table t5tt_b1 (ev_upd boolean, ev_ins boolean, ev_del boolean,
p1 int4, f1 text, o1 int4, g1 text,
p2 int4, f2 text, o2 int4, g2 text,
p3 int4, f3 text, o3 int4, g3 text,
commtable text, commtemplate text, notify text, action text, version text);

create table b1 (a int4, b int4, c int4);

create function t5_pred_general_trig() returns opaque as
'/homes/ab374/scratch/devel/test5/t5_pred_general_trig.so' language 'c';

create function t5_template_trig() returns opaque as
'/homes/ab374/scratch/devel/test5/t5_template_trig.so' language 'c';


create trigger t5ptg1 after insert or delete or update on b1
for each row execute procedure t5_pred_general_trig('t5tt_b1');

create trigger t5t1 AFTER INSERT OR UPDATE on t5tt_b1
FOR EACH ROW EXECUTE PROCEDURE t5_template_trig('b1');

-- to reproduce the crash (enter it in a new psql session):

insert into t5tt_b1 values ('f', 't', 'f', 0,'int4ge', null, null,
2, 'int4eq', null, null, 2, 'int4eq' , null, null, 'temp1', 'p1;p2;p0;', 'andras','d', null);

insert into b1 values (1,2,2);
insert into b1 values (1,2,2);

The crash is deterministic on my machine (I've tried different c compilers, different linux distributions, ...)
If you need additional info please write to beland1@hotmail.com

Many thanks,

Andras


 



Get your FREE download of MSN Explorer at http://explorer.msn.com