Re: functions and triggers

From: Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: functions and triggers
Date: 2002-08-20 21:37:24
Message-ID: 1029879444.3d62b694112ac@bugs.unl.edu.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Quoting Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>:

>
> > 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(at)unl(dot)edu(dot)ar
Programador, Administrador, DBA | Centro de Telematica
Universidad Nacional
del Litoral
-----------------------------------------------------------------

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2002-08-20 21:59:50 Re: functions and triggers
Previous Message Stephan Szabo 2002-08-20 21:16:13 Re: functions and triggers