Thanks for the bug report.  The ticket is
https://www.sqlite.org/src/tktview/7b3328086a5c1

Your analysis of the problem seems spot on.  I'm guessing you spent a
long time debugging his....  Your efforts are appreciated.

On 10/2/16, Clemens Ladisch <[email protected]> wrote:
> Hi,
>
> if the transfer optimization needs to check if the destination table is
> empty, and if the optimization is actually used, and if the destination
> table uses AUTOINCREMENT, then the generated code does not update the
> sqlite_sequence table.
>
> After these statements, the row in dst should have rowid 2, but the
> rowid 1 got reused:
>
> create table src(a integer primary key autoincrement, b unique);
> create table dst(a integer primary key autoincrement, b unique);
> insert into src default values;
> insert into dst select * from src;
> -- select * from sqlite_sequence where name = 'dst'; is empty
> delete from dst;
> insert into dst default values;
> select a from dst;
> 1
>
> (reported by Matthew Moisen on <http://stackoverflow.com/q/39820552/11654>)
>
>
> Regards,
> Clemens
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to