BEGIN; CREATE TYPE int8alias1; CREATE FUNCTION int8alias1in(cstring) RETURNS int8alias1 STRICT IMMUTABLE LANGUAGE internal AS 'int8in'; CREATE FUNCTION int8alias1out(int8alias1) RETURNS cstring STRICT IMMUTABLE LANGUAGE internal AS 'int8out'; CREATE TYPE int8alias1 (input = int8alias1in, output = int8alias1out, like = int8); CREATE CAST (int8 AS int8alias1) WITHOUT FUNCTION; CREATE FUNCTION int8alias1eq(int8alias1, int8alias1) RETURNS bool STRICT IMMUTABLE LANGUAGE internal AS 'int8eq'; CREATE OPERATOR = ( procedure = int8alias1eq, leftarg = int8alias1, rightarg = int8alias1, commutator = =, merges ); CREATE FUNCTION int8alias1lt(int8alias1, int8alias1) RETURNS bool STRICT IMMUTABLE LANGUAGE internal AS 'int8lt'; CREATE OPERATOR < (procedure = int8alias1lt, leftarg = int8alias1, rightarg = int8alias1); CREATE FUNCTION int8alias1gt(int8alias1, int8alias1) RETURNS bool STRICT IMMUTABLE LANGUAGE internal AS 'int8gt'; CREATE OPERATOR > (procedure = int8alias1gt, leftarg = int8alias1, rightarg = int8alias1); CREATE FUNCTION int8alias1cmp(int8alias1, int8alias1) RETURNS int STRICT IMMUTABLE LANGUAGE internal AS 'btint8cmp'; ALTER OPERATOR FAMILY integer_ops USING btree ADD OPERATOR 3 = (int8alias1, int8alias1), -- OPERATOR 1 < (int8alias1, int8alias1), OPERATOR 5 > (int8alias1, int8alias1), FUNCTION 1 int8alias1cmp(int8alias1, int8alias1); CREATE TABLE t1 (b int8alias1); CREATE TABLE t2 (b int8alias1); SET enable_nestloop = off; SET enable_hashjoin = off; SET enable_mergejoin = on; EXPLAIN (COSTS OFF) SELECT * FROM t1 JOIN t2 ON t1.b = t2.b; ROLLBACK; /* Expected on vanilla PostgreSQL: ERROR: missing operator 1(1...) in opfamily 1976 Expected with the patch applied: QUERY PLAN ------------------------------------ Nested Loop Disabled: true Join Filter: (t1.b = t2.b) -> Seq Scan on t1 -> Seq Scan on t2 (5 rows) */