Christopher B. Browne's Home Page
cbbrowne@acm.org

8.68. forwardconfirm(integer, integer, bigint, timestamp without time zone)

Function Properties

PLPGSQLbigint
forwardConfirm (p_con_origin, p_con_received, p_con_seqno, p_con_timestamp) Confirms (recorded in sl_confirm) that items from p_con_origin up to p_con_seqno have been received by node p_con_received as of p_con_timestamp, and raises an event to forward this confirmation.
    declare
    	p_con_origin	alias for $1;
    	p_con_received	alias for $2;
    	p_con_seqno		alias for $3;
    	p_con_timestamp	alias for $4;
    	v_max_seqno		bigint;
    begin
    	select into v_max_seqno coalesce(max(con_seqno), 0)
    			from sl_confirm
    			where con_origin = p_con_origin
    			and con_received = p_con_received;
    	if v_max_seqno < p_con_seqno then
    		insert into sl_confirm 
    				(con_origin, con_received, con_seqno, con_timestamp)
    				values (p_con_origin, p_con_received, p_con_seqno,
    					p_con_timestamp);
    		v_max_seqno = p_con_seqno;
    	end if;
    
    	return v_max_seqno;
    end;

Google
Contact me at cbbrowne@acm.org