Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BD12E476D41 for ; Fri, 20 Sep 2002 05:30:49 -0400 (EDT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by postgresql.org (Postfix) with ESMTP id D108C476D28 for ; Fri, 20 Sep 2002 05:30:48 -0400 (EDT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 17sK6j-000PmF-0Y; Fri, 20 Sep 2002 10:29:54 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 2BC3116549; Fri, 20 Sep 2002 10:24:44 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 85CA916545; Fri, 20 Sep 2002 10:24:43 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: "wit" , pgsql-sql@postgresql.org Subject: Re: check source of trigger Date: Fri, 20 Sep 2002 10:23:43 +0100 User-Agent: KMail/1.4.1 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200209201023.43571.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/237 X-Sequence-Number: 9514 On Friday 20 Sep 2002 9:25 am, wit wrote: > 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_cod= eA > 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. There are a number of "special" variables defined if you are a trigger=20 procedure (not just OLD and NEW) - is that what you were after (Programmers= =20 manual, ch 23.9) - Richard Huxton