Home > Archive > PostgreSQL Bugs > December 2005 > Re: BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs corr









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: BUGs for function returning a SETOF values on linux postgres 8.0.4, the same function runs corr
Michael Fuhr

2005-12-01, 1:24 pm

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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com