Обсуждение: control reaches end of trigger procedure without RETURN

Поиск
Список
Период
Сортировка

control reaches end of trigger procedure without RETURN

От
rramostalo@quorum.com
Дата:

create function duplicate_images() returns OPAQUE as'    DECLARE         myrec RECORD;    BEGIN         if TG_OP =
''INSERT''then              select * into myrec from images where page=NEW.page and
 
path=NEW.path;              if found then                   raise exception ''insert failed: duplicate record found'';
           end if;         end if;    end;
 
' language 'plpgsql';




Re: control reaches end of trigger procedure without RETURN

От
Jeff Eckermann
Дата:
The error says it.

In this case, you need to add "return NEW;" before the
"end;"

--- rramostalo@quorum.com wrote:
> 
> 
> create function duplicate_images() returns OPAQUE
> as'
>      DECLARE
>           myrec RECORD;
>      BEGIN
>           if TG_OP = ''INSERT'' then
>                select * into myrec from images where
> page=NEW.page and
> path=NEW.path;
>                if found then
>                     raise exception ''insert failed:
> duplicate record found'';
>                end if;
>           end if;
>      end;
> ' language 'plpgsql';
> 
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com