> On 23 Jan 2018, at 4:35pm, Domingo Alvarez Duarte <mingo...@gmail.com> 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);
> insert into test values(2, 2, 1); [snip]
> 
> I was expecting to have an error trying to insert the second row but sqlite3 
> accepted the duplicated index without error.

You are not seeing any duplicates.

You have two separate UNIQUE requirements (which are equivalent to one-another, 
so one is not needed).  One of them is seeing (1, 2) and then (2, 1).  The 
other is seeing (2, 1) and then (1, 2).  Neither of them is seeing a duplicate.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to