Re: Trigger calling a function HELP ME! (2)

From: Richard Huxton <dev(at)archonet(dot)com>
To: <abief_ag_-postgresql(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Trigger calling a function HELP ME! (2)
Date: 2004-04-22 11:19:12
Message-ID: 200404221219.12694.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wednesday 21 April 2004 16:16, abief_ag_-postgresql(at)yahoo(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-04-22 13:01:20 Re: Order by YYYY MM DD in reverse chrono order trouble
Previous Message Stijn Vanroye 2004-04-22 10:47:10 Re: Order by YYYY MM DD in reverse chrono order trouble