ERROR: control reached end of function without RETURN - Mailing list pgsql-general

From Ignacio Colmenero
Subject ERROR: control reached end of function without RETURN
Date
Msg-id 20050211185117.RZHU6731.priv-edtnes57.telusplanet.net@ignacio
Whole thread Raw
Responses Re: ERROR: control reached end of function without RETURN
List pgsql-general

Hi all.

I created a function, using EMS:

CREATE OR REPLACE FUNCTION "geo_schema"."search_geo" () RETURNS SETOF varchar AS

$body$

declare x_longlat cursor for select long_lat from h2s ;

declare var_longlat public.geometry ;

declare x_id varchar ;

begin

     open x_longlat ;

     <<loop1>>

     loop

         fetch x_longlat into var_longlat ;

         if not found then

            close x_longlat ;

            exit ;

         end if ;

         select field_id from geo_table

         where within(var_longlat, geo_polygon) limit 1 into x_id ;

         if x_id <> '' then

            return next x_id ;

         end if ;

     end loop ;

end ;

$body$

LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY INVOKER;

When I debug it (using EMS tools), it works fine, and I get 73 rows, but when I run it like:

select * from search_geo() ;

I get the error: ERROR:  control reached end of function without RETURN

 

What can be wrong?

 

TIA

Ignacio.

 

-----------------------------------------------

Ignacio Colmenero

Software Development

Micotan Software Company Ltd.

 

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: size in bytes of a table?
Next
From: Michael Fuhr
Date:
Subject: Re: test datatype for ANY