On Tue, Jan 18, 2022 at 10:13 AM Mladen Gogala
wrote:
>
> mgogala=# create unique index test1_uq on test1(col1,coalesce(col2,'***
> EMPTY ***'));
>
> -> Bitmap Index Scan on test1_uq (cost=0.00..1.70 rows=6 width=0)
...
>Index Cond: (test1.col1 = 1)
>
> How
Postgres version is 13.5, platform is Oracle Linux 8.5, x86_64. Here is
the problem:
mgogala=# create table test1(col1 integer,col2 varchar(10));
CREATE TABLE
mgogala=# alter table test1 add constraint test1_uq unique(col1,col2);
ALTER TABLE
mgogala=# insert into test1 values(1,null);
INSERT 0