(1)  I cannot reproduce the problem.  Can you provide clearer
instructions on how to make it misbehave?

(2) Why are you using -DSQLITE_OMIT_AUTOINCREMENT?
SQLITE_OMIT_AUTOINCREMENT is unsupported and untested.  What are you
hoping to accomplish by using it?

On 5/24/17, Michele Dionisio <[email protected]> wrote:
> Hello
>
> I have done the same test on sqlite 3.16.3 but I'm quite sure that the
> same happens on my embedded device that use sqlite 3.19. I say this
> because I'm debugging the problem on my ubuntu machine where I have
> sqlite 3.16.3 and I'm able to replicate the issue.
>
>
> I have a database created with sqlite 3.19 build with
>
> -DSQLITE_OMIT_AUTOINCREMENT
>
>
> the I use the database on sqlite 3.16 build without
> -DSQLITE_OMIT_AUTOINCREMENT (the same happens on 3.19 as I say before).
>
> I have a table like this:
>
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> CREATE TABLE IF NOT EXISTS permission (
>      permission_id       INTEGER PRIMARY KEY NOT NULL DEFAULT ( NULL ),
>
>      permission_read     INTEGER DEFAULT ( NULL ),
>      permission_update   INTEGER DEFAULT ( NULL ),
>      permission_create   INTEGER DEFAULT ( NULL ),
>      permission_delete   INTEGER DEFAULT ( NULL ),
>
>      device_id           INTEGER NOT NULL,
>      device_id_group     INTEGER NOT NULL,
>
>      FOREIGN KEY ( device_id )       REFERENCES device ( device_id ),
>      FOREIGN KEY ( device_id_group ) REFERENCES device ( device_id )
> );
>
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>
> and executing a command like this I have a segment fault
>
> ./sqlite3 x8.db.con-problema "INSERT INTO permission
> (permission_id,permission_create,permission_read,permission_update,permission_delete,device_id,device_id_group)
> VALUES (NULL, 1, 1, 1, 1, 1, 1 ) ;"
>
> from gdb I see the crash in
>
> SQLITE_PRIVATE void sqlite3OpenTable(
>    Parse *pParse,  /* Generate code into this VDBE */
>    int iCur,       /* The cursor number of the table */
>    int iDb,        /* The database index in sqlite3.aDb[] */
>    Table *pTab,    /* The table to be opened */
>    int opcode      /* OP_OpenRead or OP_OpenWrite */
> ){
>    Vdbe *v;
>    assert( !IsVirtual(pTab) );
> <----------------------------------------------------------------------------
> CRASH
>    v = sqlite3GetVdbe(pParse);
>
>
> and the stack trace is
>
> #0  sqlite3OpenTable(pParse = 0x7fffffffc400, pParse@entry =
> 0x7fffffffc400, iCur = 0, iCur@entry = 0, iDb = 0, pTab = 0x0, opcode =
> 105, opcode@entry = 105) at sqlite3.c:108052
> #1  autoIncrementEnd(pParse = 0x7fffffffc400, pParse@entry =
> 0x7fffffffc400) at sqlite3.c:108364
> #2  sqlite3AutoincrementEnd(pParse = 0x7fffffffc400) at sqlite3.c:108378
> #3  sqlite3Insert(pParse = 0x7fffffffc400, pParse@entry =
> 0x7fffffffc400, pTabList = 0x55555589f9a0, pSelect = <optimized out>,
> pColumn = 0x55555589f5a0, onError = 10) at sqlite3.c:43536
> #4  yy_reduce(yyruleno = 142, yypParser = 0x5555558a2840) at
> sqlite3.c:136805
> #5  sqlite3Parser(pParse = 0x7fffffffc400, yyminor = , yyp =
> 0x5555558a2840) at sqlite3.c:6523
> #6  sqlite3RunParser(pParse = 0x7fffffffc400, pParse@entry =
> 0x7fffffffc400, zSql = 0x7fffffffe10f "INSERT INTO permission
> (permission_id,permission_create,permission_read,permission_update,permission_delete,device_id,device_id_group)
> VALUES (NULL, 1, 1, 1, 1, 1, 1 ) ;", zSql@entry = 0x7fffffffe10f "INSERT
> INTO permission
> (permission_id,permission_create,permission_read,permission_update,permission_delete,device_id,device_id_group)
> VALUES (NULL, 1, 1, 1, 1, 1, 1 ) ;", pzErrMsg = 0x7fffffffc3f8,
> pzErrMsg@entry = 0x7fffffffc3f8) at sqlite3.c:7469
> #7  sqlite3Prepare(db = 0x55555588d0a0, db@entry = 0x55555588d0a0, zSql
> = 0x7fffffffe10f "INSERT INTO permission
> (permission_id,permission_create,permission_read,permission_update,permission_delete,device_id,device_id_group)
> VALUES (NULL, 1, 1, 1, 1, 1, 1 ) ;", zSql@entry = 0x7fffffffe10f "INSERT
> INTO permission
> (permission_id,permission_create,permission_read,permission_update,permission_delete,device_id,device_id_group)
> VALUES (NULL, 1, 1, 1, 1, 1, 1 ) ;", nBytes = -1, nBytes@entry = -1,
> saveSqlFlag = 1, saveSqlFlag@entry = 1, pReprepare = 0x0,
> pReprepare@entry = 0x0, ppStmt = 0x7fffffffc750, ppStmt@entry =
> 0x7fffffffc750, pzTail = 0x7fffffffc758) at sqlite3.c:115231
> #8  sqlite3LockAndPrepare(db = 0x55555588d0a0, zSql = 0x7fffffffe10f
> "INSERT INTO permission
> (permission_id,permission_create,permission_read,permission_update,permission_delete,device_id,device_id_group)
> VALUES (NULL, 1, 1, 1, 1, 1, 1 ) ;", nBytes = -1, saveSqlFlag = 1, pOld
> = 0x0, ppStmt = 0x7fffffffc750, pzTail = 0x7fffffffc758) at sqlite3.c:115322
> #9  sqlite3_prepare_v2(db = <optimized out>, zSql = <optimized out>,
> nBytes = <optimized out>, ppStmt = 0x7fffffffc750, pzTail = <optimized
> out>) at sqlite3.c:115398
> #10  shell_exec(db = 0x55555588d0a0, zSql = 0x7fffffffe10f "INSERT INTO
> permission
> (permission_id,permission_create,permission_read,permission_update,permission_delete,device_id,device_id_group)
> VALUES (NULL, 1, 1, 1, 1, 1, 1 ) ;", pArg = 0x7fffffffc800, pzErrMsg =
> 0x7fffffffc7f8, xCallback = 0x555555568730 <shell_callback>) at
> /tmp/compara/sqlite3-3.16.2/src/shell.c:1916
> #11  main(argc = <optimized out>, argv = <optimized out>) at
> /tmp/compara/sqlite3-3.16.2/src/shell.c:6109
>
> I think that the problem cames from the fact that there is no pSeqTab in
> by database but a crash is NOT so nice and it is better to recreate pSeqTab.
>
>
> regards
>
>
>
>
>
>
> --
>
> Powersoft logo <http://www.powersoft.it>
>
> *Michele Dionisio |*Embedded System Manager
>
> *skype:*  m.dionisio *| email:* [email protected]
> <mailto:[email protected]>
>
> *HQ Italy:* Via E. Conti, 5 *|* 50018 Scandicci (FI) Italy
>
> *direct phone:*  +39 055 735 0230 *| Fax:*   +39 055 735 6235
>
> *web site:* www.powersoft.it <http://www.powersoft.it>
>
> Green Audio Power
>
> _______________________________________________
> 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