CREATE OR REPLACE FUNCTION ilikemac(macaddr, text)
RETURNS boolean AS
$$
BEGIN
RETURN ($1::text) ilike ($2) ;
END;
$$ LANGUAGE 'plpgsql' IMMUTABLE;

CREATE OPERATOR ~~* (
    LEFTARG = macaddr,
    RIGHTARG = text,
    PROCEDURE = ilikemac
);


CREATE OR REPLACE FUNCTION ilikeinet(inet, text)
RETURNS boolean AS
$$
BEGIN
RETURN $1::text ilike $2;
END;
$$ LANGUAGE 'plpgsql' IMMUTABLE;

CREATE OPERATOR ~~* (
    LEFTARG = inet,
    RIGHTARG = text,
    PROCEDURE = ilikeinet
);