| From: | Richard Huxton <dev(at)archonet(dot)com> | 
|---|---|
| To: | "Rudi Starcevic" <rudi(at)oasis(dot)net(dot)au>, pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: PLPGSQL errors | 
| Date: | 2002-10-09 10:20:27 | 
| Message-ID: | 200210091120.27142.dev@archonet.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
On Wednesday 09 Oct 2002 11:06 am, Rudi Starcevic wrote:
>
> error:
> [postgres(at)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adam Witney | 2002-10-09 10:32:18 | Complex SQL query and performance strategy | 
| Previous Message | Rudi Starcevic | 2002-10-09 10:06:33 | PLPGSQL errors |