Open kornate opened 1 year ago
I've met the same issue
Try to remove COMMUTATOR
from operator overloading
CREATE OR REPLACE FUNCTION compare_type_id_equality(lhs_id typeid, rhs_id VARCHAR)
RETURNS BOOLEAN AS $$
SELECT lhs_id = typeid_parse(rhs_id);
$$ LANGUAGE SQL IMMUTABLE;
CREATE OPERATOR = (
LEFTARG = typeid,
RIGHTARG = varchar,
FUNCTION = compare_type_id_equality,
NEGATOR = !=,
HASHES,
MERGES
);
When you provide COMMUTATOR
parameter - PostgreSQL creates 2 operators for =
- (typeid, varchar) and (varchar, typeid) and when on left side you have varchar
value PostgreSQL try to execute function for validating typeid
on right side even if you have no typeid
type there
With COMMUTATOR
Without COMMUTATOR
Has anyone managed to get typeid-sql working with rails/activerecord/postgres?
Despite hours and hours of trying, I cannot get past this error: