add "distinct" functionality for cursors, tests