SQLite

Check-in [2b44f9aa7d]
Login

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

Overview
Comment:Fix obsolete requirements marks. Add new tests for VACUUM of attached databases.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2b44f9aa7d4e2089dacd6bfcf526dae9309b7af3
User & Date: drh 2016-09-21 18:18:57.867
Context
2016-09-21
19:00
Do not run vacuummem.test if ENABLE_MEMORY_MANAGEMENT is defined. (check-in: 4a613d8564 user: dan tags: trunk)
18:18
Fix obsolete requirements marks. Add new tests for VACUUM of attached databases. (check-in: 2b44f9aa7d user: drh tags: trunk)
17:53
Avoid running vacuum5.test in auto-vacuum mode. (check-in: be184befa0 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/e_fkey.test.
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
    }
  } {world}
}

#-------------------------------------------------------------------------
# Test the effects of defining OMIT_TRIGGER but not OMIT_FOREIGN_KEY.
#
# EVIDENCE-OF: R-44697-61543 If SQLITE_OMIT_TRIGGER is defined but
# SQLITE_OMIT_FOREIGN_KEY is not, then SQLite behaves as it did prior to
# version 3.6.19 - foreign key definitions are parsed and may be queried
# using PRAGMA foreign_key_list, but foreign key constraints are not
# enforced.
#
# Specifically, test that "PRAGMA foreign_keys" is a no-op in this case.
# When using the pragma to query the current setting, 0 rows are returned.
#
# EVIDENCE-OF: R-22567-44039 The PRAGMA foreign_keys command is a no-op
# in this configuration.
#







|

|
|
|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
    }
  } {world}
}

#-------------------------------------------------------------------------
# Test the effects of defining OMIT_TRIGGER but not OMIT_FOREIGN_KEY.
#
# EVIDENCE-OF: R-10109-20452 If SQLITE_OMIT_TRIGGER is defined but
# SQLITE_OMIT_FOREIGN_KEY is not, then SQLite behaves as it did prior to
# version 3.6.19 (2009-10-14) - foreign key definitions are parsed and
# may be queried using PRAGMA foreign_key_list, but foreign key
# constraints are not enforced.
#
# Specifically, test that "PRAGMA foreign_keys" is a no-op in this case.
# When using the pragma to query the current setting, 0 rows are returned.
#
# EVIDENCE-OF: R-22567-44039 The PRAGMA foreign_keys command is a no-op
# in this configuration.
#
Changes to test/e_vacuum.test.
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208





209
210
211
212
213
214
215
      execsql { PRAGMA auto_vacuum = FULL }
      execsql VACUUM
      execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
    } {2048 1}
  }
}
  
# EVIDENCE-OF: R-38001-03952 VACUUM only works on the main database. It
# is not possible to VACUUM an attached database file.
forcedelete test.db2
create_db { PRAGMA auto_vacuum = NONE }
do_execsql_test e_vacuum-2.1.1 {
  ATTACH 'test.db2' AS aux;
  PRAGMA aux.page_size = 1024;
  CREATE TABLE aux.t3 AS SELECT * FROM t1;
  DELETE FROM t3;
} {}
set original_size [file size test.db2]

# Vacuuming the main database does not affect aux
do_execsql_test e_vacuum-2.1.3 { VACUUM } {}
do_test e_vacuum-2.1.6 { expr {[file size test.db2]==$::original_size} } 1






# EVIDENCE-OF: R-17495-17419 The VACUUM command may change the ROWIDs of
# entries in any tables that do not have an explicit INTEGER PRIMARY
# KEY.
#
#   Tests e_vacuum-3.1.1 - 3.1.2 demonstrate that rowids can change when
#   a database is VACUUMed. Tests e_vacuum-3.1.3 - 3.1.4 show that adding
#   an INTEGER PRIMARY KEY column to a table stops this from happening.







|
|














>
>
>
>
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
      execsql { PRAGMA auto_vacuum = FULL }
      execsql VACUUM
      execsql { PRAGMA page_size ; PRAGMA auto_vacuum }
    } {2048 1}
  }
}
  
# EVIDENCE-OF: R-55119-57913 By default, VACUUM only works only on the
# main database.
forcedelete test.db2
create_db { PRAGMA auto_vacuum = NONE }
do_execsql_test e_vacuum-2.1.1 {
  ATTACH 'test.db2' AS aux;
  PRAGMA aux.page_size = 1024;
  CREATE TABLE aux.t3 AS SELECT * FROM t1;
  DELETE FROM t3;
} {}
set original_size [file size test.db2]

# Vacuuming the main database does not affect aux
do_execsql_test e_vacuum-2.1.3 { VACUUM } {}
do_test e_vacuum-2.1.6 { expr {[file size test.db2]==$::original_size} } 1

# EVIDENCE-OF: R-36598-60500 Attached databases can be vacuumed by
# appending the appropriate schema-name to the VACUUM statement.
do_execsql_test e_vacuum-2.1.7 { VACUUM aux; } {}
do_test e_vacuum-2.1.8 { expr {[file size test.db2]<$::original_size} } 1

# EVIDENCE-OF: R-17495-17419 The VACUUM command may change the ROWIDs of
# entries in any tables that do not have an explicit INTEGER PRIMARY
# KEY.
#
#   Tests e_vacuum-3.1.1 - 3.1.2 demonstrate that rowids can change when
#   a database is VACUUMed. Tests e_vacuum-3.1.3 - 3.1.4 show that adding
#   an INTEGER PRIMARY KEY column to a table stops this from happening.
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
  db eval { SELECT a FROM t1 } {
    if {$a == 10} { set res [catchsql VACUUM] }
  }
  set res
} {1 {cannot VACUUM - SQL statements in progress}}


# EVIDENCE-OF: R-38735-12540 As of SQLite version 3.1, an alternative to
# using the VACUUM command to reclaim space after data has been deleted
# is auto-vacuum mode, enabled using the auto_vacuum pragma.
#
do_test e_vacuum-3.3.1 {
  create_db { PRAGMA auto_vacuum = FULL }
  execsql { PRAGMA auto_vacuum }
} {1}

# EVIDENCE-OF: R-64844-34873 When auto_vacuum is enabled for a database







|
|
|







268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
  db eval { SELECT a FROM t1 } {
    if {$a == 10} { set res [catchsql VACUUM] }
  }
  set res
} {1 {cannot VACUUM - SQL statements in progress}}


# EVIDENCE-OF: R-55138-13241 An alternative to using the VACUUM command
# to reclaim space after data has been deleted is auto-vacuum mode,
# enabled using the auto_vacuum pragma.
#
do_test e_vacuum-3.3.1 {
  create_db { PRAGMA auto_vacuum = FULL }
  execsql { PRAGMA auto_vacuum }
} {1}

# EVIDENCE-OF: R-64844-34873 When auto_vacuum is enabled for a database