storeset_int(p_set_comment integer, p_set_origin integer, p_set_id text)

8.135. storeset_int(p_set_comment integer, p_set_origin integer, p_set_id text)

Function Properties

Language: PLPGSQL

Return Type: integer

storeSet_int (set_id, set_origin, set_comment) Process the STORE_SET event, indicating the new set with given ID, origin node, and human readable comment.

declare
	v_dummy				int4;
begin
	select 1 into v_dummy
			from sl_set
			where set_id = p_set_id
			for update;
	if found then 
		update sl_set
				set set_comment = p_set_comment
				where set_id = p_set_id;
	else
		if not exists (select 1 from sl_node
						where no_id = p_set_origin) then
			perform storeNode_int (p_set_origin, '<event pending>');
		end if;
		insert into sl_set
				(set_id, set_origin, set_comment) values
				(p_set_id, p_set_origin, p_set_comment);
	end if;

	-- Run addPartialLogIndices() to try to add indices to unused sl_log_? table
	perform addPartialLogIndices();

	return p_set_id;
end;