public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bruce Momjian <[email protected]>
To: fn ln <[email protected]>
Cc: [email protected]
Subject: Re: v11: RETURN syntax for procedure
Date: Sat, 13 Oct 2018 21:01:57 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+99BHqk-zAWA_qByg_P1TjQ8v5LCFQT4e7r5uke0eOQLe955g@mail.gmail.com>
References: <CA+99BHqk-zAWA_qByg_P1TjQ8v5LCFQT4e7r5uke0eOQLe955g@mail.gmail.com>

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  <[email protected]>        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 +





view thread (2+ messages)

reply

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: v11: RETURN syntax for procedure
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox