Aviv Palivoda added the comment:

I looked into this error and I think the problem is the sqlite3_stmt_readonly 
check in _pysqlite_query_execute (cursor.c line 517):

    if (self->connection->begin_statement && 
!sqlite3_stmt_readonly(self->statement->st) && !self->statement->is_ddl) {
        if (sqlite3_get_autocommit(self->connection->db)) {
            result = _pysqlite_connection_begin(self->connection);
            if (!result) {
                goto error;
            }
            Py_DECREF(result);
        }
    }

As you can see we check if the current statement is not readonly and if so we 
start a transaction. The problem is that sqlite3_stmt_readonly return false for 
the "begin immediate" statement. When this happens we open a transaction with 
_pysqlite_connection_begin and then executing the "begin immediate".

I think this is a error in sqlite as the documentation says:
"ransaction control statements such as BEGIN, COMMIT, ROLLBACK, SAVEPOINT, and 
RELEASE cause sqlite3_stmt_readonly() to return true,"
(https://www.sqlite.org/c3ref/stmt_readonly.html)

----------
nosy: +palaviv

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28518>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to