Subject Re: [firebird-support] Question on Ref Integrity during Trigger
Author Ann W. Harrison
Myles Wakeham wrote:
> I am attempting to update a separate table with data in the AFTER INSERT
> phase of a trigger. ...


OK here's a simple example of what you're trying to do, I think. And it
seems to work fine.


SQL> create database 'foo.fdb';
SQL> create table t1 (f1 integer not null primary key);
SQL> create table t2 (f1 integer not null primary key,
CON> t1_f1 integer,
CON> foreign key (t1_f1) references t1 (f1));
SQL> set term ^;
SQL> create trigger t1_ai_1 for t1 after insert position 0
CON> as begin
CON> insert into t2 (f1, t1_f1) values (new.f1, new.f1);
CON> end^
SQL> set term ;^
SQL> commit;
SQL> insert into t1 values (1);
SQL> select * from t2;

F1 T1_F1
============ ============

1 1



What's different about your definitions?

Regards,


Ann