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

From: "Riccardo G(dot) Facchini" <abief_ag_-postgresql(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Trigger calling a function HELP ME! (2)
Date: 2004-04-26 07:47:13
Message-ID: 20040426074713.32544.qmail@web13906.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


--- Richard Huxton <dev(AT)archonet.com> wrote:
> On Wednesday 21 April 2004 16:16, abief_ag_-postgresql(AT)yahoo.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
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

One other issue, as I understand it, NEW (and OLD) is a variable of
type record, so you should be able to pass it to a function and get it
as a return value, but it seems that there is a bug reported for
version 7.2.1 that inhibits the use of record as type to be passed to a
function.

any suggestion?

=====
Riccardo G. Facchini

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Karsten Hilbert 2004-04-26 08:29:24 Re: Python connection
Previous Message Michael Satterwhite 2004-04-25 16:29:54 Python connection