pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTrigger and function not on speaking terms
4+ messages / 4 participants
[nested] [flat]
* Trigger and function not on speaking terms
@ 2004-08-02 20:20 Jeff Boes <jboes@qtm.net>
0 siblings, 3 replies; 4+ messages in thread
From: Jeff Boes @ 2004-08-02 20:20 UTC (permalink / raw)
To: pgsql-sql
Hmm, this is puzzling me:
create or replace function fn_foo(text) returns trigger as '
begin
# Do some stuff with $1
end;
' language 'plpgsql';
CREATE FUNCTION
create table bar (aaa text);
CREATE TABLE
create trigger trg_bar
after insert or update on bar
execute procedure fn_foo('string');
ERROR: function fn_foo() does not exist
It would seem my trigger definition is trying to find fn_foo(), when I
mean for it to call fn_foo(TEXT).
--
(Posted from an account used as a SPAM dump. If you really want to get
in touch with me, dump the 'jboes' and substitute 'mur'.)
________
Jeffery Boes <>< jboes@qtm.net
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Trigger and function not on speaking terms
@ 2004-08-02 21:20 Richard Poole <rp@guests.deus.net>
parent: Jeff Boes <jboes@qtm.net>
2 siblings, 0 replies; 4+ messages in thread
From: Richard Poole @ 2004-08-02 21:20 UTC (permalink / raw)
To: pgsql-sql
On Mon, Aug 02, 2004 at 04:20:15PM -0400, Jeff Boes wrote:
> It would seem my trigger definition is trying to find fn_foo(), when I
> mean for it to call fn_foo(TEXT).
Triggers have to be declared to take no arguments; they find the rows on
which they operate in magical ways. (For PL/PgSQL triggers, see chapter
37.10 of the manual.)
Richard
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Trigger and function not on speaking terms
@ 2004-08-02 21:21 Stephan Szabo <sszabo@megazone.bigpanda.com>
parent: Jeff Boes <jboes@qtm.net>
2 siblings, 0 replies; 4+ messages in thread
From: Stephan Szabo @ 2004-08-02 21:21 UTC (permalink / raw)
To: Jeff Boes <jboes@qtm.net>; +Cc: pgsql-sql
On Mon, 2 Aug 2004, Jeff Boes wrote:
> Hmm, this is puzzling me:
>
> create or replace function fn_foo(text) returns trigger as '
> begin
> # Do some stuff with $1
> end;
> ' language 'plpgsql';
>
> CREATE FUNCTION
>
> create table bar (aaa text);
>
> CREATE TABLE
>
> create trigger trg_bar
> after insert or update on bar
> execute procedure fn_foo('string');
>
> ERROR: function fn_foo() does not exist
>
> It would seem my trigger definition is trying to find fn_foo(), when I
> mean for it to call fn_foo(TEXT).
I don't remember why, but the arguments from the create trigger statement
are passed differently from standard arguments (I think it's like TGARGS
in plpgsql).
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Trigger and function not on speaking terms
@ 2004-08-03 02:11 Kevin Davis <davisk@spacecybernetics.com>
parent: Jeff Boes <jboes@qtm.net>
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Davis @ 2004-08-03 02:11 UTC (permalink / raw)
To: Jeff Boes <jboes@qtm.net>; +Cc: pgsql-sql
You need to define fn_foo w/o params per Doc Section 19.9.
Your intent as expressed in the trigger def (args) can then be fulfilled
through special top level vars.
On Mon, 2004-08-02 at 16:20, Jeff Boes wrote:
> Hmm, this is puzzling me:
>
> create or replace function fn_foo(text) returns trigger as '
> begin
> # Do some stuff with $1
> end;
> ' language 'plpgsql';
>
> CREATE FUNCTION
>
> create table bar (aaa text);
>
> CREATE TABLE
>
> create trigger trg_bar
> after insert or update on bar
> execute procedure fn_foo('string');
>
> ERROR: function fn_foo() does not exist
>
> It would seem my trigger definition is trying to find fn_foo(), when I
> mean for it to call fn_foo(TEXT).
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2004-08-03 02:11 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-02 20:20 Trigger and function not on speaking terms Jeff Boes <jboes@qtm.net>
2004-08-02 21:20 ` Richard Poole <rp@guests.deus.net>
2004-08-02 21:21 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
2004-08-03 02:11 ` Kevin Davis <davisk@spacecybernetics.com>
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