On Wednesday 09 Oct 2002 11:06 am, Rudi Starcevic wrote:
>
> error:
> [postgres@central postgres]$ /usr/local/pgsql/bin/psql demo -f
> sysinsert.sql psql:sysinsert.sql:16: NOTICE: Error occurred while
> executing PL/pgSQL function fn_sysmessages_log
> psql:sysinsert.sql:16: NOTICE: at END of toplevel PL block
> psql:sysinsert.sql:16: ERROR: control reaches end of trigger procedure
> without RETURN
Look carefully - you don't have a RETURN new/old/null in your function. Take a
look at the online manual (Server Programming, chapter 20) or some of the
samples in Roberto's PostgreSQL cookbook (http://techdocs.postgresql.org)
> function :
> CREATE function fn_sysmessages_log() RETURNS OPAQUE AS '
> BEGIN
> INSERT INTO sysmessages_log
> (
> id,
> user_id,
> message_date,
> message_priority,
> message,
> status
> )
> VALUES
> (
> NEW.id,
> NEW.user_id,
> NEW.message_date,
> NEW.message_priority,
> NEW.message,
> NEW.status
> );
> END;
> ' LANGUAGE 'plpgsql';
-- Richard Huxton