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 83E43D1D614 for ; Wed, 21 Apr 2004 11:43:10 -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 89201-04 for ; Wed, 21 Apr 2004 11:43:13 -0300 (ADT) Received: from web13909.mail.yahoo.com (web13909.mail.yahoo.com [216.136.172.94]) by svr1.postgresql.org (Postfix) with SMTP id 4CFD6D1BABD for ; Wed, 21 Apr 2004 11:43:08 -0300 (ADT) Message-ID: <20040421144312.83625.qmail@web13909.mail.yahoo.com> Received: from [80.67.100.162] by web13909.mail.yahoo.com via HTTP; Wed, 21 Apr 2004 07:43:12 PDT Date: Wed, 21 Apr 2004 07:43:12 -0700 (PDT) From: Subject: Trigger calling a function HELP ME! To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200404/206 X-Sequence-Number: 17581 Hi all, first of all, let me explain what I'm trying to do. I have a table with a fairly complicated trigger. In this trigger I have a specific set of codelines that can be executed in more than 50 places that works on the new.* fields in order to fix/clean them. In order to improve readability, I created a function that manages this small set of codelines, but I'm stuck on the following error: --- ERROR: return type mismatch in function returning tuple at or near "imp_test_to_out_test" CONTEXT: compile of PL/pgSQL function "imp_test_trigger" near line 2 --- as a model, I've created this run-down example: --- CREATE TABLE public.imp_test ( id int8, value text ) WITHOUT OIDS; CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test) RETURNS imp_test AS 'begin return new; 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; CREATE TRIGGER imp_test_trigger_001 BEFORE INSERT OR UPDATE ON public.imp_test FOR EACH ROW EXECUTE PROCEDURE public.imp_test_trigger(); --- Whenever I run the following select, I get the a.m. result: --- insert into imp_test (id, value) values(1, 'A'); --- Can somebody help me? regards, ===== Riccardo G. Facchini