By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE EXTENSION
CREATE FUNCTION
CREATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1
ERROR: duplicate key value violates unique constraint "address_uni" DETAIL: Key (town, street, building)=(t2, s, null) already exists.
ERROR: duplicate key value violates unique constraint "address_uni" DETAIL: Key (town, street, building)=(t1, s, 9) already exists.
ERROR: conflicting key value violates exclusion constraint "address_with_null_building" DETAIL: Key (hash_record_extended(ROW(town, street), 0::bigint), texthash_int8range(building))=(8691446948776307684, (,)) conflicts with existing key (hash_record_extended(ROW(town, street), 0::bigint), texthash_int8range(building))=(8691446948776307684, [1993718048345588864,1993718048345588865)).
ERROR: conflicting key value violates exclusion constraint "address_with_null_building" DETAIL: Key (hash_record_extended(ROW(town, street), 0::bigint), texthash_int8range(building))=(3825496747261263164, [1993718048345588864,1993718048345588865)) conflicts with existing key (hash_record_extended(ROW(town, street), 0::bigint), texthash_int8range(building))=(3825496747261263164, (,)).