1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-04 20:02:48 +03:00

Do not burn memory remembering CHECK constraints in a read-only database.

FossilOrigin-Name: 34ddf02d3d21151b8099c0c25706530a03d93887
This commit is contained in:
drh
2014-05-21 08:48:18 +00:00
parent 781597feca
commit c9bbb01180
3 changed files with 11 additions and 8 deletions

View File

@@ -1306,7 +1306,10 @@ void sqlite3AddCheckConstraint(
){
#ifndef SQLITE_OMIT_CHECK
Table *pTab = pParse->pNewTable;
if( pTab && !IN_DECLARE_VTAB ){
sqlite3 *db = pParse->db;
if( pTab && !IN_DECLARE_VTAB
&& !sqlite3BtreeIsReadonly(db->aDb[db->init.iDb].pBt)
){
pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr);
if( pParse->constraintName.n ){
sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1);