1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Preset the legacy_file_format pragma to the value of the primary

database so that a VACUUM will not unknowingly alter the setting.
Ticket #2804. (CVS 4574)

FossilOrigin-Name: f731fa6bb398d8af621af17dc0677dd0f715c4a7
This commit is contained in:
drh
2007-11-28 13:43:16 +00:00
parent ed05efbf7b
commit 4aa2bfe67d
5 changed files with 36 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
C Add\san\simplementation\sof\srecursive\smutexes\sfor\sunix\ssystems\sthat\nlack\spthreads\srecursive\smutexes\s(ex:\sSolaris\s2.6).\s\sModern\sunix\nsystems\scontinue\sto\suse\sthe\srecursive\smutexes\sprovided\sby\spthreads.\s(CVS\s4573) C Preset\sthe\slegacy_file_format\spragma\sto\sthe\svalue\sof\sthe\sprimary\ndatabase\sso\sthat\sa\sVACUUM\swill\snot\sunknowingly\salter\sthe\ssetting.\nTicket\s#2804.\s(CVS\s4574)
D 2007-11-28T00:51:35 D 2007-11-28T13:43:17
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 35396fd58890420b29edcf27b6c0e2d054862a6b F Makefile.in 35396fd58890420b29edcf27b6c0e2d054862a6b
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -127,7 +127,7 @@ F src/pager.c b1eaca429cf9a4e35bed12f6f326d39a82ee8a33
F src/pager.h d783e7f184afdc33adff37ba58d4e029bd8793b3 F src/pager.h d783e7f184afdc33adff37ba58d4e029bd8793b3
F src/parse.y a780b33ef45dd7b3272319cf91e609d6f109a31c F src/parse.y a780b33ef45dd7b3272319cf91e609d6f109a31c
F src/pragma.c cb1486e76dbcad757968afc4083d3472032e62b5 F src/pragma.c cb1486e76dbcad757968afc4083d3472032e62b5
F src/prepare.c 5dd06102c4c538fcbb9c71d35e505abb9fcbd269 F src/prepare.c f811fdb6fd4a82cca673a6e1d5b041d6caf567f1
F src/printf.c 96c8d55315a13fc53cb3754cb15046f3ff891ea2 F src/printf.c 96c8d55315a13fc53cb3754cb15046f3ff891ea2
F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da F src/random.c 4a22746501bf36b0a088c66e38dde5daba6a35da
F src/select.c 7c0ab94b8f287eb94fdb1eb101be603832ecfc34 F src/select.c 7c0ab94b8f287eb94fdb1eb101be603832ecfc34
@@ -181,7 +181,7 @@ F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/all.test ee350b9ab15b175fc0a8fb51bf2141ed3a3b9cba F test/all.test ee350b9ab15b175fc0a8fb51bf2141ed3a3b9cba
F test/alter.test a87b7933d41c713c53341abe4eb014d0e273119e F test/alter.test a87b7933d41c713c53341abe4eb014d0e273119e
F test/alter2.test 4e0c502214daa710a0a9d7ec9689a0326b1a4e2a F test/alter2.test 9d9850064b5c572991ea744a88ea650045f4ac6a
F test/alter3.test 8ce6b9c5605b3cfe7b901f454ecaf174c4f93e31 F test/alter3.test 8ce6b9c5605b3cfe7b901f454ecaf174c4f93e31
F test/altermalloc.test 29d4a8400277efb4ba8ffe90804c6dc2fdfbf063 F test/altermalloc.test 29d4a8400277efb4ba8ffe90804c6dc2fdfbf063
F test/analyze.test 2f55535aa335785db1a2f97d3f3831c16c09f8b0 F test/analyze.test 2f55535aa335785db1a2f97d3f3831c16c09f8b0
@@ -248,7 +248,7 @@ F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb
F test/delete.test 57533e88e886608bf5ae0f394e14c2eb1b1f7754 F test/delete.test 57533e88e886608bf5ae0f394e14c2eb1b1f7754
F test/delete2.test c06be3806ba804bc8c6f134476816080280b40e3 F test/delete2.test c06be3806ba804bc8c6f134476816080280b40e3
F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab
F test/descidx1.test 4537cac47b3bccf485ec44fcaa95206dd32b67d4 F test/descidx1.test 6c9d528b60d883a8cf8f539c722df6b763c774c0
F test/descidx2.test eb3a2882ec58aa6e1e8131d9bb54436e5b4a3ce2 F test/descidx2.test eb3a2882ec58aa6e1e8131d9bb54436e5b4a3ce2
F test/descidx3.test 3a55b8d73bc3e9ad084e0da7fec781cf0d2a0356 F test/descidx3.test 3a55b8d73bc3e9ad084e0da7fec781cf0d2a0356
F test/diskfull.test 34ef53e88372c5b5e488ad1581514559a224c2b1 F test/diskfull.test 34ef53e88372c5b5e488ad1581514559a224c2b1
@@ -593,7 +593,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 57400f50c600a59b56ba6eadfdc740235c194cd6 P f366a776c1b2dda42b4f10fdb8be66029165d084
R 8dde434a6ff58760125bd11cf8e8307f R f8726377bf1d2f12ba17ef1e3030e09a
U drh U drh
Z d10de234723bedb4b88498db89c73bc6 Z 4b43ff400d6268b573f303c0eaf9af93

View File

@@ -1 +1 @@
f366a776c1b2dda42b4f10fdb8be66029165d084 f731fa6bb398d8af621af17dc0677dd0f715c4a7

View File

@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema ** interface, and routines that contribute to loading the database schema
** from disk. ** from disk.
** **
** $Id: prepare.c,v 1.64 2007/11/14 06:48:48 danielk1977 Exp $ ** $Id: prepare.c,v 1.65 2007/11/28 13:43:17 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -288,6 +288,14 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
return SQLITE_ERROR; return SQLITE_ERROR;
} }
/* Ticket #2804: When we open a database in the newer file format,
** clear the legacy_file_format pragma flag so that a VACUUM will
** not downgrade the database and thus invalidate any descending
** indices that the user might have created.
*/
if( iDb==0 && meta[1]>=4 ){
db->flags &= ~SQLITE_LegacyFileFmt;
}
/* Read the schema information out of the schema tables /* Read the schema information out of the schema tables
*/ */

View File

@@ -13,7 +13,7 @@
# file format change that may be used in the future to implement # file format change that may be used in the future to implement
# "ALTER TABLE ... ADD COLUMN". # "ALTER TABLE ... ADD COLUMN".
# #
# $Id: alter2.test,v 1.11 2007/11/13 10:30:26 danielk1977 Exp $ # $Id: alter2.test,v 1.12 2007/11/28 13:43:17 drh Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@@ -275,10 +275,11 @@ set default_file_format [expr $SQLITE_DEFAULT_FILE_FORMAT==4 ? 4 : 1]
ifcapable vacuum { ifcapable vacuum {
do_test alter2-5.1 { do_test alter2-5.1 {
set_file_format 2 set_file_format 2
execsql {SELECT 1 FROM sqlite_master LIMIT 1;}
get_file_format get_file_format
} {2} } {2}
do_test alter2-5.2 { do_test alter2-5.2 {
execsql { execsql {
VACUUM; VACUUM;
} }
} {} } {}

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this script is descending indices. # focus of this script is descending indices.
# #
# $Id: descidx1.test,v 1.8 2007/11/27 23:36:59 drh Exp $ # $Id: descidx1.test,v 1.9 2007/11/28 13:43:17 drh Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@@ -336,6 +336,11 @@ do_test descidx1-6.4 {
do_test descidx1-6.5 { do_test descidx1-6.5 {
execsql { execsql {
CREATE TABLE t1(a,b,c); CREATE TABLE t1(a,b,c);
CREATE INDEX i1 ON t1(a ASC, b DESC, c ASC);
INSERT INTO t1 VALUES(1,2,3);
INSERT INTO t1 VALUES(1,1,0);
INSERT INTO t1 VALUES(1,2,1);
INSERT INTO t1 VALUES(1,3,4);
} }
get_file_format get_file_format
} {4} } {4}
@@ -345,7 +350,15 @@ ifcapable vacuum {
execsql {VACUUM} execsql {VACUUM}
get_file_format get_file_format
} {4} } {4}
} do_test descidx1-6.7 {
execsql {
PRAGMA legacy_file_format=ON;
VACUUM;
}
get_file_format
} {4}
}
finish_test finish_test