Simon L wrote 2011-10-25 06:20:
To reproduce this problem, enter the following 5 SQL statements at the
SQLite command line.

create table X(id INTEGER primary key ON CONFLICT REPLACE);
create table Y(id INTEGER primary key ON CONFLICT REPLACE);
insert into X values (1);
insert into Y select * from X;
insert into Y select * from X;


When I tried to run the last SQL statement twice,  SQLite produced the
following error message.
Error: PRIMARY KEY must be unique


Is this a bug? Please advise. Thank you.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

This certainly looks like a bug. I got a constraint failure when I tried it in 
sqlite 3.7.8.

But it works fine when you state the column name explicitly in the select 
clause.

Like this:

create table X(id INTEGER primary key ON CONFLICT REPLACE);
create table Y(id INTEGER primary key ON CONFLICT REPLACE);
insert into X values (1);
insert into Y select id from X;
insert into Y select id from X;

I recall the "INSERT INTO ... SELECT * ..." had a bug related to foreign key 
checks,
which was reported on the mailing list earlier this year:

http://www.sqlite.org/src/tktview?name=6284df89de

Hopefully, a member of the sqlite dev team will acknowledge this bug soon.
----------
Regards,
David

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

Reply via email to