CREATE FUNCTION bs_eq(bs_date, bs_date) RETURNS BOOLEAN
AS 'MODULE_PATHNAME', 'bs_eq'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION bs_ne(bs_date, bs_date) RETURNS BOOLEAN
AS 'MODULE_PATHNAME', 'bs_ne'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION bs_gt(bs_date, bs_date) RETURNS BOOLEAN
AS 'MODULE_PATHNAME', 'bs_gt'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION bs_ge(bs_date, bs_date) RETURNS BOOLEAN
AS 'MODULE_PATHNAME', 'bs_ge'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION bs_lt(bs_date, bs_date) RETURNS BOOLEAN
AS 'MODULE_PATHNAME', 'bs_lt'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION bs_le(bs_date, bs_date) RETURNS BOOLEAN
AS 'MODULE_PATHNAME', 'bs_le'
LANGUAGE C IMMUTABLE STRICT;

CREATE OPERATOR = (
  LEFTARG = bs_date,
  RIGHTARG = bs_date,
  PROCEDURE = bs_eq
);

CREATE OPERATOR <> (
  LEFTARG = bs_date,
  RIGHTARG = bs_date,
  PROCEDURE = bs_ne
);

CREATE OPERATOR > (
  LEFTARG = bs_date,
  RIGHTARG = bs_date,
  PROCEDURE = bs_gt
);

CREATE OPERATOR >= (
  LEFTARG = bs_date,
  RIGHTARG = bs_date,
  PROCEDURE = bs_ge
);

CREATE OPERATOR < (
  LEFTARG = bs_date,
  RIGHTARG = bs_date,
  PROCEDURE = bs_lt
);

CREATE OPERATOR <= (
  LEFTARG = bs_date,
  RIGHTARG = bs_date,
  PROCEDURE = bs_le
);

CREATE FUNCTION bs_date_cmp(bs_date, bs_date) RETURNS INTEGER
AS 'MODULE_PATHNAME', 'bs_date_cmp'
LANGUAGE C IMMUTABLE STRICT;

CREATE OPERATOR CLASS bs_date_ops
DEFAULT FOR TYPE bs_date USING btree AS
  OPERATOR 1 < ,
  OPERATOR 2 <= ,
  OPERATOR 3 = ,
  OPERATOR 4 >= ,
  OPERATOR 5 > ,
  FUNCTION 1 bs_date_cmp(bs_date, bs_date);

