Hope Rule Is Willing To Discard Result Sets

Поиск
Список
Период
Сортировка
От CN LIOU
Тема Hope Rule Is Willing To Discard Result Sets
Дата
Msg-id 20030110075829.3520.qmail@graffiti.net
обсуждение исходный текст
Список pgsql-general
Hi!

Pgsql complains the result returned by the called function being not used:

CREATE RULE MyRule AS ON INSERT TO MyTable DO SELECT MyFunction(NEW.c1)

It also suggests PERFORM if the returned value wants to be discarded.  However, there is no such syntax as:

CREATE RULE MyRule AS ON INSERT TO MyTable DO PERFORM MyFunction(NEW.c1)

I know the following combination of function and trigger achieves my goal:

CREATE FUNCTION tf() RETURNS TRIGGER AS '
BEGIN
  PERFORM MyFunction(NEW.c1);
  RETURN NEW;
END' LANGUAGE 'plpgsql'

CREATE TRIGGER MyTrigger AFTER INSERT ON MyTable FOR EACH ROW EXECUTE PROCEDURE tf();

Rule would be more concise than trigger + function in this case if it accepted unused result set.  This is only a
better-to-havefeature, I presume. 

Regards,

CN
--
_______________________________________________
Get your free email from http://www.graffiti.net

Powered by Outblaze

В списке pgsql-general по дате отправления:

Предыдущее
От: "CN LIOU"
Дата:
Сообщение: Stable function Repeatedly Called
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: PostgreSQL/PHP: transactions: how-to abstract