ERROR: control reached end of function without RETURN

Поиск
Список
Период
Сортировка
От Ignacio Colmenero
Тема ERROR: control reached end of function without RETURN
Дата
Msg-id 20050211185117.RZHU6731.priv-edtnes57.telusplanet.net@ignacio
обсуждение исходный текст
Ответы Re: ERROR: control reached end of function without RETURN
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: size in bytes of a table?
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: test datatype for ANY