Re: PLPGSQL errors - Mailing list pgsql-sql

From Richard Huxton
Subject Re: PLPGSQL errors
Date
Msg-id 200210091120.27142.dev@archonet.com
Whole thread Raw
In response to PLPGSQL errors  ("Rudi Starcevic" <rudi@oasis.net.au>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Rudi Starcevic"
Date:
Subject: PLPGSQL errors
Next
From: Adam Witney
Date:
Subject: Complex SQL query and performance strategy