Re: v11: RETURN syntax for procedure

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: fn ln <emuser20140816(at)gmail(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: v11: RETURN syntax for procedure
Date: 2018-10-14 01:01:57
Message-ID: 20181014010157.GB25796@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wed, Oct 10, 2018 at 10:14:23PM +0900, fn ln wrote:
> Hello.
>
> I've found this on the docs:
> https://www.postgresql.org/docs/devel/static/plpgsql-control-structures.html#
> PLPGSQL-STATEMENTS-RETURNING-PROCEDURE
> > If a RETURN statement is desired to exit the code early, then NULL must be
> returned.
>
> But isn't actual syntax just RETURN without an expression?

I think you might be right:

CREATE OR REPLACE PROCEDURE triple()
LANGUAGE plpgsql
AS $$
BEGIN
RETURN NULL;
END;
$$;
ERROR: RETURN cannot have a parameter in a procedure
--> LINE 5: RETURN NULL;
^

CREATE OR REPLACE PROCEDURE triple()
LANGUAGE plpgsql
AS $$
BEGIN
RETURN;
END;
$$;

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Dean Rasheed 2018-10-14 10:49:35 Re: Proposed HTML Documentation Styles
Previous Message Bruce Momjian 2018-10-13 18:38:24 Re: Creating Certificates