From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | "F(dot) Masselink" <tiggr(at)xs4all(dot)nl> |
Cc: | "Postgres (general newsgroup)" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: function / trigger problem |
Date: | 2001-06-13 17:57:46 |
Message-ID: | Pine.BSF.4.21.0106131056560.59806-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 13 Jun 2001, F. Masselink wrote:
> Hello,
>
> i've stumbled upon a problem with triggers and functions.
>
> this function doesn't work.
> It gives an error when creating the trigger: set_leentype() does not exist.
>
> CREATE FUNCTION set_leentype (int4) RETURNS opaque AS '
> BEGIN
> NEW.type := $1;
> RETURN NEW;
> END;
> ' LANGUAGE 'plpgsql';
>
> CREATE TRIGGER is_boek
> BEFORE INSERT ON boek
> FOR EACH ROW
> EXECUTE PROCEDURE set_leentype (1);
>
> but if i use the same function and triggers, with the little
> modification that i don't pass a parameter, it works fine!
>
> does anyone know why this is and does anyone know a solution to this. (I
> want to use the code with passing parameters).
Trigger functions take no arguments and return opaque. Arguments given
at create trigger time are passed differently. Read the documentation for
more details.
From | Date | Subject | |
---|---|---|---|
Next Message | Gregory Wood | 2001-06-13 18:07:37 | Re: Multiple pq_flush: send() failed: Broken pipe |
Previous Message | Bruce Momjian | 2001-06-13 17:52:35 | Re: SQL Load Balancer for PostgreSQL |