From: Herwig Goemans <herwig.goemans@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: ERROR: control reached end of function without RETURN, except, it is not a function it is a procedure or a nameless block.
Date: Mon, 13 Sep 2021 13:23:06 +0200
Message-ID: <868ae948-e3ca-c7ec-95a6-83cfc08ef750@gmail.com> (raw)
Hi Support,
I get an error in a stored procedure - not a stored function mind you -
control reached end of function without RETURN
The error occurs when doing an exit <label> in a stored procedure. Now
I cannot give all of the stored procedures involved but I can simulate
te problem with a very simple block:
DO
$BODY$
<<simple_block>>
BEGIN
begin
exit simple_block;
-- for demo purposes
raise notice '%', 'unreachable!';
end;
raise notice '%', 'End of block';
end;
$BODY$
This will return the error on Postgres version 13, Version 12 and 9.
Now I thought this was text-book behaviour of exiting a code block. I do
not like programming this way but it is part of a migration project of
Oracle to PG.
What do I miss ?
Kind regards,
If you put this code snippet in a file and execute like:
postgres@herwig-NUC10i7FNH:~$ psql -f do_test.sql
psql:do_test.sql:12: ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function inline_code_block
Herwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-general@postgresql.org
Cc: herwig.goemans@gmail.com, pgsql-general@lists.postgresql.org
Subject: Re: ERROR: control reached end of function without RETURN, except, it is not a function it is a procedure or a nameless block.
In-Reply-To: <868ae948-e3ca-c7ec-95a6-83cfc08ef750@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox