I have observed a peculiar behavior for timeouts in transactions when
a transaction begins with a 'select' statement.  Basically, it seems
like the timeout setting is not honored in this instance and if an
'update' statement follows the 'select' statement, a 'database locked'
error message is immediately returned.  The following scenario can be
used to reproduce this behavior:

1. Create a database with a single table (I used the table name my_table)
2. Open two sessions using the SQLite CLI
3. Enter the following in session 1:

       begin immediate;

4. Enter the following in session 2 (demonstrates expected behavior):

       .timeout 10000
       begin;
       update my_table set userid=1;

    -> A 'database locked' error message is returned in 10 seconds.

       rollback;

5. Enter the following in session 2 (demonstrates unexpected behavior):

       .timeout 10000
       begin;
       select * from my_table;
       update my_table set userid=1;

    -> A 'database locked' error message is returned immediately.

       rollback;

Is this the expected behavior in SQLite, and if so, how can I have
SQLite honor the timeout value within transactions that begin with the
select statement?

Thanks,
Sigurdur
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to