/ Check-in [34ddf02d]
Login

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

Overview
Comment:Do not burn memory remembering CHECK constraints in a read-only database.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 34ddf02d3d21151b8099c0c25706530a03d93887
User & Date: drh 2014-05-21 08:48:18
Context
2014-05-22
09:58
Add a test for the EQP output of a skip-scan query that uses the PK index of a WITHOUT ROWID table. check-in: 10238fad user: dan tags: trunk
2014-05-21
08:48
Do not burn memory remembering CHECK constraints in a read-only database. check-in: 34ddf02d user: drh tags: trunk
08:21
Fix the sqlite3_db_readonly() API so that it reports true if the database is readonly because the file format write version (byte 18 of the header) is too large. check-in: 8d8af114 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  1302   1302   */
  1303   1303   void sqlite3AddCheckConstraint(
  1304   1304     Parse *pParse,    /* Parsing context */
  1305   1305     Expr *pCheckExpr  /* The check expression */
  1306   1306   ){
  1307   1307   #ifndef SQLITE_OMIT_CHECK
  1308   1308     Table *pTab = pParse->pNewTable;
  1309         -  if( pTab && !IN_DECLARE_VTAB ){
         1309  +  sqlite3 *db = pParse->db;
         1310  +  if( pTab && !IN_DECLARE_VTAB
         1311  +   && !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
         1312  +  ){
  1310   1313       pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
  1311   1314       if( pParse->constraintName.n ){
  1312   1315         sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);
  1313   1316       }
  1314   1317     }else
  1315   1318   #endif
  1316   1319     {