/ Check-in [0abace8a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:New assert() to verify the TF_HasprimaryKey flag.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:0abace8a7aecca01c8677d07f3ec1bafb289ceffe5bcd60284701a7bf813f415
User & Date: drh 2019-02-19 13:51:58
Context
2019-02-19
16:42
Fix an assert() that might not be true if the database file is corrupt. check-in: f2d400db user: drh tags: trunk
13:51
New assert() to verify the TF_HasprimaryKey flag. check-in: 0abace8a user: drh tags: trunk
13:08
Always use the symbolic name SQLITE_IDXTYPE_PRIMARYKEY rather than a hard-coded magic number 2. check-in: 55d43adc user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  1987   1987         sqlite3ErrorMsg(pParse, "");
  1988   1988         return;
  1989   1989       }
  1990   1990       p->tnum = db->init.newTnum;
  1991   1991       if( p->tnum==1 ) p->tabFlags |= TF_Readonly;
  1992   1992     }
  1993   1993   
         1994  +  assert( (p->tabFlags & TF_HasPrimaryKey)==0
         1995  +       || p->iPKey>=0 || sqlite3PrimaryKeyIndex(p)!=0 );
         1996  +  assert( (p->tabFlags & TF_HasPrimaryKey)!=0
         1997  +       || (p->iPKey<0 && sqlite3PrimaryKeyIndex(p)==0) );
         1998  +
  1994   1999     /* Special processing for WITHOUT ROWID Tables */
  1995   2000     if( tabOpts & TF_WithoutRowid ){
  1996   2001       if( (p->tabFlags & TF_Autoincrement) ){
  1997   2002         sqlite3ErrorMsg(pParse,
  1998   2003             "AUTOINCREMENT not allowed on WITHOUT ROWID tables");
  1999   2004         return;
  2000   2005       }