3.17.0 bug report: FTS5 insertion puts a wrong value in last_insert_rowid

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

3.17.0 bug report: FTS5 insertion puts a wrong value in last_insert_rowid

Gwendal Roué-2
Hello,

I have found a regression in SQLite 3.17.0. In the following SQL statements:

    CREATE VIRTUAL TABLE t1 USING FTS5(content);
    INSERT INTO t1(content) VALUES ('some text');
    SELECT last_insert_rowid(); // 10 (wrong)
    SELECT rowid FROM t1;       // 1

The expected value of the the SQL function last_insert_rowid() function is 1, not 10. Same for the C function sqlite3_last_insert_rowid().

This bug was not present in 3.16.2.

This bug is very similar to http://www.sqlite.org/src/tktview?name=13137dccf3, which affected FTS3.

Cheers,
Gwendal Roué

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 3.17.0 bug report: FTS5 insertion puts a wrong value in last_insert_rowid

Florian Weimer
* Gwendal Roué:

> I have found a regression in SQLite 3.17.0. In the following SQL statements:
>
>     CREATE VIRTUAL TABLE t1 USING FTS5(content);
>     INSERT INTO t1(content) VALUES ('some text');
>     SELECT last_insert_rowid(); // 10 (wrong)
>     SELECT rowid FROM t1;       // 1
>
> The expected value of the the SQL function last_insert_rowid()
> function is 1, not 10. Same for the C function
> sqlite3_last_insert_rowid().

I think this is a known issue.  SQLite 3.18 adds a
sqlite3_set_last_insert_rowid() function and uses it in “the new
interface in the FTS3, FTS4, and FTS5 extensions to ensure that the
sqlite3_last_insert_rowid() interface always returns reasonable
values”.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 3.17.0 bug report: FTS5 insertion puts a wrong value in last_insert_rowid

Gwendal Roué-2
In reply to this post by Gwendal Roué-2

* Florian Weimer <[hidden email]> wrote:

> * Gwendal Roué:
>
>> I have found a regression in SQLite 3.17.0. In the following SQL statements:
>>
>>    CREATE VIRTUAL TABLE t1 USING FTS5(content);
>>    INSERT INTO t1(content) VALUES ('some text');
>>    SELECT last_insert_rowid(); // 10 (wrong)
>>    SELECT rowid FROM t1;       // 1
>>
>> The expected value of the the SQL function last_insert_rowid()
>> function is 1, not 10. Same for the C function
>> sqlite3_last_insert_rowid().
>
> I think this is a known issue.

I am not sure this is a known issue: I don't find it in the tickets list (http://www.sqlite.org/src/reportlist).

> SQLite 3.18 adds a
> sqlite3_set_last_insert_rowid() function and uses it in “the new
> interface in the FTS3, FTS4, and FTS5 extensions to ensure that the
> sqlite3_last_insert_rowid() interface always returns reasonable
> values”.

The pending SQLite 3.18 indeed looks like it addresses this issue!

Gwendal Roué


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Loading...