Re: BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs correctly on win postgres 8.1

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Susan Fu <susan(dot)fu(at)vericept(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs correctly on win postgres 8.1
Date: 2005-12-01 17:33:46
Message-ID: 20051201173346.GA71318@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Nov 30, 2005 at 02:53:44PM -0700, Susan Fu wrote:
> I am trying to run a very simple test on the above version. This test
> works fine on my window 8.1 version.
> If I am taking out the function on the 8.0.4 version on linux as just
> the select (SELECT DISTINCT value FROM colors) I can see the results.
> If run via a function call I got the following error:
>
> Failed to execute SQL : SQL select * from tt(); failed : ERROR: control reached end of function without RETURN CONTEXT: PL/pgSQL function "tt"

The PL/pgSQL documentation for 8.0 and earlier says this:

The return value of a function cannot be left undefined. If control
reaches the end of the top-level block of the function without hitting
a RETURN statement, a run-time error will occur.

The 8.1 Release Notes show that this requirement has been removed:

* No longer require functions to issue a RETURN statement (Tom)

This is a byproduct of the newly added OUT and INOUT functionality.
RETURN can be omitted when it is not needed to provide the function's
return value.

--
Michael Fuhr

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2005-12-01 18:01:52 Re: BUG #2084: Add WIN1253 to CLIENT_ENCODING encodings
Previous Message Tom Lane 2005-12-01 17:27:09 Re: BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs correctly on win postgres 8.1