pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: abief_ag_-postgresql@yahoo.com
To: pgsql-sql@postgresql.org
Subject: Re: Trigger calling a function HELP ME! (2)
Date: Thu, 22 Apr 2004 12:19:12 +0100
Message-ID: <200404221219.12694.dev@archonet.com> (raw)
In-Reply-To: <20040421151605.77039.qmail@web13901.mail.yahoo.com>
References: <20040421151605.77039.qmail@web13901.mail.yahoo.com>

On Wednesday 21 April 2004 16:16, abief_ag_-postgresql@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



view thread (5+ messages)  latest in thread

Message-ID: <200404221219.12694.dev@archonet.com>
Permalink:  ../200404221219.12694.dev@archonet.com/
Also on:    postgresql.org/message-id/200404221219.12694.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, abief_ag_-postgresql@yahoo.com
  Subject: Re: Trigger calling a function HELP ME! (2)
  In-Reply-To: <200404221219.12694.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox