oguimbal / pg-mem

An in memory postgres DB instance for your unit tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating index on unique column results in not working unique constraint

dominik-zeglen opened this issue · comments

Describe the bug

If you create index on a column that is defined as UNIQUE, it stops being unique if you add index to it. Defining it as CREATE UNIQUE INDEX fixes it but it behaves differently than postgres.

To Reproduce

create table a (
    id serial not null primary key,
    name varchar(32) not null unique
);

insert into a ("name") values ('foo');
CREATE INDEX a_name_index ON a USING btree (name);

insert into a ("name") values ('foo');
select * from a;

pg-mem version

2.6.13

This could be related to #333 - can you check if that PR fixes your problem?

this PR has been released as pg-mem@2.7.0, so feel free to close if that fixes your issue :)