Re: Function xxxx() does no exist - Mailing list pgsql-sql

From Tom Lane
Subject Re: Function xxxx() does no exist
Date
Msg-id 12552.955665550@sss.pgh.pa.us
Whole thread Raw
In response to Function xxxx() does no exist  (Philippe Lefèvre <ph.l@libertysurf.fr>)
Responses Re: Function xxxx() does no exist  (wieck@debis.com (Jan Wieck))
List pgsql-sql
Philippe Lefèvre <ph.l@libertysurf.fr> writes:
> So I created:
>   CREATE FUNCTION chk_itheme_proc(int4) RETURNS int4
>     AS 'SELECT COUNT(i_theme) FROM tbl_theme
>     WHERE i_theme = $1;'
>     LANGUAGE 'sql';

> and I created a trigger:
>  CREATE TRIGGER chk_itheme_trig BEFORE INSERT OR UPDATE ON tbl_article
>     FOR EACH ROW EXECUTE PROCEDURE chk_itheme_proc ('theme');

> but I get the message:
>      ERROR:  CreateTrigger: function chk_itheme_proc() does not exist

Poorly worded error message, I'd say.  You have a function
chk_itheme_proc(int4), but the trigger as you show it requires a
function with a signature of chk_itheme_proc(text) or something close
to it.  Those are different functions.

The error message ought to print out the expected parameter types to
remind you about that...
        regards, tom lane


pgsql-sql by date:

Previous
From: Philippe Lefèvre
Date:
Subject: Function xxxx() does no exist
Next
From: "Graeme Merrall"
Date:
Subject: sum a subquery?