public inbox for [email protected]  
help / color / mirror / Atom feed
v11: RETURN syntax for procedure
2+ messages / 2 participants
[nested] [flat]

* v11: RETURN syntax for procedure
@ 2018-10-10 13:14  fn ln <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: fn ln @ 2018-10-10 13:14 UTC (permalink / raw)
  To: pgsql-docs

Hello.

I've found this on the docs:
https://www.postgresql.org/docs/devel/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETU...
> 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?


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: v11: RETURN syntax for procedure
@ 2018-10-14 01:01  Bruce Momjian <[email protected]>
  parent: fn ln <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruce Momjian @ 2018-10-14 01:01 UTC (permalink / raw)
  To: fn ln <[email protected]>; +Cc: 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  <[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 +





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-10-14 01:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 13:14 v11: RETURN syntax for procedure fn ln <[email protected]>
2018-10-14 01:01 ` Bruce Momjian <[email protected]>

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