Long-awaited inventory modifying plpgsql function added.