Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id B1C7347629C for ; Tue, 20 Aug 2002 17:37:33 -0400 (EDT) Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by postgresql.org (Postfix) with ESMTP id 3AF644761EB for ; Tue, 20 Aug 2002 17:37:32 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id 451E1FDDC; Tue, 20 Aug 2002 18:37:26 -0300 (GMT) Received: by bugs.unl.edu.ar (Postfix, from userid 60001) id 7CC7AFCA9; Tue, 20 Aug 2002 18:37:25 -0300 (GMT) Received: from 168.96.132.213 ( [168.96.132.213]) as user martin@bugs.unl.edu.ar by bugs.unl.edu.ar with HTTP; Tue, 20 Aug 2002 18:37:24 -0300 Message-ID: <1029879444.3d62b694112ac@bugs.unl.edu.ar> Date: Tue, 20 Aug 2002 18:37:24 -0300 From: Martin Marques To: Stephan Szabo Cc: pgsql-sql@postgresql.org Subject: Re: functions and triggers References: <20020820141353.B45554-100000@megazone23.bigpanda.com> In-Reply-To: <20020820141353.B45554-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.0 X-Virus-Scanned: by AMaViS snapshot-20020300 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/299 X-Sequence-Number: 9145 Quoting Stephan Szabo : > > > The problemas are two: > > > > 1) when I try to create the trigger, it says that the function doesn't > exist. > > Why is this happening? > > You should probably show us what you were trying to do, but I'm going to > guess that the function doesn't have the right signature. On > current versions, Trigger functions should return opaque and take no > arguments (any arguments given on the create trigger line are passed > in a different fashion). I have this function which works OK. CREATE FUNCTION ahora (integer) RETURNS integer AS ' UPDATE usuarios SET tmodif = now() WHERE codigo = $1; SELECT 1 as RESULT; ' LANGUAGE SQL > > 2) How does the trigger tell the function the row number identifier? > > I'm not sure what you mean by this. Getting at the row being worked on > depends somewhat on what language you're using. I thought about a simple SQL that does the update. You mean I just call the function from the trigger and thats all? -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? ----------------------------------------------------------------- Martín Marqués | mmarques@unl.edu.ar Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral -----------------------------------------------------------------