Re: [sqlite] Bug in unique index

2018-01-23 Thread petern
The second UNIQUE(v2,v1) constraint is redundant and equivalent to UNIQUE(v1,v2) Also consider that {(1,2),(2,1)} has no duplicates: sqlite> WITH test(v1,v2) AS (VALUES (1,2),(2,1)) SELECT DISTINCT * FROM test; v1,v2 1,2 2,1 Peter On Tue, Jan 23, 2018 at 8:35 AM, Domingo Alvarez Duarte wrote:

Re: [sqlite] Bug in unique index

2018-01-23 Thread Simon Slavin
> On 23 Jan 2018, at 4:35pm, Domingo Alvarez Duarte wrote: > > create table test( > id integer primary key, > v1 integer not null, > v2 integer not null constraint not_equal check(v1 != v2), > unique(v1, v2), > unique(v2, v1) > ); > > insert into test values(1, 1, 2); > ins

[sqlite] Bug in unique index

2018-01-23 Thread Domingo Alvarez Duarte
Hello ! Maybe I found a bug in sqlite3 unique index, see example bellow: bug-unique.sql drop table if exists test; create table test(     id integer primary key,     v1 integer not null,     v2 integer not null constraint not_equal check(v1 != v2),     unique(v1, v2),     unique(v2, v1) );