pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: josh@agliodbs.com
Cc: sqllist <pgsql-sql@postgresql.org>
Subject: Re: Request for change in PL/PGSQL function handler
Date: Fri, 26 Jan 2001 14:04:00 -0500
Message-ID: <3462.980535840@sss.pgh.pa.us> (raw)
In-Reply-To: <3A71B396.43FB80D@agliodbs.com>
References: <3A71B396.43FB80D@agliodbs.com>

Josh Berkus <josh@agliodbs.com> writes:
> 	Currently (7.0.3) the PLPGSQL function compiler permits only one RETURN
> statment, at the end of the function.  RETURN statements placed
> elsewhere cause a compile error.

Say what?

regression=# create function foo(int) returns int as '
regression'# begin
regression'#   if $1 > 10 then return $1;
regression'#   end if;
regression'#   return $1 - 1;
regression'# end;' language 'plpgsql';
CREATE
regression=# select foo(1);
 foo
-----
   0
(1 row)

regression=# select foo(100);
 foo
-----
 100
(1 row)

regression=#

Works fine for me in both 7.0.2 and current.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <3462.980535840@sss.pgh.pa.us>
Permalink:  ../3462.980535840@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3462.980535840@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com
  Subject: Re: Request for change in PL/PGSQL function handler
  In-Reply-To: <3462.980535840@sss.pgh.pa.us>
  References: <3A71B396.43FB80D@agliodbs.com> <3462.980535840@sss.pgh.pa.us>

* 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