Return value in function/trigger

From: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Return value in function/trigger
Date: 2002-11-20 02:50:16
Message-ID: 3DDAF868.3010506@mega-bucks.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have created a trigger and the function executed by the trigger.
However the function merely updates values in a table and doesn't return
any result/value. what is the correct way of "returning" nothing?

I have written this but using "return new" seems pointless as I don't
need(?) to return anything.

create or replace function update_invoice_price() returns opaque as '
begin
update invoices set total_price=(select sum(price) from invoice_li
where invoice_id=new.invoice_id) where id=new.invoice_id;
return new;
end;
' language 'plpgsql' with (iscachable);

create trigger update_invoice_li_price after update
on invoice_li for each row
execute procedure update_invoice_price();

Thanks!

Jc

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-11-20 03:29:30 Re: Return value in function/trigger
Previous Message Charles H. Woloszynski 2002-11-20 01:22:31 Re: Enterprise readiness - mirroring / incremental backup