DROP FUNCTION IF EXISTS fn_GetRegisterFreeItemCount;
CREATE FUNCTION fn_GetRegisterFreeItemCount("RegisterID" UUID)
RETURNS int AS
 $$
Begin
	return
	(
		select count(*) from AKUZ.T_REGISTER_ITEM where RegisterMain = "RegisterID" and Register is null
	);
END $$
language plpgsql stable;