Strange SQLite bug(?!)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange SQLite bug(?!)

mailing lists
Hi,

I have got a database that works using SQLite 3.7.7 but not with version SQLite 3.13.0. I get the assertion

Assertion failed: (((Fts3Table *)pVtab)->mxSavepoint < iSavepoint), function fts3SavepointMethod, file /.../sqlite/sqlite3.c, line 144649.

I have compiled the SQLite amalgamation with the options SQLITE_DEBUG=1 SQLITE_MEMDEBUG=1 SQLITE_THREADSAFE=1 SQLITE_ENABLE_RTREE=1 SQLITE_ENABLE_FTS3=1 SQLITE_ENABLE_FTS3_PARENTHESIS=1. I use this program to reproduce the assertion:

#include <iostream>

#include "sqlite3.h"

static void ExecuteStatement(sqlite3* databaseHandle, std::string const& sqlStatement)
{
        int           result;
        sqlite3_stmt* statementPtr(NULL);
       
        result = sqlite3_prepare_v2(databaseHandle,sqlStatement.c_str(),static_cast<int>(sqlStatement.size()),&statementPtr,NULL);
        if (result == SQLITE_OK)
        {
                result = sqlite3_step(statementPtr);
                if ((result == SQLITE_OK) || (result == SQLITE_DONE))
                        result = sqlite3_finalize(statementPtr);
        } /* if */
        if (result != SQLITE_OK)
                std::cout << sqlite3_errmsg(databaseHandle) << " (" << sqlStatement << ')' << std::endl;
}

int main(int argc, const char * argv[])
{
        sqlite3* databaseHandle(NULL);

        if (sqlite3_open_v2(„Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
        {
                ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
       
                ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
                ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
               
                ExecuteStatement(databaseHandle,"COMMIT;");
                sqlite3_close(databaseHandle);
        } /* if */
        else
                std::cout << sqlite3_errmsg(databaseHandle) << std::end;
}


I do not get any error output besides the failed assertion. I have run an integrity check on the database and I get the response „ok“.

I have seen that there has been a change in „sqlite3VtabSavepoint“ a while ago. Can this change be the source of this error?

Basically, I have no clue what is going on…

Best regards,
Hartwig
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Strange SQLite bug(?!)

Richard Hipp-3
Do you have a database schema to go with your sample program?

On 8/1/16, skywind mailing lists <[hidden email]> wrote:

> Hi,
>
> I have got a database that works using SQLite 3.7.7 but not with version
> SQLite 3.13.0. I get the assertion
>
> Assertion failed: (((Fts3Table *)pVtab)->mxSavepoint < iSavepoint), function
> fts3SavepointMethod, file /.../sqlite/sqlite3.c, line 144649.
>
> I have compiled the SQLite amalgamation with the options SQLITE_DEBUG=1
> SQLITE_MEMDEBUG=1 SQLITE_THREADSAFE=1 SQLITE_ENABLE_RTREE=1
> SQLITE_ENABLE_FTS3=1 SQLITE_ENABLE_FTS3_PARENTHESIS=1. I use this program to
> reproduce the assertion:
>
> #include <iostream>
>
> #include "sqlite3.h"
>
> static void ExecuteStatement(sqlite3* databaseHandle, std::string const&
> sqlStatement)
> {
> int           result;
> sqlite3_stmt* statementPtr(NULL);
>
> result =
> sqlite3_prepare_v2(databaseHandle,sqlStatement.c_str(),static_cast<int>(sqlStatement.size()),&statementPtr,NULL);
> if (result == SQLITE_OK)
> {
> result = sqlite3_step(statementPtr);
> if ((result == SQLITE_OK) || (result == SQLITE_DONE))
> result = sqlite3_finalize(statementPtr);
> } /* if */
> if (result != SQLITE_OK)
> std::cout << sqlite3_errmsg(databaseHandle) << " (" << sqlStatement << ')'
> << std::endl;
> }
>
> int main(int argc, const char * argv[])
> {
> sqlite3* databaseHandle(NULL);
>
> if (sqlite3_open_v2(„Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE |
> SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
> {
> ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
>
> ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
> ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
>
> ExecuteStatement(databaseHandle,"COMMIT;");
> sqlite3_close(databaseHandle);
> } /* if */
> else
> std::cout << sqlite3_errmsg(databaseHandle) << std::end;
> }
>
>
> I do not get any error output besides the failed assertion. I have run an
> integrity check on the database and I get the response „ok“.
>
> I have seen that there has been a change in „sqlite3VtabSavepoint“ a while
> ago. Can this change be the source of this error?
>
> Basically, I have no clue what is going on…
>
> Best regards,
> Hartwig
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


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

Re: Strange SQLite bug(?!)

mailing lists
Hi,

I have added a database but it seems to be that the zip file got lost.

Regards,
Hartwig


> Am 2016-08-02 um 01:13 schrieb Richard Hipp <[hidden email]>:
>
> Do you have a database schema to go with your sample program?
>
> On 8/1/16, skywind mailing lists <[hidden email] <mailto:[hidden email]>> wrote:
>> Hi,
>>
>> I have got a database that works using SQLite 3.7.7 but not with version
>> SQLite 3.13.0. I get the assertion
>>
>> Assertion failed: (((Fts3Table *)pVtab)->mxSavepoint < iSavepoint), function
>> fts3SavepointMethod, file /.../sqlite/sqlite3.c, line 144649.
>>
>> I have compiled the SQLite amalgamation with the options SQLITE_DEBUG=1
>> SQLITE_MEMDEBUG=1 SQLITE_THREADSAFE=1 SQLITE_ENABLE_RTREE=1
>> SQLITE_ENABLE_FTS3=1 SQLITE_ENABLE_FTS3_PARENTHESIS=1. I use this program to
>> reproduce the assertion:
>>
>> #include <iostream>
>>
>> #include "sqlite3.h"
>>
>> static void ExecuteStatement(sqlite3* databaseHandle, std::string const&
>> sqlStatement)
>> {
>> int           result;
>> sqlite3_stmt* statementPtr(NULL);
>>
>> result =
>> sqlite3_prepare_v2(databaseHandle,sqlStatement.c_str(),static_cast<int>(sqlStatement.size()),&statementPtr,NULL);
>> if (result == SQLITE_OK)
>> {
>> result = sqlite3_step(statementPtr);
>> if ((result == SQLITE_OK) || (result == SQLITE_DONE))
>> result = sqlite3_finalize(statementPtr);
>> } /* if */
>> if (result != SQLITE_OK)
>> std::cout << sqlite3_errmsg(databaseHandle) << " (" << sqlStatement << ')'
>> << std::endl;
>> }
>>
>> int main(int argc, const char * argv[])
>> {
>> sqlite3* databaseHandle(NULL);
>>
>> if (sqlite3_open_v2(„Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE |
>> SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
>> {
>> ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
>>
>> ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
>> ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
>>
>> ExecuteStatement(databaseHandle,"COMMIT;");
>> sqlite3_close(databaseHandle);
>> } /* if */
>> else
>> std::cout << sqlite3_errmsg(databaseHandle) << std::end;
>> }
>>
>>
>> I do not get any error output besides the failed assertion. I have run an
>> integrity check on the database and I get the response „ok“.
>>
>> I have seen that there has been a change in „sqlite3VtabSavepoint“ a while
>> ago. Can this change be the source of this error?
>>
>> Basically, I have no clue what is going on…
>>
>> Best regards,
>> Hartwig
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email] <mailto:[hidden email]>
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
>>
>
>
> --
> D. Richard Hipp
> [hidden email] <mailto:[hidden email]>
> _______________________________________________
> sqlite-users mailing list
> [hidden email] <mailto:[hidden email]>
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Strange SQLite bug(?!)

mailing lists
HI,

it seems to be that I am not allowed to add zip files to these e-mails.

This is what I am doing to create the database:

                ExecuteStatement(databaseHandle,"CREATE TABLE A(ID INTEGER PRIMARY KEY,AnotherID INTEGER, Notes TEXT);");
                ExecuteStatement(databaseHandle,"CREATE INDEX A_1 ON A (AnotherID);");
                ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE AFTS USING FTS3 (Notes);");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN DELETE FROM AFTS WHERE rowid=OLD.ID; END;");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER A_InsertTrigger AFTER INSERT ON A FOR EACH ROW BEGIN INSERT INTO AFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
                ExecuteStatement(databaseHandle,"INSERT INTO A (AnotherID,Notes) VALUES(1,'Record A1');");
               
                ExecuteStatement(databaseHandle,"CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT);");
                ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes);");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN DELETE FROM BFTS WHERE rowid=OLD.ID; END;");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER B_InsertTrigger AFTER INSERT ON B FOR EACH ROW BEGIN INSERT INTO BFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
                ExecuteStatement(databaseHandle,"INSERT INTO B (Notes) VALUES('Record B1');");

To reproduce the error I run the following commands firstly with „#if 1“ and the second time with „#if 0":

        if (sqlite3_open_v2("Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
        {
                ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");

#if 0
                ExecuteStatement(databaseHandle,"CREATE TABLE A(ID INTEGER PRIMARY KEY,AnotherID INTEGER, Notes TEXT);");
                ExecuteStatement(databaseHandle,"CREATE INDEX A_1 ON A (AnotherID);");
                ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE AFTS USING FTS3 (Notes);");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN DELETE FROM AFTS WHERE rowid=OLD.ID; END;");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER A_InsertTrigger AFTER INSERT ON A FOR EACH ROW BEGIN INSERT INTO AFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
                ExecuteStatement(databaseHandle,"INSERT INTO A (AnotherID,Notes) VALUES(1,'Record A1');");
               
                ExecuteStatement(databaseHandle,"CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT);");
                ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes);");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN DELETE FROM BFTS WHERE rowid=OLD.ID; END;");
                ExecuteStatement(databaseHandle,"CREATE TRIGGER B_InsertTrigger AFTER INSERT ON B FOR EACH ROW BEGIN INSERT INTO BFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
                ExecuteStatement(databaseHandle,"INSERT INTO B (Notes) VALUES('Record B1');");
#endif
               
                ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
                ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
               
                ExecuteStatement(databaseHandle,"COMMIT;");
                sqlite3_close(databaseHandle);
        } /* if */
        else
                std::cout << sqlite3_errmsg(databaseHandle) << std::end;

I could not reproduce the error from the shell.

Regards,
Hartwig

> Am 2016-08-02 um 07:56 schrieb skywind mailing lists <[hidden email]>:
>
> Hi,
>
> I have added a database but it seems to be that the zip file got lost.
>
> Regards,
> Hartwig
>
>
>> Am 2016-08-02 um 01:13 schrieb Richard Hipp <[hidden email]>:
>>
>> Do you have a database schema to go with your sample program?
>>
>> On 8/1/16, skywind mailing lists <[hidden email] <mailto:[hidden email]>> wrote:
>>> Hi,
>>>
>>> I have got a database that works using SQLite 3.7.7 but not with version
>>> SQLite 3.13.0. I get the assertion
>>>
>>> Assertion failed: (((Fts3Table *)pVtab)->mxSavepoint < iSavepoint), function
>>> fts3SavepointMethod, file /.../sqlite/sqlite3.c, line 144649.
>>>
>>> I have compiled the SQLite amalgamation with the options SQLITE_DEBUG=1
>>> SQLITE_MEMDEBUG=1 SQLITE_THREADSAFE=1 SQLITE_ENABLE_RTREE=1
>>> SQLITE_ENABLE_FTS3=1 SQLITE_ENABLE_FTS3_PARENTHESIS=1. I use this program to
>>> reproduce the assertion:
>>>
>>> #include <iostream>
>>>
>>> #include "sqlite3.h"
>>>
>>> static void ExecuteStatement(sqlite3* databaseHandle, std::string const&
>>> sqlStatement)
>>> {
>>> int           result;
>>> sqlite3_stmt* statementPtr(NULL);
>>>
>>> result =
>>> sqlite3_prepare_v2(databaseHandle,sqlStatement.c_str(),static_cast<int>(sqlStatement.size()),&statementPtr,NULL);
>>> if (result == SQLITE_OK)
>>> {
>>> result = sqlite3_step(statementPtr);
>>> if ((result == SQLITE_OK) || (result == SQLITE_DONE))
>>> result = sqlite3_finalize(statementPtr);
>>> } /* if */
>>> if (result != SQLITE_OK)
>>> std::cout << sqlite3_errmsg(databaseHandle) << " (" << sqlStatement << ')'
>>> << std::endl;
>>> }
>>>
>>> int main(int argc, const char * argv[])
>>> {
>>> sqlite3* databaseHandle(NULL);
>>>
>>> if (sqlite3_open_v2(„Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE |
>>> SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
>>> {
>>> ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
>>>
>>> ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
>>> ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
>>>
>>> ExecuteStatement(databaseHandle,"COMMIT;");
>>> sqlite3_close(databaseHandle);
>>> } /* if */
>>> else
>>> std::cout << sqlite3_errmsg(databaseHandle) << std::end;
>>> }
>>>
>>>
>>> I do not get any error output besides the failed assertion. I have run an
>>> integrity check on the database and I get the response „ok“.
>>>
>>> I have seen that there has been a change in „sqlite3VtabSavepoint“ a while
>>> ago. Can this change be the source of this error?
>>>
>>> Basically, I have no clue what is going on…
>>>
>>> Best regards,
>>> Hartwig
>>> _______________________________________________
>>> sqlite-users mailing list
>>> [hidden email] <mailto:[hidden email]>
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
>>>
>>
>>
>> --
>> D. Richard Hipp
>> [hidden email] <mailto:[hidden email]>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email] <mailto:[hidden email]>
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

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

Re: Strange SQLite bug(?!)

Dan Kennedy-4
On 08/02/2016 01:01 PM, skywind mailing lists wrote:
> HI,
>
> it seems to be that I am not allowed to add zip files to these e-mails.

Thanks for reporting this. Should now be fixed here:

   http://sqlite.org/src/info/e64a4173d2899acf

Dan.



>
> This is what I am doing to create the database:
>
> ExecuteStatement(databaseHandle,"CREATE TABLE A(ID INTEGER PRIMARY KEY,AnotherID INTEGER, Notes TEXT);");
> ExecuteStatement(databaseHandle,"CREATE INDEX A_1 ON A (AnotherID);");
> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE AFTS USING FTS3 (Notes);");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN DELETE FROM AFTS WHERE rowid=OLD.ID; END;");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_InsertTrigger AFTER INSERT ON A FOR EACH ROW BEGIN INSERT INTO AFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
> ExecuteStatement(databaseHandle,"INSERT INTO A (AnotherID,Notes) VALUES(1,'Record A1');");
>
> ExecuteStatement(databaseHandle,"CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT);");
> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes);");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN DELETE FROM BFTS WHERE rowid=OLD.ID; END;");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_InsertTrigger AFTER INSERT ON B FOR EACH ROW BEGIN INSERT INTO BFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
> ExecuteStatement(databaseHandle,"INSERT INTO B (Notes) VALUES('Record B1');");
>
> To reproduce the error I run the following commands firstly with „#if 1“ and the second time with „#if 0":
>
> if (sqlite3_open_v2("Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
> {
> ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
>
> #if 0
> ExecuteStatement(databaseHandle,"CREATE TABLE A(ID INTEGER PRIMARY KEY,AnotherID INTEGER, Notes TEXT);");
> ExecuteStatement(databaseHandle,"CREATE INDEX A_1 ON A (AnotherID);");
> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE AFTS USING FTS3 (Notes);");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN DELETE FROM AFTS WHERE rowid=OLD.ID; END;");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_InsertTrigger AFTER INSERT ON A FOR EACH ROW BEGIN INSERT INTO AFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
> ExecuteStatement(databaseHandle,"INSERT INTO A (AnotherID,Notes) VALUES(1,'Record A1');");
>
> ExecuteStatement(databaseHandle,"CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT);");
> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes);");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN DELETE FROM BFTS WHERE rowid=OLD.ID; END;");
> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_InsertTrigger AFTER INSERT ON B FOR EACH ROW BEGIN INSERT INTO BFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
> ExecuteStatement(databaseHandle,"INSERT INTO B (Notes) VALUES('Record B1');");
> #endif
>
> ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
> ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
>
> ExecuteStatement(databaseHandle,"COMMIT;");
> sqlite3_close(databaseHandle);
> } /* if */
> else
> std::cout << sqlite3_errmsg(databaseHandle) << std::end;
>
> I could not reproduce the error from the shell.
>
> Regards,
> Hartwig
>
>> Am 2016-08-02 um 07:56 schrieb skywind mailing lists <[hidden email]>:
>>
>> Hi,
>>
>> I have added a database but it seems to be that the zip file got lost.
>>
>> Regards,
>> Hartwig
>>
>>
>>> Am 2016-08-02 um 01:13 schrieb Richard Hipp <[hidden email]>:
>>>
>>> Do you have a database schema to go with your sample program?
>>>
>>> On 8/1/16, skywind mailing lists <[hidden email] <mailto:[hidden email]>> wrote:
>>>> Hi,
>>>>
>>>> I have got a database that works using SQLite 3.7.7 but not with version
>>>> SQLite 3.13.0. I get the assertion
>>>>
>>>> Assertion failed: (((Fts3Table *)pVtab)->mxSavepoint < iSavepoint), function
>>>> fts3SavepointMethod, file /.../sqlite/sqlite3.c, line 144649.
>>>>
>>>> I have compiled the SQLite amalgamation with the options SQLITE_DEBUG=1
>>>> SQLITE_MEMDEBUG=1 SQLITE_THREADSAFE=1 SQLITE_ENABLE_RTREE=1
>>>> SQLITE_ENABLE_FTS3=1 SQLITE_ENABLE_FTS3_PARENTHESIS=1. I use this program to
>>>> reproduce the assertion:
>>>>
>>>> #include <iostream>
>>>>
>>>> #include "sqlite3.h"
>>>>
>>>> static void ExecuteStatement(sqlite3* databaseHandle, std::string const&
>>>> sqlStatement)
>>>> {
>>>> int           result;
>>>> sqlite3_stmt* statementPtr(NULL);
>>>>
>>>> result =
>>>> sqlite3_prepare_v2(databaseHandle,sqlStatement.c_str(),static_cast<int>(sqlStatement.size()),&statementPtr,NULL);
>>>> if (result == SQLITE_OK)
>>>> {
>>>> result = sqlite3_step(statementPtr);
>>>> if ((result == SQLITE_OK) || (result == SQLITE_DONE))
>>>> result = sqlite3_finalize(statementPtr);
>>>> } /* if */
>>>> if (result != SQLITE_OK)
>>>> std::cout << sqlite3_errmsg(databaseHandle) << " (" << sqlStatement << ')'
>>>> << std::endl;
>>>> }
>>>>
>>>> int main(int argc, const char * argv[])
>>>> {
>>>> sqlite3* databaseHandle(NULL);
>>>>
>>>> if (sqlite3_open_v2(„Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE |
>>>> SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
>>>> {
>>>> ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
>>>>
>>>> ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
>>>> ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
>>>>
>>>> ExecuteStatement(databaseHandle,"COMMIT;");
>>>> sqlite3_close(databaseHandle);
>>>> } /* if */
>>>> else
>>>> std::cout << sqlite3_errmsg(databaseHandle) << std::end;
>>>> }
>>>>
>>>>
>>>> I do not get any error output besides the failed assertion. I have run an
>>>> integrity check on the database and I get the response „ok“.
>>>>
>>>> I have seen that there has been a change in „sqlite3VtabSavepoint“ a while
>>>> ago. Can this change be the source of this error?
>>>>
>>>> Basically, I have no clue what is going on…
>>>>
>>>> Best regards,
>>>> Hartwig
>>>> _______________________________________________
>>>> sqlite-users mailing list
>>>> [hidden email] <mailto:[hidden email]>
>>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
>>>>
>>>
>>> --
>>> D. Richard Hipp
>>> [hidden email] <mailto:[hidden email]>
>>> _______________________________________________
>>> sqlite-users mailing list
>>> [hidden email] <mailto:[hidden email]>
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email]
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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

Re: Strange SQLite bug(?!)

mailing lists
Thanks!

In the meantime I found out that version 3.8.8.3 is still working while 3.9.0.0 fails.

Regards,
Hartwig

> Am 2016-08-02 um 18:47 schrieb Dan Kennedy <[hidden email]>:
>
> On 08/02/2016 01:01 PM, skywind mailing lists wrote:
>> HI,
>>
>> it seems to be that I am not allowed to add zip files to these e-mails.
>
> Thanks for reporting this. Should now be fixed here:
>
>  http://sqlite.org/src/info/e64a4173d2899acf <http://sqlite.org/src/info/e64a4173d2899acf>
>
> Dan.
>
>
>
>>
>> This is what I am doing to create the database:
>>
>> ExecuteStatement(databaseHandle,"CREATE TABLE A(ID INTEGER PRIMARY KEY,AnotherID INTEGER, Notes TEXT);");
>> ExecuteStatement(databaseHandle,"CREATE INDEX A_1 ON A (AnotherID);");
>> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE AFTS USING FTS3 (Notes);");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN DELETE FROM AFTS WHERE rowid=OLD.ID; END;");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_InsertTrigger AFTER INSERT ON A FOR EACH ROW BEGIN INSERT INTO AFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
>> ExecuteStatement(databaseHandle,"INSERT INTO A (AnotherID,Notes) VALUES(1,'Record A1');");
>>
>> ExecuteStatement(databaseHandle,"CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT);");
>> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes);");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN DELETE FROM BFTS WHERE rowid=OLD.ID; END;");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_InsertTrigger AFTER INSERT ON B FOR EACH ROW BEGIN INSERT INTO BFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
>> ExecuteStatement(databaseHandle,"INSERT INTO B (Notes) VALUES('Record B1');");
>>
>> To reproduce the error I run the following commands firstly with „#if 1“ and the second time with „#if 0":
>>
>> if (sqlite3_open_v2("Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
>> {
>> ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
>>
>> #if 0
>> ExecuteStatement(databaseHandle,"CREATE TABLE A(ID INTEGER PRIMARY KEY,AnotherID INTEGER, Notes TEXT);");
>> ExecuteStatement(databaseHandle,"CREATE INDEX A_1 ON A (AnotherID);");
>> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE AFTS USING FTS3 (Notes);");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_DeleteTrigger AFTER DELETE ON A FOR EACH ROW BEGIN DELETE FROM AFTS WHERE rowid=OLD.ID; END;");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER A_InsertTrigger AFTER INSERT ON A FOR EACH ROW BEGIN INSERT INTO AFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
>> ExecuteStatement(databaseHandle,"INSERT INTO A (AnotherID,Notes) VALUES(1,'Record A1');");
>>
>> ExecuteStatement(databaseHandle,"CREATE TABLE B(ID INTEGER PRIMARY KEY,Notes TEXT);");
>> ExecuteStatement(databaseHandle,"CREATE VIRTUAL TABLE BFTS USING FTS3 (Notes);");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_DeleteTrigger AFTER DELETE ON B FOR EACH ROW BEGIN DELETE FROM BFTS WHERE rowid=OLD.ID; END;");
>> ExecuteStatement(databaseHandle,"CREATE TRIGGER B_InsertTrigger AFTER INSERT ON B FOR EACH ROW BEGIN INSERT INTO BFTS (rowid,Notes) VALUES (NEW.ID,NEW.Notes); END;");
>> ExecuteStatement(databaseHandle,"INSERT INTO B (Notes) VALUES('Record B1');");
>> #endif
>>
>> ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
>> ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
>>
>> ExecuteStatement(databaseHandle,"COMMIT;");
>> sqlite3_close(databaseHandle);
>> } /* if */
>> else
>> std::cout << sqlite3_errmsg(databaseHandle) << std::end;
>>
>> I could not reproduce the error from the shell.
>>
>> Regards,
>> Hartwig
>>
>>> Am 2016-08-02 um 07:56 schrieb skywind mailing lists <[hidden email]>:
>>>
>>> Hi,
>>>
>>> I have added a database but it seems to be that the zip file got lost.
>>>
>>> Regards,
>>> Hartwig
>>>
>>>
>>>> Am 2016-08-02 um 01:13 schrieb Richard Hipp <[hidden email]>:
>>>>
>>>> Do you have a database schema to go with your sample program?
>>>>
>>>> On 8/1/16, skywind mailing lists <[hidden email] <mailto:[hidden email]>> wrote:
>>>>> Hi,
>>>>>
>>>>> I have got a database that works using SQLite 3.7.7 but not with version
>>>>> SQLite 3.13.0. I get the assertion
>>>>>
>>>>> Assertion failed: (((Fts3Table *)pVtab)->mxSavepoint < iSavepoint), function
>>>>> fts3SavepointMethod, file /.../sqlite/sqlite3.c, line 144649.
>>>>>
>>>>> I have compiled the SQLite amalgamation with the options SQLITE_DEBUG=1
>>>>> SQLITE_MEMDEBUG=1 SQLITE_THREADSAFE=1 SQLITE_ENABLE_RTREE=1
>>>>> SQLITE_ENABLE_FTS3=1 SQLITE_ENABLE_FTS3_PARENTHESIS=1. I use this program to
>>>>> reproduce the assertion:
>>>>>
>>>>> #include <iostream>
>>>>>
>>>>> #include "sqlite3.h"
>>>>>
>>>>> static void ExecuteStatement(sqlite3* databaseHandle, std::string const&
>>>>> sqlStatement)
>>>>> {
>>>>> int           result;
>>>>> sqlite3_stmt* statementPtr(NULL);
>>>>>
>>>>> result =
>>>>> sqlite3_prepare_v2(databaseHandle,sqlStatement.c_str(),static_cast<int>(sqlStatement.size()),&statementPtr,NULL);
>>>>> if (result == SQLITE_OK)
>>>>> {
>>>>> result = sqlite3_step(statementPtr);
>>>>> if ((result == SQLITE_OK) || (result == SQLITE_DONE))
>>>>> result = sqlite3_finalize(statementPtr);
>>>>> } /* if */
>>>>> if (result != SQLITE_OK)
>>>>> std::cout << sqlite3_errmsg(databaseHandle) << " (" << sqlStatement << ')'
>>>>> << std::endl;
>>>>> }
>>>>>
>>>>> int main(int argc, const char * argv[])
>>>>> {
>>>>> sqlite3* databaseHandle(NULL);
>>>>>
>>>>> if (sqlite3_open_v2(„Test.sldb",&databaseHandle,SQLITE_OPEN_CREATE |
>>>>> SQLITE_OPEN_READWRITE,NULL) == SQLITE_OK)
>>>>> {
>>>>> ExecuteStatement(databaseHandle,"BEGIN TRANSACTION;");
>>>>>
>>>>> ExecuteStatement(databaseHandle,"DELETE FROM A WHERE AnotherID=1;");
>>>>> ExecuteStatement(databaseHandle,"DELETE FROM B WHERE ID=1;");
>>>>>
>>>>> ExecuteStatement(databaseHandle,"COMMIT;");
>>>>> sqlite3_close(databaseHandle);
>>>>> } /* if */
>>>>> else
>>>>> std::cout << sqlite3_errmsg(databaseHandle) << std::end;
>>>>> }
>>>>>
>>>>>
>>>>> I do not get any error output besides the failed assertion. I have run an
>>>>> integrity check on the database and I get the response „ok“.
>>>>>
>>>>> I have seen that there has been a change in „sqlite3VtabSavepoint“ a while
>>>>> ago. Can this change be the source of this error?
>>>>>
>>>>> Basically, I have no clue what is going on…
>>>>>
>>>>> Best regards,
>>>>> Hartwig
>>>>> _______________________________________________
>>>>> sqlite-users mailing list
>>>>> [hidden email] <mailto:[hidden email]>
>>>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
>>>>>
>>>>
>>>> --
>>>> D. Richard Hipp
>>>> [hidden email] <mailto:[hidden email]>
>>>> _______________________________________________
>>>> sqlite-users mailing list
>>>> [hidden email] <mailto:[hidden email]>
>>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
>>> _______________________________________________
>>> sqlite-users mailing list
>>> [hidden email]
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>>
>> _______________________________________________
>> sqlite-users mailing list
>> [hidden email] <mailto:[hidden email]>
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email] <mailto:[hidden email]>
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users