\set ECHO none -- int SELECT count_distinct(x::int) FROM generate_series(1,1000) s(x); count_distinct ---------------- 1000 (1 row) SELECT count_distinct(mod(x,10)::int) FROM generate_series(1,1000) s(x); count_distinct ---------------- 10 (1 row) -- bigint SELECT count_distinct(x::bigint) FROM generate_series(1,1000) s(x); count_distinct ---------------- 1000 (1 row) SELECT count_distinct(mod(x,10)::bigint) FROM generate_series(1,1000) s(x); count_distinct ---------------- 10 (1 row) -- timestamp select count_distinct(now()::timestamp + (x || ' days')::interval) from generate_series(1,1000) s(x); count_distinct ---------------- 1000 (1 row) select count_distinct(now() + (x || ' days')::interval) from generate_series(1,1000) s(x); count_distinct ---------------- 1000 (1 row) -- bool select count_distinct(x::bool) from generate_series(0,1000) s(x); count_distinct ---------------- 2 (1 row) -- int2 select count_distinct(x::int2) from generate_series(1,1000) s(x); count_distinct ---------------- 1000 (1 row) ROLLBACK;