Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 858C9476D78 for ; Fri, 20 Sep 2002 04:30:37 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 0EEAE476D76 for ; Fri, 20 Sep 2002 04:30:37 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id 8D211382587; Fri, 20 Sep 2002 04:30:34 -0400 (EDT) From: "wit" X-Newsgroups: comp.databases.postgresql.sql Subject: check source of trigger Date: Fri, 20 Sep 2002 15:25:14 +0700 Organization: Micro-X Lines: 36 Message-ID: X-Complaints-To: news@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-Mimeole: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/236 X-Sequence-Number: 9513 Hello, I have a question about trigger. I have tables with the following structure: create table A ( e_codeA char(5) default '' not null, n_codeA varchar(20) default '' not null, constraint A_pkey primary key ( e_codeA ) ); create table B ( e_codeB char(5) default '' not null, e_codeA char(5) default '' not null constraint e_codeA_ref references A( e_codeA ) on delete cascade on update cascade, n_codeB varchar(20) default '' not null, constraint B_pkey primary key ( e_tranB, e_codeA ) ); I have trigger and procedure on table B to capture any change and insert into table logB: create trigger trigger_b before insert or update or delete on B for each row execute procedure log_change(); When I update e_codeA in table A, the constrain trigger will update e_codeA in B. My trigger, trigger_b, also was trigged and procedure will record change into table logB too. How to write a code in my db procedure to check whether the procedure was called by normal SQL or was called by cascade trigger. Regards, wit