Hello!

I tested the patch, and I see two possible issues with it

1. It seems to only look for direct operands:

create type t_rec as (a numeric, b int);
create table t_having (id int, r t_rec);
insert into t_having values
  (1, row(100,1)::t_rec),
  (2, row(100.0,1)::t_rec),
  (3, row(2,2)::t_rec);
select r, count(*) from t_having group by r having r *=
row(100,1)::t_rec; -- 2, correct
select r, count(*) from t_having group by r having
row((r).a,(r).b)::t_rec *= row(100,1)::t_rec; -- 1, incorrect

2. unknown operators (non btree/hash) seem to behave incorrectly, they
default to non-conflicting but they should conflict?

CREATE FUNCTION num_image_eq(numeric, numeric) RETURNS bool
  LANGUAGE sql IMMUTABLE AS $$ SELECT $1::text = $2::text $$;
CREATE OPERATOR === (LEFTARG = numeric, RIGHTARG = numeric, FUNCTION =
num_image_eq);
CREATE TABLE g_hole (g numeric, v int);
INSERT INTO g_hole VALUES (100, 1), (100.0, 2), (100.00, 3);
SELECT g, count(*), sum(v) FROM g_hole GROUP BY g;   -- 100 | 3 | 6
SELECT g, count(*), sum(v) FROM g_hole GROUP BY g HAVING g === 100.0;
-- 100 | 1 | 2


Reply via email to