CREATE TABLE test AS SELECT id FROM generate_series(1, 1000) i(id);

CREATE ACCESS METHOD mybtree
    TYPE INDEX
    HANDLER bthandler;

CREATE OPERATOR FAMILY integer_ops
    USING mybtree;

CREATE OPERATOR CLASS test_int8_ops
    DEFAULT FOR TYPE int8 USING mybtree FAMILY integer_ops AS
    -- standard int8 comparisons
    OPERATOR 1 < ,
    OPERATOR 2 <= ,
    OPERATOR 3 = ,
    OPERATOR 4 >= ,
    OPERATOR 5 > ,
    FUNCTION 1 btint8cmp(int8, int8) ,
    FUNCTION 2 btint8sortsupport(internal) ,
    FUNCTION 3 in_range(int8, int8, int8, boolean, boolean) ,
    FUNCTION 4 btequalimage(oid) ;

CREATE UNIQUE INDEX it ON test USING mybtree (id);