From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | PL/PgSQL buglet / doc error |
Date: | 2002-11-07 23:44:06 |
Message-ID: | 87smyd6j3t.fsf@mailbox.samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
The 7.3 docs for the PL/PgSQL return statement say:
RETURN with an expression is used to return from a PL/pgSQL function
that does not return a set.
[...]
If you have declared the function to return void, then the expression
can be omitted, and will be ignored in any case.
However, that does not seem to be the case:
nconway=# select version(); version
------------------------------------------------------------------
PostgreSQL 7.4devel on i686-pc-linux-gnu, compiled by GCC 2.95.4
(1 row)
nconway=# create table bar (a int);
CREATE TABLE
nconway=# create or replace function test_func() returns void as
'begin insert into bar values (5); end;' language 'plpgsql';
CREATE FUNCTION
nconway=# select test_func();
WARNING: Error occurred while executing PL/pgSQL function test_func
WARNING: at END of toplevel PL block
ERROR: control reaches end of function without RETURN
nconway=# create or replace function test_func() returns void as
'begin insert into bar values (5); return; end;' language 'plpgsql';
CREATE FUNCTION
nconway=# select test_func();
test_func
-----------
(1 row)
Should this be implemented, or should the assertion that 'RETURN is
optional' be removed from the docs?
Cheers,
Neil
--
Neil Conway <neilc(at)samurai(dot)com> || PGP Key ID: DB3C29FC
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-11-08 00:03:01 | Re: PL/PgSQL buglet / doc error |
Previous Message | Larry Rosenman | 2002-11-07 22:50:26 | Re: [HACKERS] PostgreSQL supported platform report and a |