X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 77D90D1BACC for ; Thu, 22 Apr 2004 08:19:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97388-10 for ; Thu, 22 Apr 2004 08:19:14 -0300 (ADT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id 15682D1B560 for ; Thu, 22 Apr 2004 08:19:11 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 3.35 #1) id 1BGcEb-000MkQ-0W; Thu, 22 Apr 2004 12:19:13 +0100 Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 3ACFC16A55; Thu, 22 Apr 2004 12:19:12 +0100 (BST) From: Richard Huxton To: , pgsql-sql@postgresql.org Subject: Re: Trigger calling a function HELP ME! (2) Date: Thu, 22 Apr 2004 12:19:12 +0100 User-Agent: KMail/1.5 References: <20040421151605.77039.qmail@web13901.mail.yahoo.com> In-Reply-To: <20040421151605.77039.qmail@web13901.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200404221219.12694.dev@archonet.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200404/227 X-Sequence-Number: 17602 On Wednesday 21 April 2004 16:16, abief_ag_-postgresql@yahoo.com wrote: > CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test) > RETURNS imp_test AS > 'begin > return $1; > end;' > LANGUAGE 'plpgsql' STABLE; > > CREATE OR REPLACE FUNCTION public.imp_test_trigger() > RETURNS trigger AS > 'begin > return imp_test_to_out_test(new); > end;' > LANGUAGE 'plpgsql' STABLE; This is your problem. NEW is a special variable, and I don't think you can pass it into another function (other than as NEW.col1, NEW.col2, NEW.col3 etc). You can however use TG_NAME or TG_RELNAME to see what trigger/table called you. I find that's helpful. -- Richard Huxton Archonet Ltd