From 98ecc1f3f5450757a2f532d49d33aead8d86c1f6 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 4 Jun 2014 14:06:34 +0000 Subject: [PATCH 01/55] Version 3.8.5 FossilOrigin-Name: b1ed4f2a34ba66c29b130f8d13e9092758019212 --- manifest | 11 +++++++---- manifest.uuid | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifest b/manifest index 20001ad2d1..d11c694a3f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sclosing\sa\spseudo-table\sassociated\swith\ssorting\sin\sa\sco-routine\ssince\nthat\spseudo-table\smight\sbe\sused\sagain\sin\san\souter\sloop. -D 2014-06-03T14:42:34.857 +C Version\s3.8.5 +D 2014-06-04T14:06:34.678 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1173,7 +1173,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c6b512a724aebcd084aad2a80d020b95773b3012 +P 6d81805298ea882f5fee99504d5a95f1a762a90b R 679d3413ba6dc377c3eacd5814f0f801 +T +bgcolor * #d0c0ff +T +sym-release * +T +sym-version-3.8.5 * U drh -Z d6f5ccfdba8b994a53e0334e1b572467 +Z f323d41d3468066466323d34c9eb7587 diff --git a/manifest.uuid b/manifest.uuid index 40af1ce51c..7f3592acdf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6d81805298ea882f5fee99504d5a95f1a762a90b \ No newline at end of file +b1ed4f2a34ba66c29b130f8d13e9092758019212 \ No newline at end of file From 33b7bcb319f16a4b0e579be958dfa4c0def75bb6 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 5 Jun 2014 11:15:56 +0000 Subject: [PATCH 02/55] Fix a problem that was causing the FTS4 integrity-check command to fail if the table had one or more "notindexed" columns. FossilOrigin-Name: 7123bb2605216396f65db5d156431b3613f313b5 --- ext/fts3/fts3_write.c | 46 ++++++++++++++++++++++--------------------- manifest | 19 ++++++++---------- manifest.uuid | 2 +- test/fts4check.test | 28 ++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 34 deletions(-) diff --git a/ext/fts3/fts3_write.c b/ext/fts3/fts3_write.c index 72df64f26b..0da08c62d8 100644 --- a/ext/fts3/fts3_write.c +++ b/ext/fts3/fts3_write.c @@ -5174,34 +5174,36 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){ int iCol; for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){ - const char *zText = (const char *)sqlite3_column_text(pStmt, iCol+1); - int nText = sqlite3_column_bytes(pStmt, iCol+1); - sqlite3_tokenizer_cursor *pT = 0; + if( p->abNotindexed[iCol]==0 ){ + const char *zText = (const char *)sqlite3_column_text(pStmt, iCol+1); + int nText = sqlite3_column_bytes(pStmt, iCol+1); + sqlite3_tokenizer_cursor *pT = 0; - rc = sqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, nText, &pT); - while( rc==SQLITE_OK ){ - char const *zToken; /* Buffer containing token */ - int nToken = 0; /* Number of bytes in token */ - int iDum1 = 0, iDum2 = 0; /* Dummy variables */ - int iPos = 0; /* Position of token in zText */ + rc = sqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, nText,&pT); + while( rc==SQLITE_OK ){ + char const *zToken; /* Buffer containing token */ + int nToken = 0; /* Number of bytes in token */ + int iDum1 = 0, iDum2 = 0; /* Dummy variables */ + int iPos = 0; /* Position of token in zText */ - rc = pModule->xNext(pT, &zToken, &nToken, &iDum1, &iDum2, &iPos); - if( rc==SQLITE_OK ){ - int i; - cksum2 = cksum2 ^ fts3ChecksumEntry( - zToken, nToken, iLang, 0, iDocid, iCol, iPos - ); - for(i=1; inIndex; i++){ - if( p->aIndex[i].nPrefix<=nToken ){ - cksum2 = cksum2 ^ fts3ChecksumEntry( - zToken, p->aIndex[i].nPrefix, iLang, i, iDocid, iCol, iPos - ); + rc = pModule->xNext(pT, &zToken, &nToken, &iDum1, &iDum2, &iPos); + if( rc==SQLITE_OK ){ + int i; + cksum2 = cksum2 ^ fts3ChecksumEntry( + zToken, nToken, iLang, 0, iDocid, iCol, iPos + ); + for(i=1; inIndex; i++){ + if( p->aIndex[i].nPrefix<=nToken ){ + cksum2 = cksum2 ^ fts3ChecksumEntry( + zToken, p->aIndex[i].nPrefix, iLang, i, iDocid, iCol, iPos + ); + } } } } + if( pT ) pModule->xClose(pT); + if( rc==SQLITE_DONE ) rc = SQLITE_OK; } - if( pT ) pModule->xClose(pT); - if( rc==SQLITE_DONE ) rc = SQLITE_OK; } } diff --git a/manifest b/manifest index d11c694a3f..fa19abb656 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Version\s3.8.5 -D 2014-06-04T14:06:34.678 +C Fix\sa\sproblem\sthat\swas\scausing\sthe\sFTS4\sintegrity-check\scommand\sto\sfail\sif\sthe\stable\shad\sone\sor\smore\s"notindexed"\scolumns. +D 2014-06-05T11:15:56.350 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -96,7 +96,7 @@ F ext/fts3/fts3_tokenizer.h 64c6ef6c5272c51ebe60fc607a896e84288fcbc3 F ext/fts3/fts3_tokenizer1.c 5c98225a53705e5ee34824087478cf477bdb7004 F ext/fts3/fts3_unicode.c 92391b4b4fb043564c6539ea9b8661e3bcba47b9 F ext/fts3/fts3_unicode2.c 0113d3acf13429e6dc38e0647d1bc71211c31a4d -F ext/fts3/fts3_write.c 5ee9d894da74a5d15a3c317414fb8c84f1694fa4 +F ext/fts3/fts3_write.c 8260388626516a7005d06a9dce94f9e55c6c2a41 F ext/fts3/fts3speed.tcl b54caf6a18d38174f1a6e84219950d85e98bb1e9 F ext/fts3/mkfts3amal.tcl 252ecb7fe6467854f2aa237bf2c390b74e71f100 F ext/fts3/tool/fts3view.c 6cfc5b67a5f0e09c0d698f9fd012c784bfaa9197 @@ -567,7 +567,7 @@ F test/fts3tok1.test c551043de056b0b1582a54e878991f57bad074bc F test/fts3tok_err.test 52273cd193b9036282f7bacb43da78c6be87418d F test/fts3varint.test 752c08ed5d32c5d7dc211b056f4ed68a76b7e36e F test/fts4aa.test 0c3152322c7f0b548cc942ad763eaba0da87ccca -F test/fts4check.test 66fa274cab2b615f2fb338b257713aba8fad88a8 +F test/fts4check.test 74d77f6cdb768ac49df5afda575cef14ae3d239a F test/fts4content.test 2e7252557d6d24afa101d9ba1de710d6140e6d06 F test/fts4docid.test e33c383cfbdff0284685604d256f347a18fdbf01 F test/fts4growth.test df10fde9f47cf5c71861e63fd8efcd573c4f7e53 @@ -1173,10 +1173,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6d81805298ea882f5fee99504d5a95f1a762a90b -R 679d3413ba6dc377c3eacd5814f0f801 -T +bgcolor * #d0c0ff -T +sym-release * -T +sym-version-3.8.5 * -U drh -Z f323d41d3468066466323d34c9eb7587 +P b1ed4f2a34ba66c29b130f8d13e9092758019212 +R 377d24b74ba4106b5f52a423e2a5cf2f +U dan +Z 2cd68ab7b6aef503eef49b559771fe52 diff --git a/manifest.uuid b/manifest.uuid index 7f3592acdf..67f786fd6a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b1ed4f2a34ba66c29b130f8d13e9092758019212 \ No newline at end of file +7123bb2605216396f65db5d156431b3613f313b5 \ No newline at end of file diff --git a/test/fts4check.test b/test/fts4check.test index cc1d018aad..c98886cccc 100644 --- a/test/fts4check.test +++ b/test/fts4check.test @@ -152,4 +152,32 @@ foreach {tn disruption} { do_execsql_test 3.2.3.$tn "ROLLBACK" } +#-------------------------------------------------------------------------- +# Test case 4.* +# +# Test that the integrity-check works if there are "notindexed" columns. +# +do_execsql_test 4.0 { + CREATE VIRTUAL TABLE t4 USING fts4(a, b, c, notindexed=b); + INSERT INTO t4 VALUES('text one', 'text two', 'text three'); + INSERT INTO t4(t4) VALUES('integrity-check'); +} + +do_execsql_test 4.1 { + PRAGMA writable_schema = 1; + UPDATE sqlite_master + SET sql = 'CREATE VIRTUAL TABLE t4 USING fts4(a, b, c)' + WHERE name = 't4'; +} + +do_test 4.2 { + db close + sqlite3 db test.db + catchsql { + INSERT INTO t4(t4) VALUES('integrity-check'); + } +} {1 {database disk image is malformed}} +reset_db + finish_test + From 94aa7e091b2788dd81baf2f9e42999ea39a96d08 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Jun 2014 17:09:52 +0000 Subject: [PATCH 03/55] Fix an obsolete comment on the whereRangeScanEst() routine. No changes to code. FossilOrigin-Name: b16bf8518b7c50f6a939aa54900fea91b1098470 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/where.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index fa19abb656..7a13812832 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sthat\swas\scausing\sthe\sFTS4\sintegrity-check\scommand\sto\sfail\sif\sthe\stable\shad\sone\sor\smore\s"notindexed"\scolumns. -D 2014-06-05T11:15:56.350 +C Fix\san\sobsolete\scomment\son\sthe\swhereRangeScanEst()\sroutine.\s\sNo\nchanges\sto\scode. +D 2014-06-06T17:09:52.932 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -294,7 +294,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c a7d59dd5d5bf6d6ab905fb549567a0a11376de25 +F src/where.c b6dc818941e13210ae7c64b9b5198b1a693bf765 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1173,7 +1173,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b1ed4f2a34ba66c29b130f8d13e9092758019212 -R 377d24b74ba4106b5f52a423e2a5cf2f -U dan -Z 2cd68ab7b6aef503eef49b559771fe52 +P 7123bb2605216396f65db5d156431b3613f313b5 +R 47d6ccb6d1a86c986ab1ed05f4aba5d5 +U drh +Z c4d23929c4a97c69fe369953e2b29d73 diff --git a/manifest.uuid b/manifest.uuid index 67f786fd6a..98f7bd81f2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7123bb2605216396f65db5d156431b3613f313b5 \ No newline at end of file +b16bf8518b7c50f6a939aa54900fea91b1098470 \ No newline at end of file diff --git a/src/where.c b/src/where.c index f914004b25..e9ef46c197 100644 --- a/src/where.c +++ b/src/where.c @@ -2035,9 +2035,9 @@ static LogEst whereRangeAdjust(WhereTerm *pTerm, LogEst nNew){ ** to account for the range contraints pLower and pUpper. ** ** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be -** used, each range inequality reduces the search space by a factor of 4. -** Hence a pair of constraints (x>? AND x? AND x Date: Fri, 6 Jun 2014 20:20:09 +0000 Subject: [PATCH 04/55] Make sure the estLog() routine in the query planner handles negative values correctly (always returning 1). Prior to this change, estLog(-1) would return a large number which could throw off the cost computations in the query planner in obscure circumstances. FossilOrigin-Name: 75437bee4905949c66dc7694ea234d4d5aefd981 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/where.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 7a13812832..705a08b059 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sobsolete\scomment\son\sthe\swhereRangeScanEst()\sroutine.\s\sNo\nchanges\sto\scode. -D 2014-06-06T17:09:52.932 +C Make\ssure\sthe\sestLog()\sroutine\sin\sthe\squery\splanner\shandles\snegative\nvalues\scorrectly\s(always\sreturning\s1).\s\sPrior\sto\sthis\schange,\sestLog(-1)\nwould\sreturn\sa\slarge\snumber\swhich\scould\sthrow\soff\sthe\scost\scomputations\nin\sthe\squery\splanner\sin\sobscure\scircumstances. +D 2014-06-06T20:20:09.587 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -294,7 +294,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c b6dc818941e13210ae7c64b9b5198b1a693bf765 +F src/where.c 1c0a0b1f132915c8b9d2c6a4aecd45654d2a9708 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1173,7 +1173,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7123bb2605216396f65db5d156431b3613f313b5 -R 47d6ccb6d1a86c986ab1ed05f4aba5d5 +P b16bf8518b7c50f6a939aa54900fea91b1098470 +R aa890a720553b08dcd5baa6682ecf12b U drh -Z c4d23929c4a97c69fe369953e2b29d73 +Z ae86adf92502bda11b2b40851a1bac03 diff --git a/manifest.uuid b/manifest.uuid index 98f7bd81f2..bdd24ef13f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b16bf8518b7c50f6a939aa54900fea91b1098470 \ No newline at end of file +75437bee4905949c66dc7694ea234d4d5aefd981 \ No newline at end of file diff --git a/src/where.c b/src/where.c index e9ef46c197..24c57f34e5 100644 --- a/src/where.c +++ b/src/where.c @@ -1494,7 +1494,7 @@ static int isDistinctRedundant( ** Estimate the logarithm of the input value to base 2. */ static LogEst estLog(LogEst N){ - LogEst x = sqlite3LogEst(N); + LogEst x = N<0 ? 1 : sqlite3LogEst(N); return x>33 ? x - 33 : 0; } From 69e9782f23a55988290253d4580719bfd24ee233 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 6 Jun 2014 20:49:19 +0000 Subject: [PATCH 05/55] Add a test case to ensure that estLog() works for negative numbers. FossilOrigin-Name: 813469d98519b609669a004b7b604af78ef40c02 --- manifest | 11 +- manifest.uuid | 2 +- test/whereJ.test | 331 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 338 insertions(+), 6 deletions(-) create mode 100644 test/whereJ.test diff --git a/manifest b/manifest index 705a08b059..8babedd8a7 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sestLog()\sroutine\sin\sthe\squery\splanner\shandles\snegative\nvalues\scorrectly\s(always\sreturning\s1).\s\sPrior\sto\sthis\schange,\sestLog(-1)\nwould\sreturn\sa\slarge\snumber\swhich\scould\sthrow\soff\sthe\scost\scomputations\nin\sthe\squery\splanner\sin\sobscure\scircumstances. -D 2014-06-06T20:20:09.587 +C Add\sa\stest\scase\sto\sensure\sthat\sestLog()\sworks\sfor\snegative\snumbers. +D 2014-06-06T20:49:19.299 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1107,6 +1107,7 @@ F test/whereF.test 5b2ba0dbe8074aa13e416b37c753991f0a2492d7 F test/whereG.test 0ac23e5e8311b69d87245f4a85112de321031658 F test/whereH.test e4b07f7a3c2f5d31195cd33710054c78667573b2 F test/whereI.test 1d89199697919d4930be05a71e7fe620f114e622 +F test/whereJ.test 7dde28284d20f358b559ca592e294db03e1d7103 F test/wherelimit.test 5e9fd41e79bb2b2d588ed999d641d9c965619b31 F test/wild001.test bca33f499866f04c24510d74baf1e578d4e44b1c F test/win32heap.test ea19770974795cff26e11575e12d422dbd16893c @@ -1173,7 +1174,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b16bf8518b7c50f6a939aa54900fea91b1098470 -R aa890a720553b08dcd5baa6682ecf12b +P 75437bee4905949c66dc7694ea234d4d5aefd981 +R cd7c3066c722d9461c491648a12f3bbc U drh -Z ae86adf92502bda11b2b40851a1bac03 +Z bd1ed1df3d77361aa69d91899562bfbf diff --git a/manifest.uuid b/manifest.uuid index bdd24ef13f..1ffa7c04c8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -75437bee4905949c66dc7694ea234d4d5aefd981 \ No newline at end of file +813469d98519b609669a004b7b604af78ef40c02 \ No newline at end of file diff --git a/test/whereJ.test b/test/whereJ.test new file mode 100644 index 0000000000..3cdeae890b --- /dev/null +++ b/test/whereJ.test @@ -0,0 +1,331 @@ +# 2014-06-06 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file implements a single regression test for a complex +# query planning case. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set ::testprefix whereJ + +ifcapable !stat4 { + finish_test + return +} + +do_execsql_test whereJ-1.0 { + CREATE TABLE tx1 ( + est, + cid, + sid, + fid, + aid, + edate, + rstat, + ftype, + cx, + fyear, + fp, + acode, + a1, + curx, + tdate, + gstat, + trgtpx, + effdate, + adate, + ytime, + mstat + ); + CREATE INDEX ix0 on tx1(a1,curx,aid,cid,sid,ftype,fp,fyear DESC,edate DESC,fid); + CREATE INDEX ix1 on tx1(a1,curx,aid,ftype,fp,fyear DESC,fid,edate DESC,cid,sid); + CREATE INDEX ix2 on tx1(a1,curx,cid,sid,ftype,fp,fyear DESC,edate DESC,aid,fid); + CREATE INDEX ix3 on tx1(a1,curx,fid,ftype,fp,fyear DESC,cid,sid,aid,edate DESC); + CREATE INDEX ix4 on tx1(a1,curx,ftype,cid,sid,aid,edate DESC,fid,fp,fyear DESC); + CREATE INDEX ix5 on tx1(a1,curx,ftype,aid,fid,cid,sid,edate DESC,fp,fyear DESC); + CREATE INDEX ix6 on tx1(ftype,fp,fyear DESC,cid,sid,edate DESC,a1,fid,aid,curx,est,rstat,cx,acode,tdate,gstat,trgtpx,effdate,adate,ytime,mstat); + CREATE INDEX ix7 on tx1(cid,a1,curx,sid,ftype,est,fid,aid,edate,rstat,cx,fyear,fp,acode,tdate,gstat,trgtpx,effdate,adate,ytime,mstat); + CREATE INDEX ix8 on tx1(cid,sid,edate DESC,aid,est); + CREATE INDEX ix9 on tx1(aid,edate DESC,a1,curx); +} {} +do_execsql_test whereJ-1.1 { + ANALYZE sqlite_master; + DELETE FROM sqlite_stat1; + DELETE FROM sqlite_stat4; + INSERT INTO sqlite_stat1 VALUES('tx1','ix9','11680827 289 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix8','11680827 286 250 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix7','11680827 286 194 98 88 83 18 7 6 2 2 2 2 2 2 2 2 2 2 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix6','11680827 5840414 5840414 5840414 240 212 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix5','11680827 5840414 2920207 1668690 114 90 8 8 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix4','11680827 5840414 2920207 1668690 92 83 9 2 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix3','11680827 5840414 2920207 2048 1835 1835 1835 12 11 8 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix2','11680827 5840414 2920207 98 88 83 83 83 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix1','11680827 5840414 2920207 117 114 114 114 90 2 2 2'); + INSERT INTO sqlite_stat1 VALUES('tx1','ix0','11680827 5840414 2920207 117 9 9 9 9 9 2 2'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','6736 21 21 21 1','29210 29404 29404 29404 29424','44 12184 13020 13079 29424',X'06030409080416C1150133512800B01FCA'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','6658 24 21 21 1','452220 453273 453276 453276 453296','622 226258 235279 236774 453296',X'06030409080416F34501332ADC00AA1BD3'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','820 2 2 2 1','1297771 1297869 1297869 1297869 1297869','1964 681724 711020 715822 1297869',X'06030409080317875501332C6C55AF4D'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','26985 2216 2216 2216 1','1797607 1797782 1797782 1797782 1799997','3162 970307 1008879 1016089 1799997',X'0603040809041A08040132401A0099A334'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','10434 19 17 17 1','2118117 2120403 2120405 2120405 2120421','3815 1136110 1181459 1190207 2120421',X'0603040908041AD36901332CD000861A2F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','437 1 1 1 1','2595414 2595739 2595739 2595739 2595739','5005 1409452 1464066 1475163 2595739',X'0603040808031CE7FD01317FD46BFBCC'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','12619 38 38 38 1','2595957 2600212 2600212 2600212 2600249','5007 1410347 1464961 1476068 2600249',X'0603040808041CE87E01328F61008CE96A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','7534 23 18 18 1','3329985 3334890 3334895 3334895 3334912','6901 1834013 1902216 1917268 3334912',X'060304090804244E1901328F59008CAA39'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','5693 1 1 1 1','3891665 3893609 3893609 3893609 3893609','8357 2164400 2245393 2263185 3893609',X'0603040808043063B70132B66800A28A43'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','44405 2588 2223 1527 1','4220255 4221633 4221998 4222694 4224220','9221 2354858 2441973 2461511 4224220',X'0603040909043377630133517A00B0DE4F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','6883 32 28 28 1','4423918 4429926 4429930 4429930 4429957','9690 2452276 2543443 2563995 4429957',X'06030409080434F46801328F5C008CC3DA'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','6974 27 26 26 1','5048404 5051129 5051130 5051130 5051155','11703 2817010 2920184 2944013 5051155',X'0603040908043C1C5C0132DEA5009F7473'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','476 2 2 2 1','5191322 5191479 5191479 5191479 5191479','12242 2901130 3006663 3031222 5191479',X'0603040908033DC6080132DEA478849A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','627 4 4 4 1','6488823 6489349 6489349 6489349 6489349','16423 3644815 3778857 3809866 6489349',X'0603040808035AA00E0131F4AE342150'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','145 2 2 1 1','7787091 7787218 7787218 7787219 7787219','20223 4343720 4510110 4547961 7787219',X'0603040809037254890132189C703706'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','20 1 1 1 1','9085074 9085089 9085089 9085089 9085089','25315 5033102 5230788 5275692 9085089',X'06040408080300EAE6CA01326657620652'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','229621 6135 5934 5934 1','9507353 9572696 9572696 9572696 9576801','27189 5255584 5463962 5511784 9576801',X'06040408080300F2FA440132DF1A7D1A60'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','6376 24 22 22 1','10381524 10382938 10382940 10382940 10382959','30519 5581705 5804515 5856651 10382959',X'06040409080400F9DBF3013305AC00A688A4'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','7761 45 9 9 1','10569039 10572476 10572512 10572512 10572520','31455 5661599 5888691 5941811 10572520',X'06040409080400FB31560132DDD800A05DF5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','8382 37 37 37 1','10866664 10867565 10867565 10867565 10867601','33475 5809193 6042611 6097741 10867601',X'06040409080400FFA4A701332A0E00A93957'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','76136 4099 3018 3018 1','11283107 11308143 11309224 11309224 11312241','37001 6022861 6264510 6322923 11312241',X'060404090804010B0A5C0133517200B0E8E0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','23472 2188 2188 2181 1','11365285 11380281 11380281 11380288 11382468','37055 6026680 6268909 6327509 11382468',X'060404080904010B3C6701332B2E00AA4374'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','59591 4087 4073 4 1','11415316 11448759 11448773 11452842 11452845','37350 6040743 6283483 6342389 11452845',X'060404090904010BFA810133512800B010AE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix9','43891 3029 3021 4 1','11598477 11622881 11622889 11625906 11625909','39110 6107644 6353109 6413914 11625909',X'0604040909040113B9960133512800B01235'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7340 4977 19 1 1 1','206533 206533 208739 208757 208757 208757','125 164 111403 207397 207399 208757',X'070308040407030187840132B54B0101A0D1401C0000000000004C87E5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','8877 8788 45 1 1 1','1221375 1221375 1224509 1224553 1224553 1224553','931 1117 679933 1216705 1216722 1224553',X'07030804040703018D3F0133023D010B9B67401C0000000000007A99EF'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7204 7204 39 1 1 1','1240162 1240162 1242572 1242610 1242610 1242610','942 1131 688420 1234655 1234672 1242610',X'07030804040703018D4F0132DB820105D324401C0000000000007EC569'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','9608 9608 44 1 1 1','1264939 1264939 1266529 1266572 1266572 1266572','952 1145 699518 1258423 1258440 1266572',X'07030804040704018D61013305B9010D3CEB406E8000000000000081E17A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','6636 6636 1 1 1 1','1294580 1294580 1297869 1297869 1297869 1297869','964 1159 713121 1289522 1289540 1297869',X'07030804030704018D7801328F693482A2403400000000000000A26728'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7822 6629 26 1 1 1','2375708 2375708 2381333 2381358 2381358 2381358','3423 3833 1371902 2366527 2366559 2381358',X'0703080403070301B1F501317F16403B7B403F00000000000060D67A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','1403 1303 5 1 1 1','2594767 2594767 2595737 2595739 2595739 2595739','3914 4427 1512042 2580073 2580114 2595739',X'0703080403070301B6480131CC18558082407120000000000029CC12'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7901 6067 26 1 1 1','3424107 3424107 3425939 3425964 3425964 3425964','5872 6630 2032411 3406550 3406594 3425964',X'0703080404070401C3F90132B7A100FDCC04403E00000000000000A014CE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7483 6161 22 1 1 1','3549446 3549446 3555223 3555244 3555244 3555244','5932 6752 2099309 3535259 3535304 3555244',X'0703080403070301C4490131573F4104F8403400000000000067FD1E'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','12076 8263 37 1 1 1','3558079 3558079 3560036 3560072 3560072 3560072','5935 6758 2101989 3540078 3540123 3560072',X'0703080404070301C44E0132DD0901076DA9404200000000000076F994'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','1123 1113 1 1 1 1','3892913 3892913 3893609 3893609 3893609 3893609','6594 7611 2305483 3871711 3871770 3893609',X'0703080403070301CA280131CA1C215083401C00000000000071F6B2'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','9344 7315 41 1 1 1','4213510 4213510 4219434 4219474 4219474 4219474','7200 8390 2503024 4196141 4196204 4219474',X'0703080404070301CE8C01317DE800FE4E8B4034000000000000458317'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','8062 3291 1 1 1 1','5037060 5037060 5040350 5040350 5040350 5040350','10201 11915 3045602 5012912 5012997 5040350',X'070308040307030213B20130B83A16DF86403600000000000028F8CD'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','9125 2926 1 1 1 1','5046490 5052665 5055590 5055590 5055590 5055590','10203 11926 3055524 5028097 5028182 5055590',X'070302040307030213B5232A013107F01745AF40330000000000002B57DE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','591 591 1 1 1 1','5190991 5190991 5191479 5191479 5191479 5191479','10649 12426 3145181 5163206 5163296 5191479',X'070308040307030244AD0131315217C1CD401C00000000000003BC32'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7381 4689 1 1 1 1','6112248 6112248 6116936 6116936 6116936 6116936','13780 16308 3748958 6083681 6083797 6116936',X'0703080403070402A9D1013108B531A21C401C0000000000000092F5C6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7569 7381 28 1 1 1','6280084 6280084 6281842 6281869 6281869 6281869','14559 17217 3856803 6247722 6247841 6281869',X'0703080404070302C14C0132DBF101044CC7401C00000000000074FB16'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','8289 7047 28 1 1 1','6290764 6290764 6296854 6296881 6296881 6296881','14569 17229 3863206 6262658 6262777 6296881',X'0703080403070302C16401317CC348B670401C0000000000006824BB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','2209 2209 1 1 1 1','6489075 6489075 6489349 6489349 6489349 6489349','15377 18147 3986912 6454194 6454318 6489349',X'0703080403070402EA5901332A656C6F5E401C00000000000000AE7C03'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7381 6799 1 1 1 1','7314420 7314420 7321218 7321218 7321218 7321218','18403 21722 4532963 7281695 7281847 7321218',X'07030804030703049EE501310667176DC940438000000000005ED2B5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','7163 7001 31 1 1 1','7652849 7652849 7658600 7658630 7658630 7658630','19462 22956 4750159 7617449 7617608 7658630',X'070308040407030503EB01317DEF010ADD3F402800000000000061C3EF'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','1433 1433 2 1 1 1','7785842 7785842 7787219 7787219 7787219 7787219','20001 23575 4834605 7745315 7745477 7787219',X'07030804030703055010013156D81B11AC404380000000000004A313'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','2247 2247 1 1 1 1','9083272 9083272 9085089 9085089 9085089 9085089','24940 29143 5668423 9036693 9036887 9085089',X'070308040307031A620A01323EEB5CE39C406FE000000000006F8177'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix8','107 107 5 1 1 1','10382912 10382912 10382957 10382959 10382959 10382959','31251 36297 6541362 10329764 10330008 10382959',X'0704080403070400955501013350516AA9D0406060000000000000884648'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7340 4770 4527 3331 3331 970 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','206533 206533 206533 206533 206533 206596 207565 207565 207565 207565 207565 207565 207565 207565 207565 207565 207565 207565 207565 207565 207565 207565','125 202 402 512 560 6209 20696 25885 206260 206260 206260 206260 206260 206260 206260 206260 206260 206260 206260 206260 206260 207565',X'1703080808080704030408030808010308070808080803018784401C000000000000024FD353493F8801317E4700FFFF0F00FFFFC0F869E0000000002642C5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','8877 4669 71 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','1221375 1225583 1230181 1230249 1230249 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251 1230251','931 1504 2992 3495 3751 39629 120561 147424 1222711 1222711 1222711 1222711 1222711 1222711 1222711 1222711 1222711 1222711 1222711 1222711 1222711 1230251',X'1703090902080704030408090808010108070404040804018D3F03E8405680000000000000822B981EB823013351F00F0C4086E00000000000013351F0013351F053870D7500B22A8C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7204 4801 193 193 4 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','1240162 1240162 1244770 1244770 1244959 1244961 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962 1244962','942 1520 3024 3531 3791 40098 122274 149540 1237296 1237296 1237296 1237296 1237296 1237296 1237296 1237296 1237296 1237296 1237296 1237296 1237296 1244962',X'1703080908010703030408030808010308070408040803018D4F07406FE000000000000602CF16DE05013303C300FFFF0300FFFFC0F869E000000000013303C3008000004BD756'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','9608 6098 5910 5910 5910 2149 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','1264939 1264939 1264939 1264939 1264939 1265217 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365 1267365','952 1536 3055 3576 3841 40616 124132 151876 1259547 1259547 1259547 1259547 1259547 1259547 1259547 1259547 1259547 1259547 1259547 1259547 1259547 1267365',X'1703080808080704030408090808010101070404040803018D61401C0000000000000131374D1726AB0132DD780F0C0540390000000000000132DD780132DD784E2789C6190CA9'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','6636 4411 4237 4237 4237 33 8 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1','1294580 1294580 1294580 1294580 1294580 1297842 1297862 1297862 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869','964 1557 3097 3622 3888 41246 126538 154868 1289863 1289863 1289863 1289863 1289863 1289863 1289863 1289863 1289863 1289863 1289863 1289863 1289863 1297869',X'1703080808080703030408090808010308070808080803018D7840420000000000007332F1227B5901321AF80800FFFF40260000000000006D0CEB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7822 4817 260 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','2375708 2375708 2380265 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524 2380524','3423 5117 10120 11184 11775 86237 242937 294878 2366404 2366404 2366404 2366404 2366404 2366404 2366404 2366404 2366404 2366404 2366404 2366404 2366404 2380524',X'170308090308070304040803080801030807040408080401B1F501831C405C40000000000077646800EAD44C0132697000FFFF0300FFFFC0F869E0000000000132696F0132696F0094935E'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','1403 1022 82 74 74 55 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','2594767 2594767 2595707 2595707 2595707 2595708 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739','3914 5817 11518 12879 13613 98100 278304 342850 2580971 2580971 2580971 2580971 2580971 2580971 2580971 2580971 2580971 2580971 2580971 2580971 2580971 2595739',X'170308090808070303040803080801030807080808080301B648405C400000000000038EAC243F770131A6F700FFFF0E00FFFFC0F869E0000000005C8664'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7901 5298 291 55 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','3424107 3424107 3429114 3429350 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404 3429404','5872 8944 17727 19769 20846 145206 401995 498360 3411279 3411279 3411279 3411279 3411279 3411279 3411279 3411279 3411279 3411279 3411279 3411279 3411279 3429404',X'170308090201070404040803080801030807040808080401C3F9232807405C40000000000000FF559400F2FA440133294600FFFF0300FFFFC0F869E000000000013329460083157B'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7483 5407 230 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','3549446 3549446 3554623 3554845 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852 3554852','5932 9041 17921 20139 21264 149060 417718 520064 3536268 3536268 3536268 3536268 3536268 3536268 3536268 3536268 3536268 3536268 3536268 3536268 3536268 3554852',X'170308090201070404040803080801030807040808080401C449232807405C40000000000000FF559400F2FA440133294600FFFF0300FFFFC0F869E000000000013329460083162A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','12076 8365 7981 5546 5546 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','3558079 3558079 3558079 3558079 3558079 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624 3563624','5935 9046 17930 20154 21279 149235 418443 521109 3544970 3544970 3544970 3544970 3544970 3544970 3544970 3544970 3544970 3544970 3544970 3544970 3544970 3563624',X'170308080808070303040803080801030107040408080301C44E4074300000000000029EB13BB98E01328EFE00FFFF0E00FFFF0AC0F869E00000000001328F0001328F0071D802'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','1123 916 875 875 875 93 22 22 1 1 1 1 1 1 1 1 1 1 1 1 1 1','3892913 3892913 3892913 3892913 3892913 3893531 3893602 3893602 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609','6594 10057 19942 22653 23964 165533 468498 587524 3873325 3873325 3873325 3873325 3873325 3873325 3873325 3873325 3873325 3873325 3873325 3873325 3873325 3893609',X'170308080808070403040802080801030107040404080301CA28403F00000000000000832DC71933330132DB8800FC0F00FFFF054050C000000000000132DB870132DB8A4D5E35A2107205'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','9344 6359 6022 9 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','4213510 4213510 4213510 4219523 4219523 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531 4219531','7200 11025 21872 25036 26543 181203 517345 652858 4198057 4198057 4198057 4198057 4198057 4198057 4198057 4198057 4198057 4198057 4198057 4198057 4198057 4219531',X'170308080308070303040803080801030807080808080301CE8C0186A0403F00000000000002C2142F19870131554100FFFF0F00FFFFC0F869E0000000000687F7'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','8062 4993 241 53 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','5037060 5037060 5041812 5042000 5042051 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052 5042052','10201 15484 30736 35196 37326 231854 654010 829510 5017193 5017193 5017193 5017193 5017193 5017193 5017193 5017193 5017193 5017193 5017193 5017193 5017193 5042052',X'17030809020107030404080308080103080704080808030213B2245407406FE0000000000002C0AA00F6ABA101332A7E00FFFF0300FFFFC0F869E00000000001332A7E5287C0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','9125 5761 264 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','5046490 5046490 5051987 5052246 5052246 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250 5052250','10203 15488 30744 35230 37365 232178 654964 830718 5027358 5027358 5027358 5027358 5027358 5027358 5027358 5027358 5027358 5027358 5027358 5027358 5027358 5052250',X'17030809030807030304080308080103080708080808030213B501831F406FE00000000000029E627136F901328DD500FFFF0300FFFFC0F869E000000000290DD6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','591 591 566 566 566 27 18 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1','5190991 5190991 5190991 5190991 5190991 5191461 5191464 5191474 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479','10649 16115 31973 36593 38793 239550 673441 853755 5165855 5165855 5165855 5165855 5165855 5165855 5165855 5165855 5165855 5165855 5165855 5165855 5165855 5191479',X'17030808080807030404080108080101080708080808040244AD4045800000000000029E6200EAE8740132690D0A0F0C402E00000000000000941EAF'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7381 3728 83 16 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','6112248 6115901 6119546 6119613 6119613 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628 6119628','13780 20707 41067 47538 50438 296473 834203 1056686 6089878 6089878 6089878 6089878 6089878 6089878 6089878 6089878 6089878 6089878 6089878 6089878 6089878 6119628',X'170309090208070304040809080801010807040404080402A9D12328407360000000000002172300EABCFF0133517F0F0C404AA6665E02EA960133517F01335239538BC5C1008B5EC9'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7569 5785 274 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','6280084 6280084 6285595 6285867 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868 6285868','14559 21811 43240 50020 53057 307264 862871 1092992 6255378 6255378 6255378 6255378 6255378 6255378 6255378 6255378 6255378 6255378 6255378 6255378 6255378 6285868',X'170308090301070404040803080801030807040808080302C14C01832707405C40000000000000FF559400F2FA440133294600FFFF0300FFFFC0F869E000000000013329461E5109'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','8289 5734 266 33 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','6290764 6290764 6296232 6296465 6296495 6296495 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497 6296497','14569 21827 43272 50056 53096 307563 864043 1094585 6265950 6265950 6265950 6265950 6265950 6265950 6265950 6265950 6265950 6265950 6265950 6265950 6265950 6296497',X'170308090201070404040803080801030807040808080402C164232807405C40000000000000FF559400F2FA440133294600FFFF0300FFFFC0F869E0000000000133294600A90415'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','2209 1450 1369 1369 1369 597 13 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1','6489075 6489075 6489075 6489075 6489075 6489139 6489344 6489344 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349','15377 22998 45584 52641 55837 319564 895653 1134252 6458046 6458046 6458046 6458046 6458046 6458046 6458046 6458046 6458046 6458046 6458046 6458046 6458046 6489349',X'170308080808070303040802080801030807040404080302EA59401C0000000000000D4B201AD8B30132DF0400FC0600FFFF40180000000000000132DF040132DF054EBA338714FBBA'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7381 5446 171 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','7314420 7314420 7319695 7319855 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865 7319865','18403 27319 54152 62541 66337 369851 1032180 1306261 7284923 7284923 7284923 7284923 7284923 7284923 7284923 7284923 7284923 7284923 7284923 7284923 7284923 7319865',X'1703080902010703030408030808010308070408080804049EE503E907405C400000000000029EC32E97BE0133061F00FFFF0300FFFFC0F869E0000000000133061F00A9ECEF'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','7163 4782 209 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','7652849 7652849 7657422 7657626 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630 7657630','19462 28830 57147 65962 69945 388539 1084446 1372423 7621247 7621247 7621247 7621247 7621247 7621247 7621247 7621247 7621247 7621247 7621247 7621247 7621247 7657630',X'17030809020107040404080308080103080704080808040503EB03EA07405C40000000000000FF559400F2FA440133294600FFFF0300FFFFC0F869E0000000000133294600831554'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','1433 582 571 571 571 15 15 15 1 1 1 1 1 1 1 1 1 1 1 1 1 1','7785842 7786693 7786693 7786693 7786693 7787208 7787208 7787208 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219','20001 29582 58632 67649 71736 396840 1107204 1400830 7750264 7750264 7750264 7750264 7750264 7750264 7750264 7750264 7750264 7750264 7750264 7750264 7750264 7787219',X'1703090808080703040408090808010108070404040804055010406E80000000000001C7A600FC429201332D890F0C402C00000000000001332D890133505352D7248A008775D8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','2247 682 657 657 657 117 45 45 1 1 1 1 1 1 1 1 1 1 1 1 1 1','9083272 9084837 9084837 9084837 9084837 9085088 9085088 9085088 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089','24940 36384 72113 82665 87632 474987 1318830 1664527 9042708 9042708 9042708 9042708 9042708 9042708 9042708 9042708 9042708 9042708 9042708 9042708 9042708 9085089',X'17030908080807030304080208080103010704040408031A620A403E00000000000001C3D332CF850132DE9D00FC0200FFFF054050E000000000000132DE9D0132DE9D4E8C092E790553'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix7','107 77 69 69 69 11 5 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1','10382912 10382942 10382942 10382942 10382942 10382952 10382956 10382956 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959','31251 45639 90416 102896 109225 567280 1544395 1943661 10337289 10337289 10337289 10337289 10337289 10337289 10337289 10337289 10337289 10337289 10337289 10337289 10337289 10382959',X'170409080808070303040809080801010807040404080300955501403E000000000000029E686E250B01332D220F0C402E00000000000001332D220133504E52CFCF4F21CD7F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7337 4975 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 206462 206462 210789 210789 210807 210807 210807 210807 210807 210807 210807 210807 210807 210807 210807 210807 210807 210807 210807','0 0 0 125 164 112407 128579 207456 209489 209490 209490 209490 209490 209490 209490 209490 209490 209490 209490 209490 209490 210807',X'170808080308040804030807080301030807080808080301878401317F26024FD3531E2DAF404200000000000000FFFF0200FFFFC0F869E0000000002642C4'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 8874 8785 45 25 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 1221012 1221012 1224145 1224165 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189 1224189','0 0 0 931 1117 679896 773861 1207582 1216653 1216673 1216673 1216673 1216673 1216673 1216673 1216673 1216673 1216673 1216673 1216673 1216673 1224189',X'1708080803080409040408070809010308070404040803018D3F0133023D01940C420106B14D40420000000000000F00FFFF4070E000000000000133023D0133023D4F2053654AE525'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7200 7200 39 15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 1239793 1239793 1242199 1242223 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237 1242237','0 0 0 942 1131 688381 783660 1225441 1234602 1234622 1234622 1234622 1234622 1234622 1234622 1234622 1234622 1234622 1234622 1234622 1234622 1242237',X'1708080803080409040308070809010301070404040804018D4F0132DB820113FAB92F19C5401C0000000000000F00FFFF0F403A0000000000000132DB820132DB824D542A4F009B5C72'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 9606 9606 44 25 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 1264560 1264560 1266149 1266168 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192 1266192','0 0 0 952 1145 699479 796008 1249062 1258369 1258391 1258391 1258391 1258391 1258391 1258391 1258391 1258391 1258391 1258391 1258391 1258391 1266192',X'1708080803080409040308070809010101070404040803018D61013305B9017CDF4916F8B140280000000000000F0C0A403600000000000001330557013305B9507EA8DD212E79'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 6635 6635 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 1294199 1294199 1297868 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869 1297869','0 0 0 964 1159 713241 812408 1280435 1289849 1289871 1289871 1289871 1289871 1289871 1289871 1289871 1289871 1289871 1289871 1289871 1289871 1297869',X'1708080803080409030308070803010308070808080803018D78013267DC0EF747387106403F00000000000000FFFF0F00FFFFC0F869E00000000006B968'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7815 6624 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 2374939 2374939 2380559 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584 2380584','0 0 0 3423 3833 1371803 1539928 2350493 2366415 2366460 2366460 2366460 2366460 2366460 2366460 2366460 2366460 2366460 2366460 2366460 2366460 2380584',X'170808080308040903030807080301030807080808080301B1F501317F160DDEA51C46AB405280000000000000FFFF0F00FFFFC0F869E0000000006ADDA9'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 3595 3459 10 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 2595336 2595336 2595734 2595737 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739 2595739','0 0 0 3918 4433 1512586 1693312 2557025 2580917 2580967 2580967 2580967 2580967 2580967 2580967 2580967 2580967 2580967 2580967 2580967 2580967 2595739',X'170808080308040903030807080101010107040404080301B64F01332ACC029E833D19084028000000000000320F0C054074A0000000000001332A0901332ACC518A316F1F30D6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7894 6061 26 10 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 3422592 3422592 3424418 3424434 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443 3424443','0 0 0 5872 6630 2032185 2267240 3366727 3406294 3406363 3406363 3406363 3406363 3406363 3406363 3406363 3406363 3406363 3406363 3406363 3406363 3424443',X'170808080308040904030807080101030807040404080401C3F90132B7A100D6FD7F6CE97F4070500000000000100F00FFFF40560000000000000132B7310132DB2D4D3F72D9009AE8EE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7479 6158 22 22 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 3547845 3547845 3553619 3553619 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640 3553640','0 0 0 5932 6752 2099067 2343370 3491679 3534981 3535053 3535053 3535053 3535053 3535053 3535053 3535053 3535053 3535053 3535053 3535053 3535053 3553640',X'170808080308040804030807080301030807080808080301C4490131573F008E7AC03077E0403E00000000000000FFFF0F00FFFFC0F869E00000000065B45A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 12068 8257 37 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 3556474 3556474 3558426 3558446 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462 3558462','0 0 0 5935 6758 2101744 2346448 3496404 3539797 3539869 3539869 3539869 3539869 3539869 3539869 3539869 3539869 3539869 3539869 3539869 3539869 3558462',X'170808080308040904030807080201010107040404080301C44E0132DD09016891C11788EB404200000000000000FC0F0C0F400199999999999A0132DD090132DD094DE5DCE3763299'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 1510 1497 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 3892149 3892149 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609 3893609','0 0 0 6596 7614 2306358 2572095 3823194 3873232 3873319 3873319 3873319 3873319 3873319 3873319 3873319 3873319 3873319 3873319 3873319 3873319 3893609',X'170808080308040803030807080301030807080808080301CA2E01312E3A038EE6257265400000000000000000FFFF0600FFFFC0F869E00000000032518F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 9341 7313 41 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 4211282 4211282 4217204 4217243 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244 4217244','0 0 0 7200 8390 2502650 2792131 4139620 4195704 4195798 4195798 4195798 4195798 4195798 4195798 4195798 4195798 4195798 4195798 4195798 4195798 4217244',X'170808080308040903030807080301030807080808080301CE8C01317DE8029E9D3B6D23403E00000000000000FFFF0F00FFFFC0F869E00000000008EF7D'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 8055 3290 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 5033936 5033936 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225 5037225','0 0 0 10201 11915 3045026 3383481 4941323 5012256 5012369 5012369 5012369 5012369 5012369 5012369 5012369 5012369 5012369 5012369 5012369 5012369 5037225',X'17080808030804090303080708030803080708080808030213B20130B83A018A7516DF86403600000000000000FFFF00FFFFC0F869E00000000028F8CD'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 9117 2923 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 5043358 5049528 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450 5052450','0 0 0 10203 11926 3054947 3394812 4956408 5027439 5027552 5027552 5027552 5027552 5027552 5027552 5027552 5027552 5027552 5027552 5027552 5027552 5052450',X'17080808030204080303080708030103080708080808030213B5232A013107F00217231745AF403300000000000000FFFF0200FFFFC0F869E0000000002B57DE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 333 333 4 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 5191271 5191271 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479 5191479','0 0 0 10672 12452 3147059 3494842 5093162 5165710 5165827 5165827 5165827 5165827 5165827 5165827 5165827 5165827 5165827 5165827 5165827 5165827 5191479',X'17080808030804080303080708030103080708080808030244F00131CB4201C1C917188E403F00000000000000FFFF0800FFFFC0F869E00000000001C5CB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7374 4684 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 6107894 6107894 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577 6112577','0 0 0 13780 16308 3748117 4153600 5995776 6082692 6082834 6082834 6082834 6082834 6082834 6082834 6082834 6082834 6082834 6082834 6082834 6082834 6112577',X'170808080308040803030807080301030807080808080402A9D1013108B5029E6831A21C401C00000000000000FFFF0200FFFFC0F869E0000000000092F5C6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7562 7376 28 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 6275521 6275521 6277274 6277291 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301 6277301','0 0 0 14559 17217 3855913 4271255 6156622 6246677 6246823 6246823 6246823 6246823 6246823 6246823 6246823 6246823 6246823 6246823 6246823 6246823 6277301',X'170808080308040904030807080201030107040404080302C14C0132DBF100832DC739FF53403F00000000000000FC0F00FFFF05402C0000000000000132DBF10132DBF34D89B7AA1114CB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 8282 7043 28 28 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 6286191 6286191 6292277 6292277 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304 6292304','0 0 0 14569 17229 3862314 4278722 6171137 6261611 6261757 6261757 6261757 6261757 6261757 6261757 6261757 6261757 6261757 6261757 6261757 6261757 6292304',X'170808080308040804030807080301030807080808080302C16401317CC301B5AA4A1AB270405680000000000000FFFF0F00FFFFC0F869E00000000048FD4C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 3101 3101 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 6486495 6486495 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349 6489349','0 0 0 15379 18149 3988504 4417216 6363796 6457879 6458036 6458036 6458036 6458036 6458036 6458036 6458036 6458036 6458036 6458036 6458036 6458036 6489349',X'170808080308040803030807080301030807080808080302EA6601317F7301C3EB17C4CE401C00000000000000FFFF0F00FFFFC0F869E000000000398198'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 7379 6798 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 7308682 7308682 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479 7315479','0 0 0 18403 21722 4531809 5008068 7172304 7280343 7280536 7280536 7280536 7280536 7280536 7280536 7280536 7280536 7280536 7280536 7280536 7280536 7315479',X'1708080803080408040308070803010308070808080803049EE501310667008390D0176DC9404380000000000000FFFF0500FFFFC0F869E0000000005ED2B5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 211 211 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 7787150 7787150 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219','0 0 0 20027 23602 4837427 5341824 7634169 7750020 7750224 7750224 7750224 7750224 7750224 7750224 7750224 7750224 7750224 7750224 7750224 7750224 7787219',X'17080808030804080303080708090103080704040808030550B30132B73501A79C17C3D840340000000000000F00FFFF40140000000000000132B6D00132B7400D1DB9'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 26 26 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 9085083 9085083 9085088 9085088 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089 9085089','0 0 0 24964 29171 5671673 6246216 8904392 9042441 9042684 9042684 9042684 9042684 9042684 9042684 9042684 9042684 9042684 9042684 9042684 9042684 9085089',X'17080808030804080303080708030103080708080808031AA25C0131CA197A6D831B1D84401C00000000000000FFFF0F00FFFFC0F869E00000000071E307'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','11668540 11668540 11668540 1261 1261 9 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','0 0 0 10381872 10381872 10382956 10382956 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959 10382959','0 0 0 31297 36344 6545140 7198586 10180602 10336983 10337266 10337266 10337266 10337266 10337266 10337266 10337266 10337266 10337266 10337266 10337266 10337266 10382959',X'17080808040804080303080708010101080708080808030095A4C401321BB603010141073C401C000000000000080F0C40308000000000007E55BE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix6','12287 12287 12287 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1','11668540 11668540 11668540 11672111 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127 11672127','1 1 1 43128 49243 7431284 8170740 11452355 11624787 11625093 11625093 11625093 11625093 11625093 11625093 11625093 11625093 11625093 11625093 11625093 11625093 11672127',X'1701080803020408040409070803010308070408040804070267C127130133041E00AB540900E64074405C40000000000000FFFF0300FFFFC0F869E0000000000133041E0080000000A3EE16'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 24157 24157 29 29 1 1 1 1','0 0 0 1236590 1236590 1251799 1251799 1251827 1251827 1251827 1251827','0 0 0 3120 4771 71527 72755 1238782 1238782 1238782 1251827',X'0C08080803040308040808031A080400FF5594029BB30131CD372B1368'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 1209 1209 129 129 1 1 1 1','0 0 0 1296873 1296873 1297744 1297744 1297869 1297869 1297869 1297869','0 0 0 3203 4902 74577 75831 1284645 1284645 1284645 1297869',X'0C08080803030308040808041A215F04C9D901B0A30131066F0087162A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 12129 9261 428 428 1 1 1 1','0 0 0 1790076 1790076 1790076 1790076 1790503 1790503 1790503 1790503','0 0 0 4938 7561 108783 110860 1774402 1774402 1774402 1790503',X'0C08080803030308040808031CE87E029E6B018700013219C1373BA8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 273 273 5 5 1 1 1 1','0 0 0 2595625 2595625 2595738 2595738 2595739 2595739 2595739 2595739','0 0 0 7863 12132 166423 169877 2575172 2575172 2575172 2595739',X'0C08080803030308040808042F020502DA0E02C73A0133049700A711F8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 7735 7735 29 29 1 1 1 1','0 0 0 2924165 2924165 2929754 2929754 2929782 2929782 2929782 2929782','0 0 0 9123 14045 191316 195293 2907742 2907742 2907742 2929782',X'0C080808030403080408080333776300FF559475928D013329435A824F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 360 229 27 27 1 1 1 1','0 0 0 3893374 3893505 3893605 3893605 3893609 3893609 3893609 3893609','0 0 0 13912 21124 273265 278784 3866425 3866425 3866425 3893609',X'0C08080803030308040808044717710E070B01E88F0131A5B80098D0A5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 683 671 32 32 1 1 1 1','0 0 0 5191447 5191459 5191477 5191477 5191479 5191479 5191479 5191479','0 0 0 20361 30776 381171 389104 5158962 5158962 5158962 5191479',X'0C08080803030308040808037370D10F00290188450132B537354C5E'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 213354 213354 113 113 1 1 1 1','0 0 0 6102233 6102233 6155183 6155183 6155295 6155295 6155295 6155295','0 0 0 26812 39489 472780 483115 6119281 6119281 6119281 6155295',X'0C080808040403080408080300F2FA4400FF5594019B6D01324067714AE8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 3675 3675 241 241 1 1 1 1','0 0 0 6486701 6486701 6489287 6489287 6489349 6489349 6489349 6489349','0 0 0 28380 41383 502486 513750 6452691 6452691 6452691 6489349',X'0C080808040304080408080300F6ABAC6C967D009F84B60132DBDD155A2A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 24063 24063 38 38 1 1 1 1','0 0 0 7080911 7080911 7102380 7102380 7102417 7102417 7102417 7102417','0 0 0 35724 49844 582928 595393 7065320 7065320 7065320 7102417',X'0C0808080404040804080803010B0A5C00FF559400CCD3EE0133294559DDCD'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 7173953 7173950 20284 20284 38 38 1 1 1 1','0 0 0 7107237 7107237 7126606 7126606 7126643 7126643 7126643 7126643','0 0 0 35764 49885 586473 599030 7089546 7089546 7089546 7126643',X'0C0808080404040804080803010B3C6700FF55940114CE73013329432225CC'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 630326 618063 11855 11855 3 1 1 1 1 1','0 7173953 7173953 7665258 7665258 7672559 7672561 7672561 7672561 7672561 7672561','0 1 2 64320 91213 1077048 1100563 7630436 7630436 7630436 7672561',X'0C080908040403020408080400F2FA4400FF559405DD0A23280132DD75009F3468'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 630326 618063 4 4 1 1 1 1 1 1','0 7173953 7173953 7787218 7787218 7787219 7787219 7787219 7787219 7787219 7787219','0 1 2 74034 102405 1189484 1215034 7745001 7745001 7745001 7787219',X'0C0809080403040804080803010DDABE0368B700FEBFF60133068F22D1E5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','7804279 630326 12263 1433 1433 1 1 1 1 1 1','0 7173953 7792016 7797877 7797877 7799309 7799309 7799309 7799309 7799309 7799309','0 1 3 76213 104626 1201397 1227113 7757087 7757087 7757087 7799309',X'0C08090104040408040808030700F2FA4400FF559401C3969E013329461E5052'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 8657 8657 605 605 1 1 1 1','7804279 7804279 7804279 8360485 8360485 8364643 8364643 8365247 8365247 8365247 8365247','1 2 4 77865 106290 1217527 1243460 8321843 8321843 8321843 8365247',X'0C09080803030308040808031AD369021FFC0DC36E01328E2F3D9128'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 33421 33421 57 26 1 1 1 1','7804279 7804279 7804279 8873934 8873934 8891008 8891039 8891064 8891064 8891064 8891064','1 2 4 78914 107340 1231432 1257622 8846644 8846644 8846644 8891064',X'0C090808030403020408080433776300FF55940CE166232801332A1800836DFB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 2182 2182 94 94 1 1 1 1','7804279 7804279 7804279 9083187 9083187 9085006 9085006 9085089 9085089 9085089 9085089','1 2 4 79307 107733 1237174 1263453 9040316 9040316 9040316 9085089',X'0C09080803030308040808033AC92C021FFC04AF670132B5FC38DBD0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 6023 6023 50 50 1 1 1 1','7804279 7804279 7804279 9393480 9393480 9395815 9395815 9395864 9395864 9395864 9395864','1 2 4 79973 108402 1245294 1271679 9350536 9350536 9350536 9395864',X'0C09080803030308040808034CDD9A7E1C2301C30D0132908703CC11'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 79 79 6 6 1 1 1 1','7804279 7804279 7804279 10382946 10382946 10382956 10382956 10382959 10382959 10382959 10382959','1 2 4 82501 110947 1276304 1303221 10336296 10336296 10336296 10382959',X'0C090808040303080408080400E9A10A0CC31602A47201332C6C00ABCD60'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 8251 8251 280 280 1 1 1 1','7804279 7804279 7804279 11067468 11067468 11072690 11072690 11072969 11072969 11072969 11072969','1 2 4 85529 113989 1307763 1335183 11025935 11025935 11025935 11072969',X'0C090808040404080408080300FFA4A7008A66AD0089DBDD0132B5FF6AE2B8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 44772 44772 58 58 1 1 1 1','7804279 7804279 7804279 11268036 11268036 11269261 11269261 11269318 11269318 11269318 11269318','1 2 4 87132 115597 1321101 1348736 11222284 11222284 11222284 11269318',X'0C0908080404030804080804010B0A5C00FF5594018ACD0133294300B0E291'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 53775 53775 37 19 1 1 1 1','7804279 7804279 7804279 11330929 11330929 11355027 11355045 11355063 11355063 11355063 11355063','1 2 4 87335 115800 1327560 1355328 11308029 11308029 11308029 11355063',X'0C0908080404030204080803010BFA8100FF5594026C24232801332B2E1F8BB5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 3718791 3718791 39430 39430 39 39 1 1 1 1','7804279 7804279 7804279 11458789 11458789 11476757 11476757 11476795 11476795 11476795 11476795','1 2 4 88502 116970 1340484 1368500 11429761 11429761 11429761 11476795',X'0C09080804040308040808030113B99600FF559402F6AF01332B2E1F8A54'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix5','3876548 157757 157736 5317 5317 1 1 1 1 1 1','7804279 11523070 11523070 11652823 11652823 11658139 11658139 11658139 11658139 11658139 11658139','1 3 5 100045 128561 1480184 1510648 11611105 11611105 11611105 11658139',X'0C0909080404040204080803010BFA8100FF559402594CCB2328013351E85B0F5D'); +} {} +do_execsql_test whereJ-1.3 { + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 4748 4629 308 1 1 1 1 1','0 0 0 634880 634880 639119 639426 639426 639426 639426 639426','0 0 0 779 907 26900 633919 633920 633920 633920 639426',X'0C0808080308040403080803018C4A00F450A80132671F029EAC271DA5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 4608 4608 246 1 1 1 1 1','0 0 0 752580 752580 755578 755823 755823 755823 755823 755823','0 0 0 936 1089 31876 749384 749385 749385 749385 755823',X'0C0808080308030403080804018D4F347FD20131547D018A7500936FE2'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 4776 4776 240 1 1 1 1 1','0 0 0 762070 762070 764545 764784 764784 764784 764784 764784','0 0 0 940 1097 32187 758274 758275 758275 758275 764784',X'0C0808080308030403080804018D562E0EAB0131A68F029E9300994D36'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 5910 5910 257 1 1 1 1 1','0 0 0 771353 771353 772646 772902 772902 772902 772902 772902','0 0 0 946 1103 32460 766333 766334 766334 766334 772902',X'0C0808080308030404080803018D611726F40130E13C00822B980302A0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 1834 1834 46 1 1 1 1 1','0 0 0 1296866 1296866 1297832 1297869 1297869 1297869 1297869 1297869','0 0 0 2621 2842 56932 1287063 1287064 1287064 1287064 1297869',X'0C080808030803040308080301A6E33010BC01317F2005516E3932DB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 5007 3959 317 1 1 1 1 1','0 0 0 2152400 2152400 2153781 2154097 2154097 2154097 2154097 2154097','0 0 0 5683 6304 111431 2139450 2139457 2139457 2139457 2154097',X'0C080808030803040308080301C3F91E114001315549029F74635F36'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 4768 4609 397 1 1 1 1 1','0 0 0 2200466 2200466 2200700 2201096 2201096 2201096 2201096 2201096','0 0 0 5714 6370 114266 2186220 2186227 2186227 2186227 2201096',X'0C080808030803040308080401C42217887E01312D72036D5B009AF3F8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 5177 4669 264 1 1 1 1 1','0 0 0 2234078 2234078 2235865 2236128 2236128 2236128 2236128 2236128','0 0 0 5743 6422 116499 2221108 2221115 2221115 2221115 2236128',X'0C080808030803040308080401C4491EF49D013155450D4B200091BFB3'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 7981 5546 272 1 1 1 1 1','0 0 0 2239923 2239923 2242583 2242854 2242854 2242854 2242854 2242854','0 0 0 5746 6428 116800 2227775 2227782 2227782 2227782 2242854',X'0C080808030803040308080301C44E2EFF35013109E67764687E36D6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 351 336 15 1 1 1 1 1','0 0 0 2595725 2595725 2595725 2595739 2595739 2595739 2595739 2595739','0 0 0 6747 7717 144364 2578697 2578708 2578708 2578708 2595739',X'0C080808030803040308080401CCC91782C20131CC1902D7C0008E7A4F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 6022 4942 304 1 1 1 1 1','0 0 0 2648510 2648510 2648849 2649152 2649152 2649152 2649152 2649152','0 0 0 6934 7959 149030 2631886 2631900 2631900 2631900 2649152',X'0C080808030803040308080301CE8C17887E01312D6E036D5B424939'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 4752 1965 5 1 1 1 1 1','0 0 0 3161780 3161780 3163740 3163744 3163744 3163744 3163744 3163744','0 0 0 9707 11219 194477 3143873 3143896 3143896 3143896 3163744',X'0C08080803080404030808030213B20116290C01332B9D0270102494C2'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 5497 1880 3 1 1 1 1 1','0 0 0 3167643 3167643 3169520 3169522 3169522 3169522 3169522 3169522','0 0 0 9709 11226 194760 3149632 3149655 3149655 3149655 3169522',X'0C08080803080404040808030213B5010B0A5C0133294500FF55941DCA72'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 2185 2126 134 1 1 1 1 1','0 0 0 3891669 3891669 3893607 3893609 3893609 3893609 3893609 3893609','0 0 0 13596 15952 257364 3869701 3869733 3869733 3869733 3893609',X'0C080808030804040308080302BD5F01010F13013350517B8BF356D913'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 5511 5355 345 1 1 1 1 1','0 0 0 3931849 3931849 3931954 3932298 3932298 3932298 3932298 3932298','0 0 0 13793 16188 260160 3908172 3908206 3908206 3908206 3932298',X'0C080808030803040308080402C14C17887E01312D75036D5B009AF4B1'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 5468 5115 310 1 1 1 1 1','0 0 0 3939090 3939090 3939894 3940203 3940203 3940203 3940203 3940203','0 0 0 13803 16200 260571 3916034 3916068 3916068 3916068 3940203',X'0C080808030803040308080302C164191E7F0131A4FC0606F30CE25A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 5275 4792 252 1 1 1 1 1','0 0 0 4590216 4590216 4591340 4591591 4591591 4591591 4591591 4591591','0 0 0 17456 20455 315887 4563939 4563981 4563981 4563981 4591591',X'0C0808080308030403080804049EE51EB67B01317C5204C9D900AE08CD'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 339 339 20 1 1 1 1 1','0 0 0 5191257 5191257 5191475 5191479 5191479 5191479 5191479 5191479','0 0 0 20754 24230 366257 5160652 5160701 5160701 5160701 5191479',X'0C08080803080404030808030CEE9300E50D8D013242BE018A755F6BC3'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 7173953 7173950 13 13 1 1 1 1 1 1','0 0 0 6489337 6489337 6489349 6489349 6489349 6489349 6489349 6489349','0 0 0 29449 33987 481632 6453309 6453378 6453378 6453378 6489349',X'0C08080804080304030808030091B3AB600E9801323F54029F7403EF0C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 630326 618063 10 9 1 1 1 1 1 1','0 7173953 7173953 7787217 7787217 7787219 7787219 7787219 7787219 7787219 7787219','0 1 2 74978 85458 1107555 7744920 7744997 7744997 7744997 7787219',X'0C0809080408030403080804014F459B48960801332ADC01C7A600AA1BA3'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','7804279 630326 12263 17 1 1 1 1 1 1 1','0 7173953 7792016 7795570 7795586 7795586 7795586 7795586 7795586 7795586 7795586','0 1 3 78329 89057 1115864 7753287 7753364 7753364 7753364 7795586',X'0C0809010302040404080804070267C1271300E640740133041E00AB540900A3EE16'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','3876548 3718791 3718791 397 397 46 1 1 1 1 1','7804279 7804279 7804279 9084892 9084892 9085088 9085089 9085089 9085089 9085089 9085089','1 2 4 87584 99143 1159195 9040539 9040616 9040616 9040616 9085089',X'0C090808030804040308080301CBAF00E5C288013351810C390F26671E'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','3876548 3718791 3718791 141 141 20 1 1 1 1 1','7804279 7804279 7804279 10382921 10382921 10382951 10382959 10382959 10382959 10382959 10382959','1 2 4 95054 107437 1210217 10336699 10336776 10336776 10336776 10382959',X'0C09080803080304030808030DB5C14114E301332A7E018A751F17C1'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix4','3876548 157757 157736 83 16 1 1 1 1 1 1','7804279 11523070 11523070 11587733 11587800 11587815 11587815 11587815 11587815 11587815 11587815','1 3 5 112412 126326 1332792 11540704 11540781 11540781 11540781 11587815',X'0C090908030204040308080402A9D12328010B92880133517F029E9D008B5B23'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 213279 213279 213279 213279 376 212 101 1 1','0 0 12394 12394 12394 12394 18421 18421 18421 18424 18424','0 0 3 3 3 3 810 1027 1949 18324 18424',X'0C0808030808080308030403018A75018788178574013265FC611E2A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 86515 86515 86515 86515 377 377 377 1 1','0 0 271240 271240 271240 271240 274521 274521 274521 274780 274780','0 0 8 8 8 8 9766 10762 19602 273178 274780',X'0C080803080808030803040401A79C01886F174AEF0132678B00A4AEFF'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 193482 193482 193482 193482 444 444 444 1 1','0 0 542802 542802 542802 542802 575453 575453 575453 575505 575505','0 0 27 27 27 27 24310 25597 43165 571774 575505',X'0C080803080808030803040401C3EB018CCE55312F013305B700AF487C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 126108 126108 126108 126108 200 200 28 1 1','0 0 747801 747801 747801 747801 762121 762121 762293 762320 762320','0 0 33 33 33 33 30770 32410 56629 757315 762320',X'0C080803080808030803040301C7A6018A9D6AB1100131F17D04364A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 149712 149712 149712 149712 216 216 5 1 1','0 0 1107747 1107747 1107747 1107747 1147090 1147090 1147301 1147305 1147305','0 0 98 98 98 98 51603 53785 94043 1139967 1147305',X'0C080803080808030803040302172301B84D2E828501317B95651924'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 87289 87289 87289 87289 27 27 12 1 1','0 0 1257751 1257751 1257751 1257751 1297850 1297850 1297865 1297869 1297869','0 0 100 100 100 100 57625 60123 107069 1289807 1297869',X'0C0808030808080308040403021FFC02554D00E643C7013242692A9BBC'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 192597 192597 192597 192597 291 291 3 1 1','0 0 1464077 1464077 1464077 1464077 1512946 1512946 1513234 1513236 1513236','0 0 134 134 134 134 67476 70262 123260 1502886 1513236',X'0C0808030808080308040404029E6201B94000F8341701330419008B74DA'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 196917 196917 196917 196917 326 326 12 1 1','0 0 1677739 1677739 1677739 1677739 1797333 1797333 1797647 1797658 1797658','0 0 136 136 136 136 76717 80026 143308 1785522 1797658',X'0C0808030808080308040404029E6802B7DC0108ACBA0132DD7B0087795F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 140297 140297 140297 140297 206 188 90 1 1','0 0 1951850 1951850 1951850 1951850 2020506 2020524 2020622 2020711 2020711','0 0 146 146 146 146 85439 89181 160816 2006993 2020711',X'0C0808030808080302040403029E8102171603E800FA82B20132B5AD384ECD'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 132041 132041 132041 132041 173 173 20 1 1','0 0 2415706 2415706 2415706 2415706 2428962 2428962 2429115 2429134 2429134','0 0 163 163 163 163 100984 105182 186071 2412732 2429134',X'0C0808030808080308030403029EB1018BF55020D60131A3D23BB156'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 6830 6830 6830 6830 35 35 35 1 1','0 0 2595444 2595444 2595444 2595444 2595711 2595711 2595711 2595739 2595739','0 0 169 169 169 169 108584 113037 199947 2578183 2595739',X'0C0808030808080308030403029EC001878C17A7520131A43A6E513C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 101615 101615 101615 101615 244 33 33 1 1','0 0 2999185 2999185 2999185 2999185 3019255 3019466 3019466 3019498 3019498','0 0 213 213 213 213 131035 136293 237357 2999333 3019498',X'0C080803080808030203040302D7C001B93E03F041A96D013303017C72B6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 26914 26914 26914 26914 87 87 73 1 1','0 0 3868553 3868553 3868553 3868553 3893568 3893568 3893582 3893609 3893609','0 0 387 387 387 387 172456 180121 311050 3869040 3893609',X'0C08080308080803080304040498C86B7EF347CC5A0132B678008A4646'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 97492 97492 97492 97492 410 410 44 1 1','0 0 4948831 4948831 4948831 4948831 5009456 5009456 5009822 5009865 5009865','0 0 751 751 751 751 226745 236274 399260 4980988 5009865',X'0C08080308080803080404030E565F03686C00F89CD001332A115479DC'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 1782 1782 1782 1782 52 52 52 1 1','0 0 5190938 5190938 5190938 5190938 5191434 5191434 5191434 5191479 5191479','0 0 800 800 800 800 236362 246237 414618 5161779 5191479',X'0C08080308080803080304040EBD0F0268E064A6DB013242CB00875BAF'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 4645 4645 4645 4645 17 17 17 1 1','0 0 6485214 6485214 6485214 6485214 6489339 6489339 6489339 6489349 6489349','0 0 1396 1396 1396 1396 317293 329836 538486 6453712 6489349',X'0C080804080808040803040300ABD9B000A69D33737CBB01328F6B0F6298'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 7173953 290196 290196 290196 290196 138 138 26 1 1','0 0 6734628 6734628 6734628 6734628 6744872 6744872 6744984 6745009 6745009','0 0 1641 1641 1641 1641 338986 352099 569319 6708651 6745009',X'0C080804080808030804040400FF5594018819010B3C670133294300B1674C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','7804279 630326 24310 1435 1435 1435 1 1 1 1 1','0 7173953 7763625 7786500 7786500 7786500 7787219 7787219 7787219 7787219 7787219','0 1 3518 4119 4119 4119 726018 753845 1215054 7745002 7787219',X'0C080904010808030204040400FF5594070357AB232800F2FA440133294600A90441'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','3876548 3718791 114188 114188 114188 114188 463 61 61 1 1','7804279 7804279 7809377 7809377 7809377 7809377 7864755 7865157 7865157 7865217 7865217','1 2 3751 4413 4413 4413 740133 768607 1233927 7822883 7865217',X'0C0908030808080302030403018A750213B2245416DF860131CB3A2879CC'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','3876548 3718791 86108 86108 86108 86108 605 605 605 1 1','7804279 7804279 8403815 8403815 8403815 8403815 8463845 8463845 8463845 8464449 8464449','1 2 3805 4467 4467 4467 760796 789718 1255047 8421249 8464449',X'0C0908030808080308030403021FFC0DC36E1AD36901328E2F3D9128'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','3876548 3718791 60490 60490 60490 60490 44 44 44 1 1','7804279 7804279 9062901 9062901 9062901 9062901 9085056 9085056 9085056 9085089 9085089','1 2 3845 4507 4507 4507 778931 808217 1273550 9040805 9085089',X'0C0908030808080308040403029EB101C30B00E889140132697F092505'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','3876548 3718791 57304 57304 57304 57304 2 2 2 1 1','7804279 7804279 10328144 10328144 10328144 10328144 10382958 10382958 10382958 10382959 10382959','1 2 4106 4768 4768 4768 823966 853934 1319290 10336860 10382959',X'0C09080308080804080404040E565F00CE8C3100E7F68D0133517900B0B4CE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','3876548 3718791 174377 174377 174377 174377 81 81 66 1 1','7804279 7804279 11246252 11246252 11246252 11246252 11358749 11358749 11358764 11358829 11358829','1 2 4517 5179 5179 5179 867595 898252 1363807 11311829 11358829',X'0C090804080808030804040300FF55940E584300F2FA44013240670E2E89'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix3','3876548 157757 15066 15066 15066 15066 1 1 1 1 1','7804279 11523070 11657249 11657249 11657249 11657249 11672314 11672314 11672314 11672314 11672314','1 3 5503 6167 6167 6167 1025351 1059076 1524822 11625280 11672314',X'0C090904080808040203040300FF5594025D19032328337763013351F2277A3E'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 4748 4629 4629 4629 4629 17 1 1 1','0 0 634880 634880 634880 634880 634880 639175 639191 639191 639191','0 0 779 907 907 907 907 415429 633684 633685 639191',X'0C0808030808080804030303018C4A013157983CE7FE05E54B6BB7FB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 4608 4608 4608 4608 4608 33 1 1 1','0 0 752580 752580 752580 752580 752580 755506 755538 755538 755538','0 0 936 1089 1089 1089 1089 491324 749126 749127 755538',X'0C0808030808080804030303018D4F0131A682512ECF029E6A70A9E9'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 4776 4776 4776 4776 4776 27 1 1 1','0 0 762070 762070 762070 762070 762070 763357 763383 763383 763383','0 0 940 1097 1097 1097 1097 495628 756890 756891 763383',X'0C0808030808080804040303018D560132DB8800F3416D029EA654D9AC'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 5910 5910 5910 5910 5910 37 2 2 1','0 0 771353 771353 771353 771353 771353 775562 775597 775597 775598','0 0 946 1103 1103 1103 1103 501111 769013 769014 775598',X'0C0808030808080804030303018D610131CADE4C6E2D01D5860141A9'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 1834 1834 1834 1834 1834 6 1 1 1','0 0 1296866 1296866 1296866 1296866 1296866 1297867 1297869 1297869 1297869','0 0 2621 2842 2842 2842 2842 857867 1287063 1287064 1297869',X'0C080803080808080403030301A6E30132419A1E1B7F0567EE2880C0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 5007 3959 3959 3959 3959 25 1 1 1','0 0 2152400 2152400 2152400 2152400 2152400 2155551 2155575 2155575 2155575','0 0 5683 6304 6304 6304 6304 1442790 2140930 2140937 2155575',X'0C080803080808080404030301C3F901317CC701044CC7029E6834F7E2'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 4768 4609 4609 4609 4609 26 1 1 1','0 0 2200466 2200466 2200466 2200466 2200466 2204364 2204389 2204389 2204389','0 0 5714 6370 6370 6370 6370 1470393 2189496 2189503 2204389',X'0C080803080808080403030301C4220131586B3EB735018A7567CE9E'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 5177 4669 4669 4669 4669 22 1 1 1','0 0 2234078 2234078 2234078 2234078 2234078 2238366 2238387 2238387 2238387','0 0 5743 6422 6422 6422 6422 1490145 2223355 2223362 2238387',X'0C080803080808080403030301C4490131573F4104F802D9CA67FD1E'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 7981 5546 5546 5546 5546 32 1 1 1','0 0 2239923 2239923 2239923 2239923 2239923 2243388 2243419 2243419 2243419','0 0 5746 6428 6428 6428 6428 1492784 2228358 2228365 2243419',X'0C080803080808080404030301C44E0131A4FE00FDCC04029E8175076B'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 351 336 336 336 336 1 1 1 1','0 0 2595725 2595725 2595725 2595725 2595725 2595739 2595739 2595739 2595739','0 0 6747 7717 7717 7717 7717 1732397 2578697 2578708 2595739',X'0C080803080808080404030301CCC901332A7700F17E5D0E5D6F523B01'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 6022 4942 4942 4942 4942 38 1 1 1','0 0 2648510 2648510 2648510 2648510 2648510 2652126 2652163 2652163 2652163','0 0 6934 7959 7959 7959 7959 1770411 2634884 2634898 2652163',X'0C080803080808080404030301CE8C01317DE800FE4E8B029E81458317'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 4752 1965 1965 1965 1965 1 1 1 1','0 0 3161780 3161780 3161780 3161780 3161780 3163744 3163744 3163744 3163744','0 0 9707 11219 11219 11219 11219 2143797 3143873 3143896 3163744',X'0C08080308080808040303030213B20130BC9216F939029E815B86EE'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 5497 1880 1880 1880 1880 1 1 1 1','0 0 3167643 3167643 3167643 3167643 3167643 3169522 3169522 3169522 3169522','0 0 9709 11226 11226 11226 11226 2148088 3149632 3149655 3169522',X'0C08080308080808040303030213B50130BBC616FC6501C7A62A1BB2'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 2185 2126 2126 2126 2126 4 1 1 1','0 0 3891670 3891670 3891670 3891670 3891670 3893609 3893609 3893609 3893609','0 0 13596 15952 15953 15953 15953 2677069 3869700 3869732 3893609',X'0C080803080808080403030302BD5F01317CC81782F704C9D95EFF0C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 5511 5355 5355 5355 5355 21 1 1 1','0 0 3931850 3931850 3931850 3931850 3931850 3936206 3936226 3936226 3936226','0 0 13793 16188 16189 16189 16189 2705655 3912091 3912125 3936226',X'0C080803080808080403030302C14C01317C514010FA01B64235E688'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 5468 5115 5115 5115 5115 27 1 1 1','0 0 3939091 3939091 3939091 3939091 3939091 3943255 3943281 3943281 3943281','0 0 13803 16200 16201 16201 16201 2709082 3919099 3919133 3943281',X'0C080803080808080403030302C16401317CC348B67001C3EB6824BB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 5275 4792 4792 4792 4792 31 1 1 1','0 0 4590217 4590217 4590217 4590217 4590217 4591639 4591669 4591669 4591669','0 0 17456 20455 20456 20456 20456 3175906 4564022 4564064 4591669',X'0C0808030808080804040403049EE50132915200FA2F9300EA0DC50554E0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 339 339 339 339 339 2 1 1 1','0 0 5191258 5191258 5191258 5191258 5191258 5191478 5191479 5191479 5191479','0 0 20754 24230 24231 24231 24231 3601696 5160652 5160701 5191479',X'0C08080308080808040303030CEE930132671A1B8AFF01B6426386D0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 7173953 13 13 13 13 13 1 1 1 1','0 0 6489339 6489339 6489339 6489339 6489339 6489349 6489349 6489349 6489349','0 0 29449 33987 33989 33989 33989 4540005 6453309 6453378 6489349',X'0C08080408080808040303030091B3AB01321B5A4F26F2018A750B6686'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','7804279 630326 19 19 18 18 18 1 1 1 1','0 7173953 7787203 7787203 7787203 7787203 7787203 7787219 7787219 7787219 7787219','0 1 73522 83967 91688 91688 91688 5643606 7744920 7744997 7787219',X'0C080904080808080404030300FF69210132DB2900FB0715029EB573EB9F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','3876548 3718791 4598 4512 4512 4512 4512 38 1 1 1','7804279 7804279 8237877 8237877 8237877 8237877 8237877 8238986 8239023 8239023 8239023','1 2 76726 87349 95641 95641 95641 5923145 8195880 8195957 8239023',X'0C0908030808080804040404018D3F01332A780111068001FB6F840083BEF9'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','3876548 3718791 397 397 397 397 397 2 1 1 1','7804279 7804279 9084892 9084892 9084892 9084892 9084892 9085089 9085089 9085089 9085089','1 2 79826 90851 99143 99143 99143 6505397 9040540 9040617 9085089',X'0C090803080808080403030301CBAF0133028A4E35BE715A2A49098C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','3876548 3718791 141 141 141 141 141 2 1 1 1','7804279 7804279 10382921 10382921 10382921 10382921 10382921 10382958 10382959 10382959 10382959','1 2 87296 99145 107437 107437 107437 7432077 10336699 10336776 10382959',X'0C09080308080808040403030DB5C101332BF7010E37310EB97420BFF6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix2','3876548 157757 83 16 16 16 16 1 1 1 1','7804279 11523070 11587750 11587817 11587817 11587817 11587817 11587832 11587832 11587832 11587832','1 3 104655 118035 126343 126343 126343 8311754 11540721 11540798 11587832',X'0C090903020808080404030402A9D1232801332CC300EB7D35029E83008581B1'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 24157 24157 24157 24157 24157 133 1 1 1','0 0 1236590 1236590 1236590 1236590 1236590 1241150 1241282 1241282 1241282','0 0 3120 3120 3120 3120 4771 741878 1223262 1228239 1241282',X'0C08080308080804040408031A080400FF559401321BC20099C49F3BE84C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 1209 1209 1209 1209 1209 2 1 1 1','0 0 1296873 1296873 1296873 1296873 1296873 1297868 1297869 1297869 1297869','0 0 3203 3203 3203 3203 4902 763298 1279554 1284645 1297869',X'0C08080308080803040308031A215F04C9D901317D1501B0A355A290'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 12129 12129 12129 12129 9261 38 1 1 1','0 0 1790076 1790076 1790076 1790076 1790076 1791737 1791774 1791774 1791774','0 0 4938 4938 4938 4938 7561 1075153 1767990 1775629 1791774',X'0C08080308080803040408031CE87E029E6B01328F6100B473FD5BE552'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 273 273 273 273 273 1 1 1 1','0 0 2595625 2595625 2595625 2595625 2595625 2595739 2595739 2595739 2595739','0 0 7863 7863 7863 7863 12132 1580849 2562484 2575172 2595739',X'0C08080308080803040308032F020502DA0E013241A16B73DE01E021'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 7735 7735 7735 7735 7735 503 1 1 1','0 0 2924165 2924165 2924165 2924165 2924165 2931394 2931896 2931896 2931896','0 0 9123 9123 9123 9123 14045 1794002 2895440 2909856 2931896',X'0C080803080808040404080433776300FF55940133294301C56631008BCB5A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 360 360 360 360 229 1 1 1 1','0 0 3893374 3893374 3893374 3893374 3893505 3893609 3893609 3893609 3893609','0 0 13912 13912 13912 13912 21124 2420346 3846830 3866425 3893609',X'0C08080308080803040308034717710E070B01317F7102C73A396CE1'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 683 683 683 683 671 2 1 1 1','0 0 5191447 5191447 5191447 5191447 5191459 5191479 5191479 5191479 5191479','0 0 20361 20361 20361 20361 30776 3226670 5127525 5158962 5191479',X'0C08080308080803040308037370D10F00290132B59A018F7A694C9B'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 213354 213354 213354 213354 213354 5934 1 1 1','0 0 6102233 6102233 6102233 6102233 6102233 6154276 6155650 6155650 6155650','0 0 26812 26812 26812 26812 39489 3770219 6079715 6119855 6155650',X'0C080804080808040403080300F2FA4400FF55940132DF1A01C0C115D4D4'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 3675 3675 3675 3675 3675 14 1 1 1','0 0 6486701 6486701 6486701 6486701 6486701 6489347 6489349 6489349 6489349','0 0 28380 28380 28380 28380 41383 3868787 6409451 6452691 6489349',X'0C080804080808030403020300F6ABAC6C967D0132B672026C8D03E8155844'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 24063 24063 24063 24063 24063 1799 1 1 1','0 0 7080914 7080914 7080914 7080914 7080914 7103178 7104976 7104976 7104976','0 0 35724 35725 35725 35725 49845 4189282 7019641 7067879 7104976',X'0C0808040808080404040804010B0A5C00FF55940133294301D2C35700A877B5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 7173953 20284 20284 20284 20284 20284 1518 1 1 1','0 0 7107240 7107240 7107240 7107240 7107240 7124584 7126101 7126101 7126101','0 0 35764 35765 35765 35765 49886 4191089 7040717 7089004 7126101',X'0C0808040808080404040803010B3C6700FF55940133294501F0A829511573'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 630326 13288 11855 11855 11855 11855 5449 1 1 1','0 7173953 7671119 7671119 7671119 7671119 7671119 7676514 7676526 7676526 7676526','0 1 64320 65543 65543 65543 92453 4431581 7580039 7634401 7676526',X'0C080904080808040403080400F2FA4400FF5594013329430186CB00A866E4'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','7804279 630326 61 61 61 61 61 14 1 1 1','0 7173953 7787172 7787172 7787172 7787172 7787172 7787217 7787219 7787219 7787219','0 1 73272 75274 75274 75274 103642 4468650 7689369 7745002 7787219',X'0C0809040808080304030803010ABA910DD2420133068F05DE6223042F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 8657 8657 8657 8657 8657 18 1 1 1','7804279 7804279 8360485 8360485 8360485 8360485 8360485 8360977 8360994 8360994 8360994','1 2 75785 77865 77865 77865 106290 4756698 8258979 8317590 8360994',X'0C09080308080803040408031AD369021FFC0133517F01B017F259F6C3'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 33421 33421 33421 33421 33421 2221 1 1 1','7804279 7804279 8873934 8873934 8873934 8873934 8873934 8874868 8877088 8877088 8877088','1 2 76834 78914 78914 78914 107340 5041847 8770182 8832668 8877088',X'0C090803080808040404020333776300FF5594013351790241FEE4232825FB3D'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 2182 2182 2182 2182 2182 20 1 1 1','7804279 7804279 9083187 9083187 9083187 9083187 9083187 9085087 9085089 9085089 9085089','1 2 77227 79307 79307 79307 107733 5141706 8974619 9040316 9085089',X'0C09080308080803040308043AC92C021FFC0132B668018BAB00964778'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 6008 6008 6008 6008 6008 26 1 1 1','7804279 7804279 9124662 9124662 9124662 9124662 9124662 9128286 9128311 9128311 9128311','1 2 77300 79380 79380 79380 107806 5160088 9016921 9083451 9128311',X'0C09080308080804040408033C1C5C00F024880132DB2100B88E8A420C1B'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 6023 6023 6023 6023 6023 91 1 1 1','7804279 7804279 9393480 9393480 9393480 9393480 9393480 9396519 9396609 9396609 9396609','1 2 77893 79973 79973 79973 108402 5311949 9282988 9351281 9396609',X'0C09080308080803040408044CDD9A7E1C230132DE4200D105C800A087F7'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 79 79 79 79 79 1 1 1 1','7804279 7804279 10382946 10382946 10382946 10382946 10382946 10382959 10382959 10382959 10382959','1 2 80421 82501 82501 82501 110947 5821380 10258569 10336296 10382959',X'0C090804080808030403080300E9A10A0CC3160133505F0D25365733C6'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 8251 8251 8251 8251 8251 37 1 1 1','7804279 7804279 11067468 11067468 11067468 11067468 11067468 11068084 11068120 11068120 11068120','1 2 83449 85529 85529 85529 113989 6177561 10936213 11021086 11068120',X'0C090804080808040404080400FFA4A7008A66AD01332AD10170A8B10084054A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 44772 44772 44772 44772 44772 3018 1 1 1','7804279 7804279 11268036 11268036 11268036 11268036 11268036 11282829 11285846 11285846 11285846','1 2 85052 87132 87132 87132 115597 6281979 11151347 11238812 11285846',X'0C0908040808080404040804010B0A5C00FF5594013351720249087400B0523C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 53775 53775 53775 53775 53775 4069 1 1 1','7804279 7804279 11330929 11330929 11330929 11330929 11330929 11359035 11363103 11363103 11363103','1 2 85255 87335 87335 87335 115800 6292285 11227544 11316069 11363103',X'0C0908040808080404040804010BFA8100FF5594013351280252F8A000B01818'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 3718791 39430 39430 39430 39430 39430 3018 1 1 1','7804279 7804279 11458789 11458789 11458789 11458789 11458789 11468188 11471205 11471205 11471205','1 2 86422 88502 88502 88502 116970 6333877 11333316 11424171 11471205',X'0C09080408080804040408040113B99600FF559401335174024530C4008AC82C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix1','3876548 157757 5317 5317 5317 5317 5317 12 1 1 1','7804279 11523070 11652844 11652844 11652844 11652844 11652844 11658149 11658160 11658160 11658160','1 3 97969 100051 100051 100051 128567 6429914 11517744 11611126 11658160',X'0C0909040808080404040804010BFA8100FF559401332B2E01521E0B008447F4'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 24157 29 29 29 29 29 1 1 1','0 0 1236590 1251799 1251799 1251799 1251799 1251799 1251827 1251827 1251827','0 0 3120 62451 63798 63798 63798 63798 1238772 1238782 1251827',X'0C08080303080808080404031A0804029BB30131CD3700FF55942B1368'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 1209 129 129 129 129 129 1 1 1','0 0 1296873 1297744 1297744 1297744 1297744 1297744 1297869 1297869 1297869','0 0 3203 65280 66657 66657 66657 66657 1284635 1284645 1297869',X'0C08080303080808080403041A215F01B0A30131066F04C9D90087162A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 12129 604 604 604 604 604 1 1 1','0 0 1790076 1790076 1790076 1790076 1790076 1790076 1790679 1790679 1790679','0 0 4938 95334 97612 97612 97612 97612 1774566 1774578 1790679',X'0C08080303080808080403031CE87E01870001317C4D0CED622FE2E8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 273 5 5 5 5 5 1 1 1','0 0 2595625 2595738 2595738 2595738 2595738 2595738 2595739 2595739 2595739','0 0 7863 145612 149427 149427 149427 149427 2575145 2575172 2595739',X'0C08080303080808080403042F020502C73A0133049702DA0E00A711F8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 7735 29 29 29 29 29 1 1 1','0 0 2924165 2929754 2929754 2929754 2929754 2929754 2929782 2929782 2929782','0 0 9123 167852 172269 172269 172269 172269 2907715 2907742 2929782',X'0C080803030808080804040333776375928D0133294300FF55945A824F'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 360 6 6 6 6 6 1 1 1','0 0 3893374 3893607 3893607 3893607 3893607 3893607 3893609 3893609 3893609','0 0 13912 240908 247109 247109 247109 247109 3866384 3866425 3893609',X'0C080803030808080804030347177104AF8701317D220E070B687905'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 683 32 32 32 32 32 2 2 1','0 0 5191447 5191465 5191465 5191465 5191465 5191465 5191479 5191479 5191479','0 0 20361 336764 345696 345696 345696 345696 5158907 5158962 5191479',X'0C08080303080808080403037370D101884501328F690F002900A69C'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 213354 113 113 113 113 113 1 1 1','0 0 6102233 6155183 6155183 6155183 6155183 6155183 6155295 6155295 6155295','0 0 26812 421693 433202 433202 433202 433202 6119212 6119281 6155295',X'0C080804030808080804040300F2FA44019B6D0132406700FF5594714AE8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 3675 241 241 241 241 241 1 1 1','0 0 6486701 6489287 6489287 6489287 6489287 6489287 6489349 6489349 6489349','0 0 28380 450494 462953 462953 462953 462953 6452616 6452691 6489349',X'0C080804040808080804030300F6ABAC009F84B60132DBDD6C967D155A2A'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 24063 38 38 38 38 38 1 1 1','0 0 7080914 7102383 7102383 7102383 7102383 7102383 7102420 7102420 7102420','0 0 35724 528136 541855 541858 541858 541858 7065247 7065323 7102420',X'0C0808040408080808040403010B0A5C00CCD3EE0133294500FF559459DDCD'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 7173953 20284 38 38 38 38 38 1 1 1','0 0 7107240 7126609 7126609 7126609 7126609 7126609 7126646 7126646 7126646','0 0 35764 531673 545484 545487 545487 545487 7089473 7089549 7126646',X'0C0808040408080808040403010B3C670114CE730133294300FF55942225CC'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 630326 13288 5 1 1 1 1 1 1 1','0 7173953 7671119 7675167 7675171 7675171 7675171 7675171 7675171 7675171 7675171','0 1 64320 967583 993386 999414 999414 999414 7632969 7633046 7675171',X'0C080904030308080804040400F2FA4401D16F0183350132DEFE00FF5594009FA501'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','7804279 630326 61 1 1 1 1 1 1 1 1','0 7173953 7787172 7787219 7787219 7787219 7787219 7787219 7787219 7787219 7787219','0 1 73272 1068631 1096442 1107608 1107608 1107608 7744925 7745002 7787219',X'0C0809040408080808040304010ABA9100AA4C1F013351DB0DD242008BFFEF'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 8657 605 605 605 605 605 1 1 1','7804279 7804279 8360485 8364643 8364643 8364643 8364643 8364643 8365247 8365247 8365247','1 2 75785 1096159 1124446 1135923 1135923 1135923 8321766 8321843 8365247',X'0C09080303080808080403031AD3690DC36E01328E2F021FFC3D9128'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 33421 57 26 26 26 26 1 1 1','7804279 7804279 8873934 8891008 8891039 8891039 8891039 8891039 8891064 8891064 8891064','1 2 76834 1110063 1138607 1150084 1150084 1150084 8846567 8846644 8891064',X'0C09080303020808080404043377630CE166232801332A1800FF559400836DFB'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 2182 94 94 94 94 94 1 1 1','7804279 7804279 9083187 9085006 9085006 9085006 9085006 9085006 9085089 9085089 9085089','1 2 77227 1115805 1144438 1155915 1155915 1155915 9040239 9040316 9085089',X'0C09080303080808080403033AC92C04AF670132B5FC021FFC38DBD0'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 6008 277 277 277 277 277 1 1 1','7804279 7804279 9124662 9124662 9124662 9124662 9124662 9124662 9124938 9124938 9124938','1 2 77300 1116652 1145304 1156781 1156781 1156781 9080000 9080077 9124938',X'0C09080303080808080404033C1C5C01B49901328DDA00F024883D6052'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 6023 50 50 50 50 50 1 1 1','7804279 7804279 9393480 9395815 9395815 9395815 9395815 9395815 9395864 9395864 9395864','1 2 77893 1123924 1152663 1164140 1164140 1164140 9350459 9350536 9395864',X'0C09080303080808080403034CDD9A01C30D013290877E1C2303CC11'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 79 6 6 6 6 6 1 1 1','7804279 7804279 10382946 10382956 10382956 10382956 10382956 10382956 10382959 10382959 10382959','1 2 80421 1154920 1184197 1195674 1195674 1195674 10336219 10336296 10382959',X'0C090804030808080804030400E9A10A02A47201332C6C0CC31600ABCD60'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 8251 280 280 280 280 280 1 1 1','7804279 7804279 11067468 11072690 11072690 11072690 11072690 11072690 11072969 11072969 11072969','1 2 83449 1186373 1216159 1227636 1227636 1227636 11025858 11025935 11072969',X'0C090804040808080804040300FFA4A70089DBDD0132B5FF008A66AD6AE2B8'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 44772 58 58 58 58 58 1 1 1','7804279 7804279 11268036 11269261 11269261 11269261 11269261 11269261 11269318 11269318 11269318','1 2 85052 1199706 1229712 1241189 1241189 1241189 11222207 11222284 11269318',X'0C0908040308080808040404010B0A5C018ACD0133294300FF559400B0E291'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 53775 37 19 19 19 19 1 1 1','7804279 7804279 11330929 11355027 11355045 11355045 11355045 11355045 11355063 11355063 11355063','1 2 85255 1206165 1236304 1247781 1247781 1247781 11307952 11308029 11355063',X'0C0908040302080808040403010BFA81026C24232801332B2E00FF55941F8BB5'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 3718791 39430 39 39 39 39 39 1 1 1','7804279 7804279 11458789 11476757 11476757 11476757 11476757 11476757 11476795 11476795 11476795','1 2 86422 1219089 1249476 1260953 1260953 1260953 11429684 11429761 11476795',X'0C09080403080808080404030113B99602F6AF01332B2E00FF55941F8A54'); + INSERT INTO sqlite_stat4 VALUES('tx1','ix0','3876548 157757 5317 1 1 1 1 1 1 1 1','7804279 11523070 11652844 11658160 11658160 11658160 11658160 11658160 11658160 11658160 11658160','1 3 97969 1358780 1391643 1403122 1403122 1403122 11611049 11611126 11658160',X'0C0909040402080808040403010BFA8102594CCB2328013351E800FF55945B0F5D'); + ANALYZE sqlite_master; +} {} + +# Ensure that the query planner implements the GROUP BY using a separate sort +# +do_execsql_test whereJ-1.4 { + EXPLAIN QUERY PLAN + SELECT aid, sid, MAX(edate) edate + FROM tx1 + WHERE cid = 115790 + AND sid = 9100 + AND edate <= 20140430 AND edate >= 20120429 + GROUP BY aid; +} {/B-TREE/} + +finish_test From 62a223e5dd9227b7aa41e66d53df723d61fcf185 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 9 Jun 2014 13:11:40 +0000 Subject: [PATCH 06/55] Modify the %nonassoc directive in lemon so that it generates a run-time error rather than a parsing conflict. This changes is due to a bug report on the mailing list. SQLite does not use the %nonassoc directive in its grammar so this change does not affect SQLite. FossilOrigin-Name: 1925f3a0a2caa709569df015a8e0d26412f1a9ff --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/lemon.c | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 8babedd8a7..6555b4ed1a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\stest\scase\sto\sensure\sthat\sestLog()\sworks\sfor\snegative\snumbers. -D 2014-06-06T20:49:19.299 +C Modify\sthe\s%nonassoc\sdirective\sin\slemon\sso\sthat\sit\sgenerates\sa\srun-time\nerror\srather\sthan\sa\sparsing\sconflict.\s\sThis\schanges\sis\sdue\sto\sa\sbug\sreport\non\sthe\smailing\slist.\s\sSQLite\sdoes\snot\suse\sthe\s%nonassoc\sdirective\sin\sits\ngrammar\sso\sthis\schange\sdoes\snot\saffect\sSQLite. +D 2014-06-09T13:11:40.535 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1134,7 +1134,7 @@ F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439 F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce -F tool/lemon.c 07aba6270d5a5016ba8107b09e431eea4ecdc123 +F tool/lemon.c 3ff0fec22f92dfb54e62eeb48772eddffdbeb0d6 F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/logest.c eef612f8adf4d0993dafed0416064cf50d5d33c6 F tool/mkautoconfamal.sh f8d8dbf7d62f409ebed5134998bf5b51d7266383 @@ -1174,7 +1174,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 75437bee4905949c66dc7694ea234d4d5aefd981 -R cd7c3066c722d9461c491648a12f3bbc +P 813469d98519b609669a004b7b604af78ef40c02 +R 17b9b9add2b8e980cb35f959c7029199 U drh -Z bd1ed1df3d77361aa69d91899562bfbf +Z c031771471155f639666c4eafbc642f6 diff --git a/manifest.uuid b/manifest.uuid index 1ffa7c04c8..6a1ff5c5e1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -813469d98519b609669a004b7b604af78ef40c02 \ No newline at end of file +1925f3a0a2caa709569df015a8e0d26412f1a9ff \ No newline at end of file diff --git a/tool/lemon.c b/tool/lemon.c index d7179ad423..85e94f7007 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -1183,8 +1183,7 @@ static int resolve_conflict( apx->type = SH_RESOLVED; }else{ assert( spx->prec==spy->prec && spx->assoc==NONE ); - apy->type = SRCONFLICT; - errcnt++; + apx->type = ERROR; } }else if( apx->type==REDUCE && apy->type==REDUCE ){ spx = apx->x.rp->precsym; From f5154c6a1cb9d91d2cf608dd168bf539f7fa97b9 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 9 Jun 2014 20:06:01 +0000 Subject: [PATCH 07/55] Enhance the unix VFS so that it keeps track of the size of unlinked files internally and thus avoids the need to call fstat() on those files, since fstat() does not work reliably on unlinked files on some implementations of FuseFS. FossilOrigin-Name: c41df393c6afbfbfdc4d1b885024e083c6f6de1f --- manifest | 15 +++++++++------ manifest.uuid | 2 +- src/os_unix.c | 45 +++++++++++++++++++++++++++++++++++---------- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/manifest b/manifest index 6555b4ed1a..25fcfdc03d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Modify\sthe\s%nonassoc\sdirective\sin\slemon\sso\sthat\sit\sgenerates\sa\srun-time\nerror\srather\sthan\sa\sparsing\sconflict.\s\sThis\schanges\sis\sdue\sto\sa\sbug\sreport\non\sthe\smailing\slist.\s\sSQLite\sdoes\snot\suse\sthe\s%nonassoc\sdirective\sin\sits\ngrammar\sso\sthis\schange\sdoes\snot\saffect\sSQLite. -D 2014-06-09T13:11:40.535 +C Enhance\sthe\sunix\sVFS\sso\sthat\sit\skeeps\strack\sof\sthe\ssize\sof\sunlinked\sfiles\ninternally\sand\sthus\savoids\sthe\sneed\sto\scall\sfstat()\son\sthose\sfiles,\ssince\nfstat()\sdoes\snot\swork\sreliably\son\sunlinked\sfiles\son\ssome\simplementations\sof\nFuseFS. +D 2014-06-09T20:06:01.535 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -205,7 +205,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f +F src/os_unix.c e8c5f23bb6e9123b524cd0a87dd1e9263a4dd3be F src/os_win.c 8dbf6c11780fe2eb96c1f289e664d0c7b2911d37 F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25 F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8 @@ -1174,7 +1174,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 813469d98519b609669a004b7b604af78ef40c02 -R 17b9b9add2b8e980cb35f959c7029199 +P 1925f3a0a2caa709569df015a8e0d26412f1a9ff +R ce653ef517f5e803383e83307c89c5db +T *branch * omit-fstat-after-unlink +T *sym-omit-fstat-after-unlink * +T -sym-trunk * U drh -Z c031771471155f639666c4eafbc642f6 +Z c015ab13afaac99134c0355e5c3248ba diff --git a/manifest.uuid b/manifest.uuid index 6a1ff5c5e1..918b2aea7b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1925f3a0a2caa709569df015a8e0d26412f1a9ff \ No newline at end of file +c41df393c6afbfbfdc4d1b885024e083c6f6de1f \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index fc320a4926..ceb8cdb7f3 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -191,6 +191,7 @@ struct unixFile { UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */ const char *zPath; /* Name of the file */ unixShm *pShm; /* Shared memory segment information */ + sqlite3_int64 szFile; /* File size for UNIXFILE_DELETE files */ int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ #if SQLITE_MAX_MMAP_SIZE>0 int nFetchOut; /* Number of outstanding xFetch refs */ @@ -1321,9 +1322,11 @@ static int fileHasMoved(unixFile *pFile){ static void verifyDbFile(unixFile *pFile){ struct stat buf; int rc; - if( pFile->ctrlFlags & UNIXFILE_WARNED ){ - /* One or more of the following warnings have already been issued. Do not - ** repeat them so as not to clutter the error log */ + if( pFile->ctrlFlags & (UNIXFILE_WARNED|UNIXFILE_DELETE) ){ + /* UNIXFILE_WARNED means that one or more of the following warnings have + ** already been issued. Do not* repeat them so as not to clutter the error + ** log. Do not investigate unlinked files since fstat() does not always + ** work following an unlink(). */ return; } rc = osFstat(pFile->h, &buf); @@ -1332,7 +1335,7 @@ static void verifyDbFile(unixFile *pFile){ pFile->ctrlFlags |= UNIXFILE_WARNED; return; } - if( buf.st_nlink==0 && (pFile->ctrlFlags & UNIXFILE_DELETE)==0 ){ + if( buf.st_nlink==0 ){ sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath); pFile->ctrlFlags |= UNIXFILE_WARNED; return; @@ -3281,6 +3284,10 @@ static int unixWrite( assert( id ); assert( amt>0 ); + /* Update the internally tracked file size. The internal file size is only + ** accurate for unlinked files */ + if( offset+amt>pFile->szFile ) pFile->szFile = offset+amt; + /* If this is a database file (not a journal, master-journal or temp ** file), the bytes in the locking range should never be read or written. */ #if 0 @@ -3621,6 +3628,7 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){ } #endif + pFile->szFile = nByte; return SQLITE_OK; } } @@ -3630,12 +3638,27 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){ */ static int unixFileSize(sqlite3_file *id, i64 *pSize){ int rc; + unixFile *pFile = (unixFile*)id; struct stat buf; - assert( id ); - rc = osFstat(((unixFile*)id)->h, &buf); + assert( pFile ); + + /* For files that have been unlinked, simply return the szFile which we keep + ** track of internally. There is no need to fstat() as SQLite has exclusive + ** access to the file and no other process can modify the file and thus change + ** the file size without our knowing it. We do this because fstat() will + ** fail on unlinked files on some (broken) unix filesystems. + */ + if( pFile->ctrlFlags & UNIXFILE_DELETE ){ + *pSize = pFile->szFile; + /* The following assert() confirms that the internal filesize is correct */ + assert( osFstat(pFile->h, &buf)!=0 || buf.st_size==pFile->szFile ); + return SQLITE_OK; + } + + rc = osFstat(pFile->h, &buf); SimulateIOError( rc=1 ); if( rc!=0 ){ - ((unixFile*)id)->lastErrno = errno; + pFile->lastErrno = errno; return SQLITE_IOERR_FSTAT; } *pSize = buf.st_size; @@ -3671,6 +3694,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ i64 nSize; /* Required file size */ struct stat buf; /* Used to hold return values of fstat() */ + if( pFile->ctrlFlags & UNIXFILE_DELETE ) return SQLITE_OK; if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT; nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; @@ -4219,6 +4243,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ if( p==0 ) return SQLITE_NOMEM; memset(p, 0, sizeof(*p)); assert( pDbFd->pShm==0 ); + assert( (pDbFd->ctrlFlags & UNIXFILE_DELETE)==0 ); /* Check to see if a unixShmNode object already exists. Reuse an existing ** one if present. Create a new one if necessary. @@ -4765,6 +4790,7 @@ static void unixRemapfile( } pFd->pMapRegion = (void *)pNew; pFd->mmapSize = pFd->mmapSizeActual = nNew; + if( nNew>pFd->szFile ) pFd->szFile = nNew; } /* @@ -4791,12 +4817,10 @@ static int unixMapfile(unixFile *pFd, i64 nByte){ if( pFd->nFetchOut>0 ) return SQLITE_OK; if( nMap<0 ){ - struct stat statbuf; /* Low-level file information */ - rc = osFstat(pFd->h, &statbuf); + rc = unixFileSize((sqlite3_file*)pFd, &nMap); if( rc!=SQLITE_OK ){ return SQLITE_IOERR_FSTAT; } - nMap = statbuf.st_size; } if( nMap>pFd->mmapSizeMax ){ nMap = pFd->mmapSizeMax; @@ -5770,6 +5794,7 @@ static int unixOpen( } if( isDelete ){ + p->szFile = 0; #if OS_VXWORKS zPath = zName; #else From 77ae7ca643692ddf6a85bd881bef4e1a5fe16452 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 9 Jun 2014 20:39:03 +0000 Subject: [PATCH 08/55] Avoid an unnecessary initialization of the szFile field of unixFile in the unix VFS. FossilOrigin-Name: 6484fb5a25c2a0e5d26694285a4908a22c67ba17 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index fcbd0a0c56..5eed2ac67e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\sunix\sVFS\sso\sthat\sit\skeeps\strack\sof\sthe\ssize\sof\sunlinked\sfiles\ninternally\sand\sthus\savoids\sthe\sneed\sto\scall\sfstat()\son\sthose\sfiles,\ssince\nfstat()\sdoes\snot\swork\sreliably\son\sunlinked\sfiles\son\ssome\simplementations\nof\sFuseFS. -D 2014-06-09T20:24:46.164 +C Avoid\san\sunnecessary\sinitialization\sof\sthe\sszFile\sfield\sof\sunixFile\sin\nthe\sunix\sVFS. +D 2014-06-09T20:39:03.676 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -205,7 +205,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c e8c5f23bb6e9123b524cd0a87dd1e9263a4dd3be +F src/os_unix.c 89be80af5141624fe432f51bfebdc826ec4d0d4f F src/os_win.c 8dbf6c11780fe2eb96c1f289e664d0c7b2911d37 F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25 F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8 @@ -1174,7 +1174,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1925f3a0a2caa709569df015a8e0d26412f1a9ff c41df393c6afbfbfdc4d1b885024e083c6f6de1f -R ce653ef517f5e803383e83307c89c5db +P 10707d35786403ea5392d980f593bfecdae063dd +R 5c924f630188cdd6e1f0b84a36c79d61 U drh -Z 51e75e681608f5fd7d1d480ee0a981d3 +Z b2fa1d596ef871591a5ab3a0251e8787 diff --git a/manifest.uuid b/manifest.uuid index 6da83fe43c..bf49aa9d51 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -10707d35786403ea5392d980f593bfecdae063dd \ No newline at end of file +6484fb5a25c2a0e5d26694285a4908a22c67ba17 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index ceb8cdb7f3..72d04e670d 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5794,7 +5794,7 @@ static int unixOpen( } if( isDelete ){ - p->szFile = 0; + assert( p->szFile==0 ); #if OS_VXWORKS zPath = zName; #else From 696964d0e5f8bafbc9ee73d1db43510fc2910103 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 12 Jun 2014 15:46:46 +0000 Subject: [PATCH 09/55] Simplify the estLog() routine. FossilOrigin-Name: 6c68d758bce3752f044752404a76bf3ba3eec48f --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/where.c | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 5eed2ac67e..c5694c123e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\san\sunnecessary\sinitialization\sof\sthe\sszFile\sfield\sof\sunixFile\sin\nthe\sunix\sVFS. -D 2014-06-09T20:39:03.676 +C Simplify\sthe\sestLog()\sroutine. +D 2014-06-12T15:46:46.043 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -294,7 +294,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 1c0a0b1f132915c8b9d2c6a4aecd45654d2a9708 +F src/where.c 778943263d3d6de375f9e983998d61d61810e9d5 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1174,7 +1174,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 10707d35786403ea5392d980f593bfecdae063dd -R 5c924f630188cdd6e1f0b84a36c79d61 +P 6484fb5a25c2a0e5d26694285a4908a22c67ba17 +R 34527842724eabaf8c54b06a4f0df0d3 U drh -Z b2fa1d596ef871591a5ab3a0251e8787 +Z d9811e61b520e89dd1ac8e506eeb59a8 diff --git a/manifest.uuid b/manifest.uuid index bf49aa9d51..e050dd554d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6484fb5a25c2a0e5d26694285a4908a22c67ba17 \ No newline at end of file +6c68d758bce3752f044752404a76bf3ba3eec48f \ No newline at end of file diff --git a/src/where.c b/src/where.c index 24c57f34e5..01d6b2a8f2 100644 --- a/src/where.c +++ b/src/where.c @@ -1494,8 +1494,7 @@ static int isDistinctRedundant( ** Estimate the logarithm of the input value to base 2. */ static LogEst estLog(LogEst N){ - LogEst x = N<0 ? 1 : sqlite3LogEst(N); - return x>33 ? x - 33 : 0; + return N<=10 ? 0 : sqlite3LogEst(N) - 33; } /* From 5b6e3b9781609b10577e5b8b61ed3002176ad033 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 12 Jun 2014 17:10:18 +0000 Subject: [PATCH 10/55] Increase the WAL-mode SQLITE_PROTOCOL timeout to 10 seconds. FossilOrigin-Name: 2aeacf81df92b4fe5d1825c1dc1cd176b8af8bd9 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/wal.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index c5694c123e..80147db415 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplify\sthe\sestLog()\sroutine. -D 2014-06-12T15:46:46.043 +C Increase\sthe\sWAL-mode\sSQLITE_PROTOCOL\stimeout\sto\s10\sseconds. +D 2014-06-12T17:10:18.787 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -291,7 +291,7 @@ F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447 F src/vdbesort.c 44441d73b08b3a638dcdb725afffb87c6574ad27 F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767 F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd -F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 +F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 F src/where.c 778943263d3d6de375f9e983998d61d61810e9d5 @@ -1174,7 +1174,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6484fb5a25c2a0e5d26694285a4908a22c67ba17 -R 34527842724eabaf8c54b06a4f0df0d3 +P 6c68d758bce3752f044752404a76bf3ba3eec48f +R 2f07fa98b6e908bc6502590dbe40f41c U drh -Z d9811e61b520e89dd1ac8e506eeb59a8 +Z 7ca1de307211ad47daac93b8be7d2faa diff --git a/manifest.uuid b/manifest.uuid index e050dd554d..f0d84ac558 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6c68d758bce3752f044752404a76bf3ba3eec48f \ No newline at end of file +2aeacf81df92b4fe5d1825c1dc1cd176b8af8bd9 \ No newline at end of file diff --git a/src/wal.c b/src/wal.c index ad76065f50..70395f8bee 100644 --- a/src/wal.c +++ b/src/wal.c @@ -2096,8 +2096,8 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ ** calls to sqlite3OsSleep() have a delay of 1 microsecond. Really this ** is more of a scheduler yield than an actual delay. But on the 10th ** an subsequent retries, the delays start becoming longer and longer, - ** so that on the 100th (and last) RETRY we delay for 21 milliseconds. - ** The total delay time before giving up is less than 1 second. + ** so that on the 100th (and last) RETRY we delay for 323 milliseconds. + ** The total delay time before giving up is less than 10 seconds. */ if( cnt>5 ){ int nDelay = 1; /* Pause time in microseconds */ @@ -2105,7 +2105,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ VVA_ONLY( pWal->lockError = 1; ) return SQLITE_PROTOCOL; } - if( cnt>=10 ) nDelay = (cnt-9)*238; /* Max delay 21ms. Total delay 996ms */ + if( cnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39; sqlite3OsSleep(pWal->pVfs, nDelay); } From 0b93058b0ed2875d193a2dcbc9bd648b1297a870 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 13 Jun 2014 13:08:21 +0000 Subject: [PATCH 11/55] Add an extension that implements compress() and uncompress() SQL functions. FossilOrigin-Name: d5c17d1a423321f766616d82c9b27ef87c1d5afd --- ext/misc/compress.c | 107 ++++++++++++++++++++++++++++++++++++++++++++ manifest | 11 ++--- manifest.uuid | 2 +- 3 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 ext/misc/compress.c diff --git a/ext/misc/compress.c b/ext/misc/compress.c new file mode 100644 index 0000000000..a4059116c9 --- /dev/null +++ b/ext/misc/compress.c @@ -0,0 +1,107 @@ +/* +** 2014-06-13 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This SQLite extension implements SQL compression functions +** compress() and uncompress() using ZLIB. +*/ +#include "sqlite3ext.h" +SQLITE_EXTENSION_INIT1 +#include + +/* +** Implementation of the "compress(X)" SQL function. The input X is +** compressed using zLib and the output is returned. +** +** The output is a BLOB that begins with a variable-length integer that +** is the input size in bytes (the size of X before compression). The +** variable-length integer is implemented as 1 to 5 bytes. There are +** seven bits per integer stored in the lower seven bits of each byte. +** More significant bits occur first. The most significant bit (0x80) +** is a flag to indicate the end of the integer. +*/ +static void compressFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const unsigned char *pIn; + unsigned char *pOut; + unsigned int nIn; + unsigned long int nOut; + unsigned char x[8]; + int i, j; + + pIn = sqlite3_value_blob(argv[0]); + nIn = sqlite3_value_bytes(argv[0]); + nOut = 13 + nIn + (nIn+999)/1000; + pOut = sqlite3_malloc( nOut+5 ); + for(i=4; i>=0; i--){ + x[i] = (nIn >> (7*(4-i)))&0x7f; + } + for(i=0; i<4 && x[i]==0; i++){} + for(j=0; i<=4; i++, j++) pOut[j] = x[i]; + pOut[j-1] |= 0x80; + compress(&pOut[j], &nOut, pIn, nIn); + sqlite3_result_blob(context, pOut, nOut+j, sqlite3_free); +} + +/* +** Implementation of the "uncompress(X)" SQL function. The argument X +** is a blob which was obtained from compress(Y). The output will be +** the value Y. +*/ +static void uncompressFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const unsigned char *pIn; + unsigned char *pOut; + unsigned int nIn; + unsigned long int nOut; + int rc; + int i; + + pIn = sqlite3_value_blob(argv[0]); + nIn = sqlite3_value_bytes(argv[0]); + nOut = 0; + for(i=0; i Date: Fri, 13 Jun 2014 13:43:25 +0000 Subject: [PATCH 12/55] Add the fileio.c loadable extension, that implements readfile() and writefile() SQL functions. FossilOrigin-Name: 0ca104d821d5841ab0754113be074c520cf07f23 --- ext/misc/fileio.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++ manifest | 11 ++--- manifest.uuid | 2 +- 3 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 ext/misc/fileio.c diff --git a/ext/misc/fileio.c b/ext/misc/fileio.c new file mode 100644 index 0000000000..6ab073535a --- /dev/null +++ b/ext/misc/fileio.c @@ -0,0 +1,103 @@ +/* +** 2014-06-13 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This SQLite extension implements SQL functions readfile() and +** writefile(). +*/ +#include "sqlite3ext.h" +SQLITE_EXTENSION_INIT1 +#include + +/* +** Implementation of the "readfile(X)" SQL function. The entire content +** of the file named X is read and returned as a BLOB. NULL is returned +** if the file does not exist or is unreadable. +*/ +static void readfileFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const char *zName; + FILE *in; + long nIn; + void *pBuf; + + zName = (const char*)sqlite3_value_text(argv[0]); + if( zName==0 ) return; + in = fopen(zName, "rb"); + if( in==0 ) return; + fseek(in, 0, SEEK_END); + nIn = ftell(in); + rewind(in); + pBuf = sqlite3_malloc( nIn ); + if( pBuf && 1==fread(pBuf, nIn, 1, in) ){ + sqlite3_result_blob(context, pBuf, nIn, sqlite3_free); + }else{ + sqlite3_free(pBuf); + } + fclose(in); +} + +/* +** Implementation of the "writefile(X,Y)" SQL function. The argument Y +** is written into file X. The number of bytes written is returned. Or +** NULL is returned if something goes wrong, such as being unable to open +** file X for writing. +*/ +static void writefileFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + FILE *out; + const char *z; + int n; + long rc; + const char *zFile; + + zFile = (const char*)sqlite3_value_text(argv[0]); + if( zFile==0 ) return; + out = fopen(zFile, "wb"); + if( out==0 ) return; + z = (const char*)sqlite3_value_blob(argv[1]); + if( z==0 ){ + n = 0; + rc = 0; + }else{ + n = sqlite3_value_bytes(argv[1]); + rc = fwrite(z, 1, n, out); + } + fclose(out); + sqlite3_result_int64(context, rc); +} + + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_fileio_init( + sqlite3 *db, + char **pzErrMsg, + const sqlite3_api_routines *pApi +){ + int rc = SQLITE_OK; + SQLITE_EXTENSION_INIT2(pApi); + (void)pzErrMsg; /* Unused parameter */ + rc = sqlite3_create_function(db, "readfile", 1, SQLITE_UTF8, 0, + readfileFunc, 0, 0); + if( rc==SQLITE_OK ){ + rc = sqlite3_create_function(db, "writefile", 2, SQLITE_UTF8, 0, + writefileFunc, 0, 0); + } + return rc; +} diff --git a/manifest b/manifest index 87826c081e..0c69079fb3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sextension\sthat\simplements\scompress()\sand\suncompress()\sSQL\sfunctions. -D 2014-06-13T13:08:21.440 +C Add\sthe\sfileio.c\sloadable\sextension,\sthat\simplements\sreadfile()\sand\swritefile()\nSQL\sfunctions. +D 2014-06-13T13:43:25.488 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -109,6 +109,7 @@ F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/misc/amatch.c 678056a4bfcd83c4e82dea81d37543cd1d6dbee1 F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012 F ext/misc/compress.c 76e45655f4046e756064ab10c62e18f2eb846b9f +F ext/misc/fileio.c 2927bf833edad966ed222f0552c0602ae473ca16 F ext/misc/fuzzer.c 136533c53cfce0957f0b48fa11dba27e21c5c01d F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 @@ -1175,7 +1176,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 2aeacf81df92b4fe5d1825c1dc1cd176b8af8bd9 -R d1737f084b807e547e6c83682c2e8d71 +P d5c17d1a423321f766616d82c9b27ef87c1d5afd +R 1805f6a0ae3bbffdcfbcff54f7b6c6b0 U drh -Z 8447f1843125715fcf2f15ddbc0454fa +Z 904e0ffbd1a81754412e5093211c823c diff --git a/manifest.uuid b/manifest.uuid index dd7a18f631..b70849785c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d5c17d1a423321f766616d82c9b27ef87c1d5afd \ No newline at end of file +0ca104d821d5841ab0754113be074c520cf07f23 \ No newline at end of file From 51ed2983642312dc822d458ea7c0ab468da78f8e Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Jun 2014 12:44:32 +0000 Subject: [PATCH 13/55] Add test cases for the fileio extension. FossilOrigin-Name: 8634333127c4d868d3ec27e88b5818f6479774f3 --- Makefile.in | 1 + Makefile.msc | 1 + main.mk | 1 + manifest | 19 +++++------ manifest.uuid | 2 +- src/test1.c | 2 ++ test/extension01.test | 75 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 test/extension01.test diff --git a/Makefile.in b/Makefile.in index c30435b66d..920f3d893d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -393,6 +393,7 @@ TESTSRC = \ TESTSRC += \ $(TOP)/ext/misc/amatch.c \ $(TOP)/ext/misc/closure.c \ + $(TOP)/ext/misc/fileio.c \ $(TOP)/ext/misc/fuzzer.c \ $(TOP)/ext/misc/ieee754.c \ $(TOP)/ext/misc/nextchar.c \ diff --git a/Makefile.msc b/Makefile.msc index 3d9d9f2eb2..fce958b947 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -862,6 +862,7 @@ TESTSRC = \ TESTEXT = \ $(TOP)\ext\misc\amatch.c \ $(TOP)\ext\misc\closure.c \ + $(TOP)\ext\misc\fileio.c \ $(TOP)\ext\misc\fuzzer.c \ $(TOP)\ext\misc\ieee754.c \ $(TOP)\ext\misc\nextchar.c \ diff --git a/main.mk b/main.mk index 3bdbe810f8..3076229d5e 100644 --- a/main.mk +++ b/main.mk @@ -277,6 +277,7 @@ TESTSRC = \ TESTSRC += \ $(TOP)/ext/misc/amatch.c \ $(TOP)/ext/misc/closure.c \ + $(TOP)/ext/misc/fileio.c \ $(TOP)/ext/misc/fuzzer.c \ $(TOP)/ext/misc/ieee754.c \ $(TOP)/ext/misc/nextchar.c \ diff --git a/manifest b/manifest index 0c69079fb3..c5c9c1fda4 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Add\sthe\sfileio.c\sloadable\sextension,\sthat\simplements\sreadfile()\sand\swritefile()\nSQL\sfunctions. -D 2014-06-13T13:43:25.488 +C Add\stest\scases\sfor\sthe\sfileio\sextension. +D 2014-06-16T12:44:32.986 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in dd2b1aba364ff9b05de41086f74407f285c57670 +F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 52911c6bfeaf9b40f47ef4615ab66d98ab0f2b3d +F Makefile.msc b5ff082a24cd1e0694a0001891e13e3b56c8ef31 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 F VERSION 9f823c026c6a32fc5f84d212a8aae0a221dba45c @@ -146,7 +146,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt f439556c5ce01ced70987e5ee86549a45165d9ff -F main.mk cfa185eed4e0f7e9d28a2e3167cecaa9d6cb39f3 +F main.mk 0cb97ec3285474651736053ee741145ef8c5185f F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -232,7 +232,7 @@ F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c e87c99e28a145943666b51b212dacae35fcea0bd -F src/test1.c 4edf8810c86d77ae7ac6d56d563965a9beeea2ce +F src/test1.c 3c8bc491d2f8de5adbbf306533cefc343c733927 F src/test2.c 98049e51a17dc62606a99a9eb95ee477f9996712 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -466,6 +466,7 @@ F test/exclusive2.test 32798111aae78a5deec980eee383213f189df308 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7 F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30 F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d +F test/extension01.test 06b3c61d9c87e262b2a3b61abc080be5b29e1eb4 F test/fallocate.test 3e979af17dfa7e5e9dda5eba1a696c04fa9d47f7 F test/filectrl.test 14fa712e42c4cb791e09dfd58a6a03efb47ef13a F test/filefmt.test cb34663f126cbc2d358af552dcaf5c72769b0146 @@ -1176,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d5c17d1a423321f766616d82c9b27ef87c1d5afd -R 1805f6a0ae3bbffdcfbcff54f7b6c6b0 +P 0ca104d821d5841ab0754113be074c520cf07f23 +R ccaa3e1a4ad97ab90dbd1c64a76fa424 U drh -Z 904e0ffbd1a81754412e5093211c823c +Z a84943f6024adba9b7ed1466702addbc diff --git a/manifest.uuid b/manifest.uuid index b70849785c..fc36f4c5fc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0ca104d821d5841ab0754113be074c520cf07f23 \ No newline at end of file +8634333127c4d868d3ec27e88b5818f6479774f3 \ No newline at end of file diff --git a/src/test1.c b/src/test1.c index a99b26ffd0..8d2249cbb8 100644 --- a/src/test1.c +++ b/src/test1.c @@ -6281,6 +6281,7 @@ static int tclLoadStaticExtensionCmd( ){ extern int sqlite3_amatch_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_closure_init(sqlite3*,char**,const sqlite3_api_routines*); + extern int sqlite3_fileio_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_fuzzer_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_ieee_init(sqlite3*,char**,const sqlite3_api_routines*); extern int sqlite3_nextchar_init(sqlite3*,char**,const sqlite3_api_routines*); @@ -6295,6 +6296,7 @@ static int tclLoadStaticExtensionCmd( } aExtension[] = { { "amatch", sqlite3_amatch_init }, { "closure", sqlite3_closure_init }, + { "fileio", sqlite3_fileio_init }, { "fuzzer", sqlite3_fuzzer_init }, { "ieee754", sqlite3_ieee_init }, { "nextchar", sqlite3_nextchar_init }, diff --git a/test/extension01.test b/test/extension01.test new file mode 100644 index 0000000000..a96c52a01f --- /dev/null +++ b/test/extension01.test @@ -0,0 +1,75 @@ +# 2014-06-16 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file implements tests for various small extensions. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set ::testprefix extension01 + +load_static_extension db fileio +do_test 1.0 { + forcedelete file1.txt + set out [open ./file1.txt wb] + puts -nonewline $out "This is a text file without a line ending" + close $out + db eval { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT); + INSERT INTO t1 VALUES(1, readfile('./file1.txt')); + SELECT * FROM t1; + } +} {1 {This is a text file without a line ending}} +do_test 1.1 { + forcedelete file2.txt + db nullvalue nil + db eval { + DELETE FROM t1; + INSERT INTO t1 VALUES(2, readfile(NULL)),(3, readfile('file2.txt')); + SELECT a, b, typeof(b) FROM t1; + } +} {2 nil null 3 nil null} + +do_test 1.2 { + db eval { + SELECT writefile('./file2.txt', 'A second test line'); + } +} {18} +do_test 1.3 { + set in [open ./file2.txt rb] + set x [read $in] + close $in + list $x [file size file2.txt] +} {{A second test line} 18} + +do_test 1.4 { + db eval { + SELECT writefile('./file2.txt', NULL); + } +} {0} +do_test 1.5 { + file size ./file2.txt +} {0} + +do_test 1.6 { + file attributes ./file2.txt -permissions r--r--r-- + db eval { + SELECT writefile('./file2.txt', 'Another test'); + } +} {nil} +do_test 1.7 { + file attributes ./file2.txt -permissions rw-r--r-- + db eval { + SELECT writefile(NULL, 'Another test'); + } +} {nil} + +finish_test From a2412c1613e7911fcdd20126fbd722a8a1655462 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Jun 2014 12:51:56 +0000 Subject: [PATCH 14/55] Fix the extension01.test script so that it works on windows. Fix a harmless compiler warning in the fileio extension. FossilOrigin-Name: baf95a190907d05a847ae8b6a3dd60625c2a078a --- ext/misc/fileio.c | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- test/extension01.test | 12 ++++++++++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ext/misc/fileio.c b/ext/misc/fileio.c index 6ab073535a..f80949bff2 100644 --- a/ext/misc/fileio.c +++ b/ext/misc/fileio.c @@ -62,7 +62,7 @@ static void writefileFunc( FILE *out; const char *z; int n; - long rc; + sqlite3_int64 rc; const char *zFile; zFile = (const char*)sqlite3_value_text(argv[0]); diff --git a/manifest b/manifest index c5c9c1fda4..9539234b2c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\stest\scases\sfor\sthe\sfileio\sextension. -D 2014-06-16T12:44:32.986 +C Fix\sthe\sextension01.test\sscript\sso\sthat\sit\sworks\son\swindows.\s\sFix\sa\s\nharmless\scompiler\swarning\sin\sthe\sfileio\sextension. +D 2014-06-16T12:51:56.200 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -109,7 +109,7 @@ F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/misc/amatch.c 678056a4bfcd83c4e82dea81d37543cd1d6dbee1 F ext/misc/closure.c 636024302cde41b2bf0c542f81c40c624cfb7012 F ext/misc/compress.c 76e45655f4046e756064ab10c62e18f2eb846b9f -F ext/misc/fileio.c 2927bf833edad966ed222f0552c0602ae473ca16 +F ext/misc/fileio.c beea82bb5055b6590cffe2d2e6d922905894f691 F ext/misc/fuzzer.c 136533c53cfce0957f0b48fa11dba27e21c5c01d F ext/misc/ieee754.c b0362167289170627659e84173f5d2e8fee8566e F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342 @@ -466,7 +466,7 @@ F test/exclusive2.test 32798111aae78a5deec980eee383213f189df308 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7 F test/exists.test 8f7b27b61c2fbe5822f0a1f899c715d14e416e30 F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d -F test/extension01.test 06b3c61d9c87e262b2a3b61abc080be5b29e1eb4 +F test/extension01.test 00d13cec817f331a687a243e0e5a2d87b0e358c9 F test/fallocate.test 3e979af17dfa7e5e9dda5eba1a696c04fa9d47f7 F test/filectrl.test 14fa712e42c4cb791e09dfd58a6a03efb47ef13a F test/filefmt.test cb34663f126cbc2d358af552dcaf5c72769b0146 @@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0ca104d821d5841ab0754113be074c520cf07f23 -R ccaa3e1a4ad97ab90dbd1c64a76fa424 +P 8634333127c4d868d3ec27e88b5818f6479774f3 +R 353afc7fd0abf06433e6eda5525663c7 U drh -Z a84943f6024adba9b7ed1466702addbc +Z c4508024fad1b2c6278c0f51a968dc30 diff --git a/manifest.uuid b/manifest.uuid index fc36f4c5fc..28daa06d8d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8634333127c4d868d3ec27e88b5818f6479774f3 \ No newline at end of file +baf95a190907d05a847ae8b6a3dd60625c2a078a \ No newline at end of file diff --git a/test/extension01.test b/test/extension01.test index a96c52a01f..97b772680e 100644 --- a/test/extension01.test +++ b/test/extension01.test @@ -60,13 +60,21 @@ do_test 1.5 { } {0} do_test 1.6 { - file attributes ./file2.txt -permissions r--r--r-- + if {$::tcl_platform(platform)=="unix"} { + file attributes ./file2.txt -permissions r--r--r-- + } else { + file attributes ./file2.txt -readonly 1 + } db eval { SELECT writefile('./file2.txt', 'Another test'); } } {nil} do_test 1.7 { - file attributes ./file2.txt -permissions rw-r--r-- + if {$::tcl_platform(platform)=="unix"} { + file attributes ./file2.txt -permissions rw-r--r-- + } else { + file attributes ./file2.txt -readonly 0 + } db eval { SELECT writefile(NULL, 'Another test'); } From 6d36ffe8f3e45fa497c72c3c36061500932af84b Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Jun 2014 15:01:37 +0000 Subject: [PATCH 15/55] Add the ".eqp" dot-command to the ".help" output in the command-line shell. This was accidently omitted when the ".eqp" command was originally implemented for SQLite 3.8.4 (check-in [e6ecf7337658624]). FossilOrigin-Name: b0b4c776c321ca4a792ef67efbc62351eeac247d --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/shell.c | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 9539234b2c..bad340afd2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sextension01.test\sscript\sso\sthat\sit\sworks\son\swindows.\s\sFix\sa\s\nharmless\scompiler\swarning\sin\sthe\sfileio\sextension. -D 2014-06-16T12:51:56.200 +C Add\sthe\s".eqp"\sdot-command\sto\sthe\s".help"\soutput\sin\sthe\scommand-line\sshell.\nThis\swas\saccidently\somitted\swhen\sthe\s".eqp"\scommand\swas\soriginally\simplemented\nfor\sSQLite\s3.8.4\s(check-in\s[e6ecf7337658624]). +D 2014-06-16T15:01:37.512 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -223,7 +223,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c 6762c62e11b504aa014edceab8886495165e3a77 -F src/shell.c 98ce7f52445aa0c2eac3d4553a4cdcbb6402a670 +F src/shell.c d472576bc7f8a657212eac5b9a88afdaefc29a27 F src/sqlite.h.in a98eb3e8c86c934ea6f5bcfc6b69653dde2f4ed4 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc @@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8634333127c4d868d3ec27e88b5818f6479774f3 -R 353afc7fd0abf06433e6eda5525663c7 +P baf95a190907d05a847ae8b6a3dd60625c2a078a +R 77392df379cf094587c415a5e52c867e U drh -Z c4508024fad1b2c6278c0f51a968dc30 +Z c37a319047179d2f3f16508cbd16fb41 diff --git a/manifest.uuid b/manifest.uuid index 28daa06d8d..31c88868b8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -baf95a190907d05a847ae8b6a3dd60625c2a078a \ No newline at end of file +b0b4c776c321ca4a792ef67efbc62351eeac247d \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 1f8681f639..4edbaec178 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1579,6 +1579,7 @@ static char zHelp[] = " If TABLE specified, only dump tables matching\n" " LIKE pattern TABLE.\n" ".echo on|off Turn command echo on or off\n" + ".eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN\n" ".exit Exit this program\n" ".explain ?on|off? Turn output mode suitable for EXPLAIN on or off.\n" " With no args, it turns EXPLAIN on.\n" From 3044b51d2fb40cda52f9c6cd45b486cd1a7560db Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Jun 2014 16:41:52 +0000 Subject: [PATCH 16/55] Back out the unix VFS changes that seeks to avoid fstat() calls after an unlink(). That change did not clear the problem on FuseFS. FossilOrigin-Name: 0617e20a33e08754aea14e60db44e557c13978e3 --- manifest | 13 +++++++------ manifest.uuid | 2 +- src/os_unix.c | 45 ++++++++++----------------------------------- 3 files changed, 18 insertions(+), 42 deletions(-) diff --git a/manifest b/manifest index bad340afd2..303bdc8a77 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s".eqp"\sdot-command\sto\sthe\s".help"\soutput\sin\sthe\scommand-line\sshell.\nThis\swas\saccidently\somitted\swhen\sthe\s".eqp"\scommand\swas\soriginally\simplemented\nfor\sSQLite\s3.8.4\s(check-in\s[e6ecf7337658624]). -D 2014-06-16T15:01:37.512 +C Back\sout\sthe\sunix\sVFS\schanges\sthat\sseeks\sto\savoid\sfstat()\scalls\safter\san\nunlink().\s\sThat\schange\sdid\snot\sclear\sthe\sproblem\son\sFuseFS. +D 2014-06-16T16:41:52.046 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -207,7 +207,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 89be80af5141624fe432f51bfebdc826ec4d0d4f +F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f F src/os_win.c 8dbf6c11780fe2eb96c1f289e664d0c7b2911d37 F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25 F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8 @@ -1177,7 +1177,8 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P baf95a190907d05a847ae8b6a3dd60625c2a078a -R 77392df379cf094587c415a5e52c867e +P b0b4c776c321ca4a792ef67efbc62351eeac247d +Q -10707d35786403ea5392d980f593bfecdae063dd +R e96aeed73bec47c3b8abfdb2818e21e8 U drh -Z c37a319047179d2f3f16508cbd16fb41 +Z a60331639ee1b0609616a92f467c0973 diff --git a/manifest.uuid b/manifest.uuid index 31c88868b8..c80c921951 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b0b4c776c321ca4a792ef67efbc62351eeac247d \ No newline at end of file +0617e20a33e08754aea14e60db44e557c13978e3 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 72d04e670d..fc320a4926 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -191,7 +191,6 @@ struct unixFile { UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */ const char *zPath; /* Name of the file */ unixShm *pShm; /* Shared memory segment information */ - sqlite3_int64 szFile; /* File size for UNIXFILE_DELETE files */ int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ #if SQLITE_MAX_MMAP_SIZE>0 int nFetchOut; /* Number of outstanding xFetch refs */ @@ -1322,11 +1321,9 @@ static int fileHasMoved(unixFile *pFile){ static void verifyDbFile(unixFile *pFile){ struct stat buf; int rc; - if( pFile->ctrlFlags & (UNIXFILE_WARNED|UNIXFILE_DELETE) ){ - /* UNIXFILE_WARNED means that one or more of the following warnings have - ** already been issued. Do not* repeat them so as not to clutter the error - ** log. Do not investigate unlinked files since fstat() does not always - ** work following an unlink(). */ + if( pFile->ctrlFlags & UNIXFILE_WARNED ){ + /* One or more of the following warnings have already been issued. Do not + ** repeat them so as not to clutter the error log */ return; } rc = osFstat(pFile->h, &buf); @@ -1335,7 +1332,7 @@ static void verifyDbFile(unixFile *pFile){ pFile->ctrlFlags |= UNIXFILE_WARNED; return; } - if( buf.st_nlink==0 ){ + if( buf.st_nlink==0 && (pFile->ctrlFlags & UNIXFILE_DELETE)==0 ){ sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath); pFile->ctrlFlags |= UNIXFILE_WARNED; return; @@ -3284,10 +3281,6 @@ static int unixWrite( assert( id ); assert( amt>0 ); - /* Update the internally tracked file size. The internal file size is only - ** accurate for unlinked files */ - if( offset+amt>pFile->szFile ) pFile->szFile = offset+amt; - /* If this is a database file (not a journal, master-journal or temp ** file), the bytes in the locking range should never be read or written. */ #if 0 @@ -3628,7 +3621,6 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){ } #endif - pFile->szFile = nByte; return SQLITE_OK; } } @@ -3638,27 +3630,12 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){ */ static int unixFileSize(sqlite3_file *id, i64 *pSize){ int rc; - unixFile *pFile = (unixFile*)id; struct stat buf; - assert( pFile ); - - /* For files that have been unlinked, simply return the szFile which we keep - ** track of internally. There is no need to fstat() as SQLite has exclusive - ** access to the file and no other process can modify the file and thus change - ** the file size without our knowing it. We do this because fstat() will - ** fail on unlinked files on some (broken) unix filesystems. - */ - if( pFile->ctrlFlags & UNIXFILE_DELETE ){ - *pSize = pFile->szFile; - /* The following assert() confirms that the internal filesize is correct */ - assert( osFstat(pFile->h, &buf)!=0 || buf.st_size==pFile->szFile ); - return SQLITE_OK; - } - - rc = osFstat(pFile->h, &buf); + assert( id ); + rc = osFstat(((unixFile*)id)->h, &buf); SimulateIOError( rc=1 ); if( rc!=0 ){ - pFile->lastErrno = errno; + ((unixFile*)id)->lastErrno = errno; return SQLITE_IOERR_FSTAT; } *pSize = buf.st_size; @@ -3694,7 +3671,6 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ i64 nSize; /* Required file size */ struct stat buf; /* Used to hold return values of fstat() */ - if( pFile->ctrlFlags & UNIXFILE_DELETE ) return SQLITE_OK; if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT; nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; @@ -4243,7 +4219,6 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ if( p==0 ) return SQLITE_NOMEM; memset(p, 0, sizeof(*p)); assert( pDbFd->pShm==0 ); - assert( (pDbFd->ctrlFlags & UNIXFILE_DELETE)==0 ); /* Check to see if a unixShmNode object already exists. Reuse an existing ** one if present. Create a new one if necessary. @@ -4790,7 +4765,6 @@ static void unixRemapfile( } pFd->pMapRegion = (void *)pNew; pFd->mmapSize = pFd->mmapSizeActual = nNew; - if( nNew>pFd->szFile ) pFd->szFile = nNew; } /* @@ -4817,10 +4791,12 @@ static int unixMapfile(unixFile *pFd, i64 nByte){ if( pFd->nFetchOut>0 ) return SQLITE_OK; if( nMap<0 ){ - rc = unixFileSize((sqlite3_file*)pFd, &nMap); + struct stat statbuf; /* Low-level file information */ + rc = osFstat(pFd->h, &statbuf); if( rc!=SQLITE_OK ){ return SQLITE_IOERR_FSTAT; } + nMap = statbuf.st_size; } if( nMap>pFd->mmapSizeMax ){ nMap = pFd->mmapSizeMax; @@ -5794,7 +5770,6 @@ static int unixOpen( } if( isDelete ){ - assert( p->szFile==0 ); #if OS_VXWORKS zPath = zName; #else From 2fe708196def2a3bd7133b142f04ffdecab38ff9 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Jun 2014 18:17:21 +0000 Subject: [PATCH 17/55] Add an application ID for MBTiles tilesets. FossilOrigin-Name: 837f6404230fc642e9084140c4b30cca1be43375 --- magic.txt | 1 + manifest | 13 ++++++------- manifest.uuid | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/magic.txt b/magic.txt index add96a7363..65622687cc 100644 --- a/magic.txt +++ b/magic.txt @@ -28,4 +28,5 @@ >68 belong =0x47504b47 OGC GeoPackage file - >68 belong =0x47503130 OGC GeoPackage version 1.0 file - >68 belong =0x45737269 Esri Spatially-Enabled Database - +>68 belong =0x4d504258 MBTiles tileset - >0 string =SQLite SQLite3 database diff --git a/manifest b/manifest index 303bdc8a77..f1645c156c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Back\sout\sthe\sunix\sVFS\schanges\sthat\sseeks\sto\savoid\sfstat()\scalls\safter\san\nunlink().\s\sThat\schange\sdid\snot\sclear\sthe\sproblem\son\sFuseFS. -D 2014-06-16T16:41:52.046 +C Add\san\sapplication\sID\sfor\sMBTiles\stilesets. +D 2014-06-16T18:17:21.276 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -145,7 +145,7 @@ F ext/rtree/tkt3363.test 142ab96eded44a3615ec79fba98c7bde7d0f96de F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 -F magic.txt f439556c5ce01ced70987e5ee86549a45165d9ff +F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 F main.mk 0cb97ec3285474651736053ee741145ef8c5185f F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 @@ -1177,8 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b0b4c776c321ca4a792ef67efbc62351eeac247d -Q -10707d35786403ea5392d980f593bfecdae063dd -R e96aeed73bec47c3b8abfdb2818e21e8 +P 0617e20a33e08754aea14e60db44e557c13978e3 +R dfffbe0f43f71c007c108ea405a7d777 U drh -Z a60331639ee1b0609616a92f467c0973 +Z 9d670db05a88e1abc553c0c72f8664c9 diff --git a/manifest.uuid b/manifest.uuid index c80c921951..c4c9f65f48 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0617e20a33e08754aea14e60db44e557c13978e3 \ No newline at end of file +837f6404230fc642e9084140c4b30cca1be43375 \ No newline at end of file From 0bdbc90db80e23896c8d3e9e376219d8aa076d7c Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Jun 2014 18:35:06 +0000 Subject: [PATCH 18/55] Add the SQLITE_UNLINK_AFTER_CLOSE compile-time option. If enabled, the unlink of temporary files on unix is deferred until after the file is closed. FossilOrigin-Name: e43a2f92b616ec885a1ee62911fa8f6991d277f7 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/os_unix.c | 13 +++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index f1645c156c..e698ec3432 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\san\sapplication\sID\sfor\sMBTiles\stilesets. -D 2014-06-16T18:17:21.276 +C Add\sthe\sSQLITE_UNLINK_AFTER_CLOSE\scompile-time\soption.\s\sIf\senabled,\sthe\nunlink\sof\stemporary\sfiles\son\sunix\sis\sdeferred\suntil\safter\sthe\sfile\sis\sclosed. +D 2014-06-16T18:35:06.993 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -207,7 +207,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c ae4b5240af4619d711301d7992396e182585269f +F src/os_unix.c 9a97268f1ea97ddea17f1c392f7c76197ac4cea9 F src/os_win.c 8dbf6c11780fe2eb96c1f289e664d0c7b2911d37 F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25 F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8 @@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0617e20a33e08754aea14e60db44e557c13978e3 -R dfffbe0f43f71c007c108ea405a7d777 +P 837f6404230fc642e9084140c4b30cca1be43375 +R ecda5288cdc332685194aeb4a49d9a9a U drh -Z 9d670db05a88e1abc553c0c72f8664c9 +Z 0e0dd722026abbeb65bd76ad2a4f4176 diff --git a/manifest.uuid b/manifest.uuid index c4c9f65f48..3ea2a9a55d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -837f6404230fc642e9084140c4b30cca1be43375 \ No newline at end of file +e43a2f92b616ec885a1ee62911fa8f6991d277f7 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index fc320a4926..7eb25c85f3 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1918,6 +1918,13 @@ static int closeUnixFile(sqlite3_file *id){ vxworksReleaseFileId(pFile->pId); pFile->pId = 0; } +#endif +#ifdef SQLITE_UNLINK_AFTER_CLOSE + if( pFile->ctrlFlags & UNIXFILE_DELETE ){ + osUnlink(pFile->zPath); + sqlite3_free(*(char**)&pFile->zPath); + pFile->zPath = 0; + } #endif OSTRACE(("CLOSE %-3d\n", pFile->h)); OpenCounter(-1); @@ -5772,6 +5779,12 @@ static int unixOpen( if( isDelete ){ #if OS_VXWORKS zPath = zName; +#elif defined(SQLITE_UNLINK_AFTER_CLOSE) + zPath = sqlite3_mprintf("%s", zName); + if( zPath==0 ){ + robust_close(p, fd, __LINE__); + return SQLITE_NOMEM; + } #else osUnlink(zName); #endif From 0ace74a19cca773d361660a77e924296ff655a4c Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 16 Jun 2014 21:30:29 +0000 Subject: [PATCH 19/55] In the "wheretrace" logic (disabled for normal builds) expand the print width of the flags field to be wide enough for all 17 bits. FossilOrigin-Name: 3181d2069a788adc719decf65dc1bd2e16650c87 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/where.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index e698ec3432..35f415f917 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sSQLITE_UNLINK_AFTER_CLOSE\scompile-time\soption.\s\sIf\senabled,\sthe\nunlink\sof\stemporary\sfiles\son\sunix\sis\sdeferred\suntil\safter\sthe\sfile\sis\sclosed. -D 2014-06-16T18:35:06.993 +C In\sthe\s"wheretrace"\slogic\s(disabled\sfor\snormal\sbuilds)\sexpand\sthe\sprint\swidth\nof\sthe\sflags\sfield\sto\sbe\swide\senough\sfor\sall\s17\sbits. +D 2014-06-16T21:30:29.402 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 778943263d3d6de375f9e983998d61d61810e9d5 +F src/where.c 5ee08882fdc1a4661766a6dae639bd79cabb28fa F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 837f6404230fc642e9084140c4b30cca1be43375 -R ecda5288cdc332685194aeb4a49d9a9a +P e43a2f92b616ec885a1ee62911fa8f6991d277f7 +R ff2a1582a470d2ed61f9edf92dcfedf7 U drh -Z 0e0dd722026abbeb65bd76ad2a4f4176 +Z 5706b0908a4cefe3e401fd4592d23dda diff --git a/manifest.uuid b/manifest.uuid index 3ea2a9a55d..8b42224818 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e43a2f92b616ec885a1ee62911fa8f6991d277f7 \ No newline at end of file +3181d2069a788adc719decf65dc1bd2e16650c87 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 01d6b2a8f2..8c6f4bbbe3 100644 --- a/src/where.c +++ b/src/where.c @@ -3686,7 +3686,7 @@ static void whereLoopPrint(WhereLoop *p, WhereClause *pWC){ sqlite3DebugPrintf(" %-19s", z); sqlite3_free(z); } - sqlite3DebugPrintf(" f %04x N %d", p->wsFlags, p->nLTerm); + sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm); sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); #ifdef SQLITE_ENABLE_TREE_EXPLAIN /* If the 0x100 bit of wheretracing is set, then show all of the constraint From 6fe0338ca9b6627b3eb204cee5989fb14a523944 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Mon, 16 Jun 2014 22:45:28 +0000 Subject: [PATCH 20/55] Fix CSV import issue, reported via the mailing list, in the shell when the file to be imported ends with an empty line. FossilOrigin-Name: fc918f7d332b8f7cabc79a0f1586bd6760d14d40 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/shell.c | 2 +- test/shell5.test | 12 ++++++++++++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 35f415f917..33d3388ac9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\s"wheretrace"\slogic\s(disabled\sfor\snormal\sbuilds)\sexpand\sthe\sprint\swidth\nof\sthe\sflags\sfield\sto\sbe\swide\senough\sfor\sall\s17\sbits. -D 2014-06-16T21:30:29.402 +C Fix\sCSV\simport\sissue,\sreported\svia\sthe\smailing\slist,\sin\sthe\sshell\swhen\sthe\sfile\sto\sbe\simported\sends\swith\san\sempty\sline. +D 2014-06-16T22:45:28.779 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -223,7 +223,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c 6762c62e11b504aa014edceab8886495165e3a77 -F src/shell.c d472576bc7f8a657212eac5b9a88afdaefc29a27 +F src/shell.c 058940e8a7198ea15ae90f60ffb0e2d67287b46c F src/sqlite.h.in a98eb3e8c86c934ea6f5bcfc6b69653dde2f4ed4 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc @@ -820,7 +820,7 @@ F test/shell1.test fb080d67c81e8a80a79ea04b36f127209b5bd112 F test/shell2.test c57da3a381c099b02c813ba156298d5c2f5c93a3 F test/shell3.test 5e8545ec72c4413a0e8d4c6be56496e3c257ca29 F test/shell4.test 8a9c08976291e6c6c808b4d718f4a8b299f339f5 -F test/shell5.test 6b1a53c49a4ff5c3bd0bad17a85ecba505608278 +F test/shell5.test ef0c52952a4a96dc1d9ec3b1fa81ec897ca48154 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5 F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868 @@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P e43a2f92b616ec885a1ee62911fa8f6991d277f7 -R ff2a1582a470d2ed61f9edf92dcfedf7 -U drh -Z 5706b0908a4cefe3e401fd4592d23dda +P 3181d2069a788adc719decf65dc1bd2e16650c87 +R e15c594b7f416cdaa03cc5ded52dfa16 +U mistachkin +Z ca873ea75a4dc77a2f68671379d28791 diff --git a/manifest.uuid b/manifest.uuid index 8b42224818..2f140ef165 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3181d2069a788adc719decf65dc1bd2e16650c87 \ No newline at end of file +fc918f7d332b8f7cabc79a0f1586bd6760d14d40 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 4edbaec178..00d4597545 100644 --- a/src/shell.c +++ b/src/shell.c @@ -2554,7 +2554,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ "filling the rest with NULL\n", sCsv.zFile, startLine, nCol, i+1); i++; - while( i Date: Tue, 17 Jun 2014 02:46:55 +0000 Subject: [PATCH 21/55] Do not attempt to create an automatic index on a constant constraint, as doing so is pointless. FossilOrigin-Name: d6883e960f61365729f279a3c1f2c050beb49a55 --- manifest | 17 ++++++++++------- manifest.uuid | 2 +- src/where.c | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 33d3388ac9..420bfeac91 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sCSV\simport\sissue,\sreported\svia\sthe\smailing\slist,\sin\sthe\sshell\swhen\sthe\sfile\sto\sbe\simported\sends\swith\san\sempty\sline. -D 2014-06-16T22:45:28.779 +C Do\snot\sattempt\sto\screate\san\sautomatic\sindex\son\sa\sconstant\sconstraint,\sas\ndoing\sso\sis\spointless. +D 2014-06-17T02:46:55.317 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 5ee08882fdc1a4661766a6dae639bd79cabb28fa +F src/where.c 46e94a513fa783a950889e924b253339e498d600 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1177,7 +1177,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3181d2069a788adc719decf65dc1bd2e16650c87 -R e15c594b7f416cdaa03cc5ded52dfa16 -U mistachkin -Z ca873ea75a4dc77a2f68671379d28791 +P fc918f7d332b8f7cabc79a0f1586bd6760d14d40 +R c05b0f400c5eb501cd2d5ddbdc6430c7 +T *branch * autoindex-improvements +T *sym-autoindex-improvements * +T -sym-trunk * +U drh +Z 93418c6f90150cfc0b0ae16a3328fb2a diff --git a/manifest.uuid b/manifest.uuid index 2f140ef165..7f4c5b13a3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fc918f7d332b8f7cabc79a0f1586bd6760d14d40 \ No newline at end of file +d6883e960f61365729f279a3c1f2c050beb49a55 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 8c6f4bbbe3..d2723dd5b6 100644 --- a/src/where.c +++ b/src/where.c @@ -4529,6 +4529,7 @@ static int whereLoopAddBtree( WhereTerm *pWCEnd = pWC->a + pWC->nTerm; for(pTerm=pWC->a; rc==SQLITE_OK && pTermprereqRight & pNew->maskSelf ) continue; + if( pTerm->prereqRight==0 ) continue; if( termCanDriveIndex(pTerm, pSrc, 0) ){ pNew->u.btree.nEq = 1; pNew->u.btree.nSkip = 0; From 6b7ff748a1c20ee882a3ac6f3146e21be469983a Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 17 Jun 2014 09:00:54 +0000 Subject: [PATCH 22/55] Allow an automatic index on a WHERE constraint where the RHS is does not reference another table as long as the RHS is not a constant. FossilOrigin-Name: 58acc2a8b38c5f13175c191697b4d2b663db1872 --- ext/rtree/rtree6.test | 10 ++++++++-- manifest | 19 ++++++++----------- manifest.uuid | 2 +- src/where.c | 5 ++++- test/tpch01.test | 7 ++++++- 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ext/rtree/rtree6.test b/ext/rtree/rtree6.test index c5a78bb3e3..9e51993bd8 100644 --- a/ext/rtree/rtree6.test +++ b/ext/rtree/rtree6.test @@ -92,12 +92,18 @@ do_eqp_test rtree6.2.3 { 0 1 1 {SEARCH TABLE t2 USING INTEGER PRIMARY KEY (rowid=?)} } -do_eqp_test rtree6.2.4 { - SELECT * FROM t1,t2 WHERE v=10 and x1<10 and x2>10 +do_eqp_test rtree6.2.4.1 { + SELECT * FROM t1,t2 WHERE v=+ii and x1<10 and x2>10 } { 0 0 0 {SCAN TABLE t1 VIRTUAL TABLE INDEX 2:C0E1} 0 1 1 {SEARCH TABLE t2 USING AUTOMATIC COVERING INDEX (v=?)} } +do_eqp_test rtree6.2.4.2 { + SELECT * FROM t1,t2 WHERE v=10 and x1<10 and x2>10 +} { + 0 0 0 {SCAN TABLE t1 VIRTUAL TABLE INDEX 2:C0E1} + 0 1 1 {SCAN TABLE t2} +} do_eqp_test rtree6.2.5 { SELECT * FROM t1,t2 WHERE k=ii AND x1a + pWC->nTerm; for(pTerm=pWC->a; rc==SQLITE_OK && pTermprereqRight & pNew->maskSelf ) continue; - if( pTerm->prereqRight==0 ) continue; + if( pTerm->prereqRight==0 + && sqlite3ExprIsConstant(pTerm->pExpr->pRight) ){ + continue; + } if( termCanDriveIndex(pTerm, pSrc, 0) ){ pNew->u.btree.nEq = 1; pNew->u.btree.nSkip = 0; diff --git a/test/tpch01.test b/test/tpch01.test index 2d099d63fb..ce48f8ec23 100644 --- a/test/tpch01.test +++ b/test/tpch01.test @@ -168,7 +168,10 @@ do_test tpch01-1.1 { } {/0 0 0 {SEARCH TABLE part USING INDEX bootleg_pti .P_TYPE=..} 0 1 2 {SEARCH TABLE lineitem USING INDEX lpki2 .L_PARTKEY=..}.*/} do_test tpch01-1.1b { set ::eqpres -} {/.* customer .* nation AS n1 .* nation AS n2 .*/} +} {/.* customer .* nation AS n1 .*/} +do_test tpch01-1.1c { + set ::eqpres +} {/.* supplier .* nation AS n2 .*/} do_eqp_test tpch01-1.2 { select @@ -185,3 +188,5 @@ group by order by revenue desc; } {0 0 1 {SEARCH TABLE orders USING INDEX odi (O_ORDERDATE>? AND O_ORDERDATE Date: Tue, 17 Jun 2014 09:52:26 +0000 Subject: [PATCH 23/55] Simplification to the logic that prevents automatic indexes from being formed on constant expressions. FossilOrigin-Name: 36d67e1dd2b4f4c22d02f3c3b8d372074de5523a --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/where.c | 5 +---- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 253d4bcb86..17c12ccb2d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allow\san\sautomatic\sindex\son\sa\sWHERE\sconstraint\swhere\sthe\sRHS\sis\sdoes\snot\nreference\sanother\stable\sas\slong\sas\sthe\sRHS\sis\snot\sa\sconstant. -D 2014-06-17T09:00:54.229 +C Simplification\sto\sthe\slogic\sthat\sprevents\sautomatic\sindexes\sfrom\sbeing\sformed\non\sconstant\sexpressions. +D 2014-06-17T09:52:26.975 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c d6a284abd9a1b4c1e617e5208e695cd6f0616ae1 +F src/where.c 3214e390ca5ff0b19fb5084e5bd5870da623389d F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d6883e960f61365729f279a3c1f2c050beb49a55 -R e7b366f668336ead2394408b5846caa4 +P 58acc2a8b38c5f13175c191697b4d2b663db1872 +R 91ed31168e6ce0a5afee4b984323de5e U drh -Z ded0b7f99669cd2fc0f45c3d542cb907 +Z ee443673993fc3ea86368d30ccfb6dad diff --git a/manifest.uuid b/manifest.uuid index df61c8be5b..385f247806 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -58acc2a8b38c5f13175c191697b4d2b663db1872 \ No newline at end of file +36d67e1dd2b4f4c22d02f3c3b8d372074de5523a \ No newline at end of file diff --git a/src/where.c b/src/where.c index 8550231c30..1caaf73df7 100644 --- a/src/where.c +++ b/src/where.c @@ -4529,10 +4529,7 @@ static int whereLoopAddBtree( WhereTerm *pWCEnd = pWC->a + pWC->nTerm; for(pTerm=pWC->a; rc==SQLITE_OK && pTermprereqRight & pNew->maskSelf ) continue; - if( pTerm->prereqRight==0 - && sqlite3ExprIsConstant(pTerm->pExpr->pRight) ){ - continue; - } + if( sqlite3ExprIsConstant(pTerm->pExpr->pRight) ) continue; if( termCanDriveIndex(pTerm, pSrc, 0) ){ pNew->u.btree.nEq = 1; pNew->u.btree.nSkip = 0; From 9740726121e91ec19cc3438844d12cf25eaa2a95 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 17 Jun 2014 12:33:55 +0000 Subject: [PATCH 24/55] A different approach to the autoindex problem that deletes query-planner code rather than adding it. FossilOrigin-Name: f270fb6e9e0b5e77f918081962008c6195ab1e36 --- ext/rtree/rtree6.test | 2 +- manifest | 14 +++++++------- manifest.uuid | 2 +- src/where.c | 10 ++-------- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/ext/rtree/rtree6.test b/ext/rtree/rtree6.test index 9e51993bd8..cec3a8da41 100644 --- a/ext/rtree/rtree6.test +++ b/ext/rtree/rtree6.test @@ -102,7 +102,7 @@ do_eqp_test rtree6.2.4.2 { SELECT * FROM t1,t2 WHERE v=10 and x1<10 and x2>10 } { 0 0 0 {SCAN TABLE t1 VIRTUAL TABLE INDEX 2:C0E1} - 0 1 1 {SCAN TABLE t2} + 0 1 1 {SEARCH TABLE t2 USING AUTOMATIC COVERING INDEX (v=?)} } do_eqp_test rtree6.2.5 { diff --git a/manifest b/manifest index 17c12ccb2d..374e71d7ac 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Simplification\sto\sthe\slogic\sthat\sprevents\sautomatic\sindexes\sfrom\sbeing\sformed\non\sconstant\sexpressions. -D 2014-06-17T09:52:26.975 +C A\sdifferent\sapproach\sto\sthe\sautoindex\sproblem\sthat\sdeletes\squery-planner\scode\nrather\sthan\sadding\sit. +D 2014-06-17T12:33:55.348 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -129,7 +129,7 @@ F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba F ext/rtree/rtree3.test a494da55c30ee0bc9b01a91c80c81b387b22d2dc F ext/rtree/rtree4.test c8fe384f60ebd49540a5fecc990041bf452eb6e0 F ext/rtree/rtree5.test 6a510494f12454bf57ef28f45bc7764ea279431e -F ext/rtree/rtree6.test 83a997caf27eeca990291f66277e5a136428479a +F ext/rtree/rtree6.test 0cfbdf27ee086bf16a3da2c6f2d5b3d6473cb27e F ext/rtree/rtree7.test 1fa710b9e6bf997a0c1a537b81be7bb6fded1971 F ext/rtree/rtree8.test db79c812f9e4a11f9b1f3f9934007884610a713a F ext/rtree/rtree9.test d86ebf08ff6328895613ed577dd8a2a37c472c34 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 3214e390ca5ff0b19fb5084e5bd5870da623389d +F src/where.c cd3110c7dca304ecbdf2ed07b23205e90b10475b F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1177,7 +1177,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 58acc2a8b38c5f13175c191697b4d2b663db1872 -R 91ed31168e6ce0a5afee4b984323de5e +P 36d67e1dd2b4f4c22d02f3c3b8d372074de5523a +R f31fb5c411bc798b3e39eb24696f39dc U drh -Z ee443673993fc3ea86368d30ccfb6dad +Z d63276e1ce6bb05efdbf1c4b12bc995b diff --git a/manifest.uuid b/manifest.uuid index 385f247806..142b9c98b5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -36d67e1dd2b4f4c22d02f3c3b8d372074de5523a \ No newline at end of file +f270fb6e9e0b5e77f918081962008c6195ab1e36 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 1caaf73df7..5fd4618bb1 100644 --- a/src/where.c +++ b/src/where.c @@ -4529,7 +4529,6 @@ static int whereLoopAddBtree( WhereTerm *pWCEnd = pWC->a + pWC->nTerm; for(pTerm=pWC->a; rc==SQLITE_OK && pTermprereqRight & pNew->maskSelf ) continue; - if( sqlite3ExprIsConstant(pTerm->pExpr->pRight) ) continue; if( termCanDriveIndex(pTerm, pSrc, 0) ){ pNew->u.btree.nEq = 1; pNew->u.btree.nSkip = 0; @@ -5279,7 +5278,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ LogEst rCost; /* Cost of a path */ LogEst nOut; /* Number of outputs */ LogEst mxCost = 0; /* Maximum cost of a set of paths */ - LogEst mxOut = 0; /* Maximum nOut value on the set of paths */ int nTo, nFrom; /* Number of valid entries in aTo[] and aFrom[] */ WherePath *aFrom; /* All nFrom paths at the previous level */ WherePath *aTo; /* The nTo best paths at the current level */ @@ -5389,8 +5387,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ for(jj=0, pTo=aTo; jjmaskLoop==maskNew && ((pTo->isOrdered^isOrdered)&80)==0 - && ((pTo->rCost<=rCost && pTo->nRow<=nOut) || - (pTo->rCost>=rCost && pTo->nRow>=nOut)) ){ testcase( jj==nTo-1 ); break; @@ -5424,7 +5420,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ } #endif }else{ - if( pTo->rCost<=rCost && pTo->nRow<=nOut ){ + if( pTo->rCost<=rCost ){ #ifdef WHERETRACE_ENABLED /* 0x4 */ if( sqlite3WhereTrace&0x4 ){ sqlite3DebugPrintf( @@ -5464,11 +5460,9 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ if( nTo>=mxChoice ){ mxI = 0; mxCost = aTo[0].rCost; - mxOut = aTo[0].nRow; for(jj=1, pTo=&aTo[1]; jjrCost>mxCost || (pTo->rCost==mxCost && pTo->nRow>mxOut) ){ + if( pTo->rCost>mxCost ){ mxCost = pTo->rCost; - mxOut = pTo->nRow; mxI = jj; } } From 2daa64cd631078a0c3c01be1c857de4d2eea1b28 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 17 Jun 2014 13:23:36 +0000 Subject: [PATCH 25/55] Add the autoindex2.test testing module. FossilOrigin-Name: ffe3fea47b8ba8ec4557f68243ef3ef5aac00dfd --- manifest | 11 +- manifest.uuid | 2 +- test/autoindex2.test | 271 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 278 insertions(+), 6 deletions(-) create mode 100644 test/autoindex2.test diff --git a/manifest b/manifest index 374e71d7ac..49473453ec 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C A\sdifferent\sapproach\sto\sthe\sautoindex\sproblem\sthat\sdeletes\squery-planner\scode\nrather\sthan\sadding\sit. -D 2014-06-17T12:33:55.348 +C Add\sthe\sautoindex2.test\stesting\smodule. +D 2014-06-17T13:23:36.416 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -335,6 +335,7 @@ F test/auth2.test c3b415b76c033bedb81292118fb7c01f5f10cbcd F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5 F test/autoinc.test c58912526998a39e11f66b533e23cfabea7f25b7 F test/autoindex1.test 762ff3f8e25d852aae55c6462ca166a80c0cde61 +F test/autoindex2.test 60d2fc6f38364308ce73a9beb01b47ded38697de F test/autovacuum.test 941892505d2c0f410a0cb5970dfa1c7c4e5f6e74 F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4 F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85 @@ -1177,7 +1178,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 36d67e1dd2b4f4c22d02f3c3b8d372074de5523a -R f31fb5c411bc798b3e39eb24696f39dc +P f270fb6e9e0b5e77f918081962008c6195ab1e36 +R 4590197fe44138640af30c15c42aaab1 U drh -Z d63276e1ce6bb05efdbf1c4b12bc995b +Z c2b8b2abeb08d5199560396ab0f820e5 diff --git a/manifest.uuid b/manifest.uuid index 142b9c98b5..843a903c19 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f270fb6e9e0b5e77f918081962008c6195ab1e36 \ No newline at end of file +ffe3fea47b8ba8ec4557f68243ef3ef5aac00dfd \ No newline at end of file diff --git a/test/autoindex2.test b/test/autoindex2.test new file mode 100644 index 0000000000..f4da416745 --- /dev/null +++ b/test/autoindex2.test @@ -0,0 +1,271 @@ +# 2014-06-17 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#************************************************************************* +# +# This file implements regression tests for SQLite library. The +# focus of this script is testing automatic index creation logic. +# +# This file contains a single real-world test case that was giving +# suboptimal performance because of over-use of automatic indexes. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + + +do_execsql_test autoindex2-100 { + CREATE TABLE t1( + t1_id largeint, + did char(9), + ptime largeint, + exbyte char(4), + pe_id int, + field_id int, + mass float, + param10 float, + param11 float, + exmass float, + deviation float, + trange float, + vstatus int, + commit_status int, + formula char(329), + tier int DEFAULT 2, + ssid int DEFAULT 0, + last_operation largeint DEFAULT 0, + admin_uuid int DEFAULT 0, + previous_value float, + job_id largeint, + last_t1 largeint DEFAULT 0, + data_t1 int, + previous_date largeint DEFAULT 0, + flg8 int DEFAULT 1, + failed_fields char(100) + ); + CREATE INDEX t1x0 on t1 (t1_id); + CREATE INDEX t1x1 on t1 (ptime, vstatus); + CREATE INDEX t1x2 on t1 (did, ssid, ptime, vstatus, exbyte, t1_id); + CREATE INDEX t1x3 on t1 (job_id); + + CREATE TABLE t2( + did char(9), + client_did char(30), + description char(49), + uid int, + tzid int, + privilege int, + param2 int, + type char(30), + subtype char(32), + dparam1 char(7) DEFAULT '', + param5 char(3) DEFAULT '', + notional float DEFAULT 0.000000, + create_time largeint, + sample_time largeint DEFAULT 0, + param6 largeint, + frequency int, + expiration largeint, + uw_status int, + next_sample largeint, + last_sample largeint, + reserve1 char(29) DEFAULT '', + reserve2 char(29) DEFAULT '', + reserve3 char(29) DEFAULT '', + bxcdr char(19) DEFAULT 'XY', + ssid int DEFAULT 1, + last_t1_id largeint, + reserve4 char(29) DEFAULT '', + reserve5 char(29) DEFAULT '', + param12 int DEFAULT 0, + long_did char(100) DEFAULT '', + gr_code int DEFAULT 0, + drx char(100) DEFAULT '', + parent_id char(9) DEFAULT '', + param13 int DEFAULT 0, + position float DEFAULT 1.000000, + client_did3 char(100) DEFAULT '', + client_did4 char(100) DEFAULT '', + dlib_id char(9) DEFAULT '' + ); + CREATE INDEX t2x0 on t2 (did); + CREATE INDEX t2x1 on t2 (client_did); + CREATE INDEX t2x2 on t2 (long_did); + CREATE INDEX t2x3 on t2 (uid); + CREATE INDEX t2x4 on t2 (param2); + CREATE INDEX t2x5 on t2 (type); + CREATE INDEX t2x6 on t2 (subtype); + CREATE INDEX t2x7 on t2 (last_sample); + CREATE INDEX t2x8 on t2 (param6); + CREATE INDEX t2x9 on t2 (frequency); + CREATE INDEX t2x10 on t2 (privilege); + CREATE INDEX t2x11 on t2 (sample_time); + CREATE INDEX t2x12 on t2 (notional); + CREATE INDEX t2x13 on t2 (tzid); + CREATE INDEX t2x14 on t2 (gr_code); + CREATE INDEX t2x15 on t2 (parent_id); + + CREATE TABLE t3( + uid int, + param3 int, + uuid int, + acc_id int, + cust_num int, + numerix_id int, + pfy char(29), + param4 char(29), + param15 int DEFAULT 0, + flg7 int DEFAULT 0, + param21 int DEFAULT 0, + bxcdr char(2) DEFAULT 'PC', + c31 int DEFAULT 0, + c33 int DEFAULT 0, + c35 int DEFAULT 0, + c37 int, + mgr_uuid int, + back_up_uuid int, + priv_mars int DEFAULT 0, + is_qc int DEFAULT 0, + c41 int DEFAULT 0, + deleted int DEFAULT 0, + c47 int DEFAULT 1 + ); + CREATE INDEX t3x0 on t3 (uid); + CREATE INDEX t3x1 on t3 (param3); + CREATE INDEX t3x2 on t3 (uuid); + CREATE INDEX t3x3 on t3 (acc_id); + CREATE INDEX t3x4 on t3 (param4); + CREATE INDEX t3x5 on t3 (pfy); + CREATE INDEX t3x6 on t3 (is_qc); + SELECT count(*) FROM sqlite_master; +} {30} +do_execsql_test autoindex2-110 { + ANALYZE sqlite_master; + INSERT INTO sqlite_stat1 VALUES('t1','t1x3','10747267 260'); + INSERT INTO sqlite_stat1 VALUES('t1','t1x2','10747267 121 113 2 2 2 1'); + INSERT INTO sqlite_stat1 VALUES('t1','t1x1','10747267 50 40'); + INSERT INTO sqlite_stat1 VALUES('t1','t1x0','10747267 1'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x15','39667 253'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x14','39667 19834'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x13','39667 13223'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x12','39667 7'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x11','39667 17'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x10','39667 19834'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x9','39667 7934'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x8','39667 11'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x7','39667 5'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x6','39667 242'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x5','39667 1984'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x4','39667 4408'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x3','39667 81'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x2','39667 551'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x1','39667 2'); + INSERT INTO sqlite_stat1 VALUES('t2','t2x0','39667 1'); + INSERT INTO sqlite_stat1 VALUES('t3','t3x6','569 285'); + INSERT INTO sqlite_stat1 VALUES('t3','t3x5','569 2'); + INSERT INTO sqlite_stat1 VALUES('t3','t3x4','569 2'); + INSERT INTO sqlite_stat1 VALUES('t3','t3x3','569 5'); + INSERT INTO sqlite_stat1 VALUES('t3','t3x2','569 3'); + INSERT INTO sqlite_stat1 VALUES('t3','t3x1','569 6'); + INSERT INTO sqlite_stat1 VALUES('t3','t3x0','569 1'); + ANALYZE sqlite_master; +} {} +do_execsql_test autoindex2-120 { + EXPLAIN QUERY PLAN + SELECT + t1_id, + t1.did, + param2, + param3, + t1.ptime, + t1.trange, + t1.exmass, + t1.mass, + t1.vstatus, + type, + subtype, + t1.deviation, + t1.formula, + dparam1, + reserve1, + reserve2, + param4, + t1.last_operation, + t1.admin_uuid, + t1.previous_value, + t1.job_id, + client_did, + t1.last_t1, + t1.data_t1, + t1.previous_date, + param5, + param6, + mgr_uuid + FROM + t1, + t2, + t3 + WHERE + t1.ptime > 1393520400 + AND param3<>9001 + AND t3.flg7 = 1 + AND t1.did = t2.did + AND t2.uid = t3.uid + ORDER BY t1.ptime desc LIMIT 500; +} {0 0 0 {SEARCH TABLE t1 USING INDEX t1x1 (ptime>?)} 0 1 1 {SEARCH TABLE t2 USING INDEX t2x0 (did=?)} 0 2 2 {SEARCH TABLE t3 USING INDEX t3x0 (uid=?)}} +# +# ^^^--- Before being fixed, the above was using an automatic covering +# on t3 and reordering the tables so that t3 was in the outer loop and +# implementing the ORDER BY clause using a B-Tree. + +do_execsql_test autoindex2-120 { + EXPLAIN QUERY PLAN + SELECT + t1_id, + t1.did, + param2, + param3, + t1.ptime, + t1.trange, + t1.exmass, + t1.mass, + t1.vstatus, + type, + subtype, + t1.deviation, + t1.formula, + dparam1, + reserve1, + reserve2, + param4, + t1.last_operation, + t1.admin_uuid, + t1.previous_value, + t1.job_id, + client_did, + t1.last_t1, + t1.data_t1, + t1.previous_date, + param5, + param6, + mgr_uuid + FROM + t3, + t2, + t1 + WHERE + t1.ptime > 1393520400 + AND param3<>9001 + AND t3.flg7 = 1 + AND t1.did = t2.did + AND t2.uid = t3.uid + ORDER BY t1.ptime desc LIMIT 500; +} {0 0 2 {SEARCH TABLE t1 USING INDEX t1x1 (ptime>?)} 0 1 1 {SEARCH TABLE t2 USING INDEX t2x0 (did=?)} 0 2 0 {SEARCH TABLE t3 USING INDEX t3x0 (uid=?)}} + +finish_test From 03202a97f83374ff51a763ce0bd131246708fae5 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 17 Jun 2014 16:11:28 +0000 Subject: [PATCH 26/55] Add the likely() function for symmetry with unlikely(). The likely(X) function means the same thing as likelihood(X,0.9375). FossilOrigin-Name: 38965484199153e3e5b999f5196c1d66e5296f60 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/func.c | 1 + src/resolve.c | 3 ++- test/func3.test | 26 +++++++++++++++++++++++++- test/whereG.test | 12 ++++++++++-- 6 files changed, 48 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index bf5d942926..fb571a7c97 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improvements\sto\squery\splanning,\sespecially\sin\sregards\sto\sestimating\sthe\ncost\sand\sbenefit\sof\sautomatic\sindexes. -D 2014-06-17T15:53:33.099 +C Add\sthe\slikely()\sfunction\sfor\ssymmetry\swith\sunlikely().\s\sThe\slikely(X)\nfunction\smeans\sthe\ssame\sthing\sas\slikelihood(X,0.9375). +D 2014-06-17T16:11:28.353 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -179,7 +179,7 @@ F src/delete.c bcf8f72126cea80fc3d5bc5494cf19b3f8935aaf F src/expr.c 4f9e497c66e2f25a4d139357a778c84d5713207c F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c a549cff9fe8b736cdae21650ea0af6de29b77619 -F src/func.c 2e16316ec3a6365a0dc3e553c586f91b20f7f6c8 +F src/func.c 3bc223ea36cd29a91c481485343d0ee4257ab8dc F src/global.c 1e4bd956dc2f608f87d2a929abc4a20db65f30e4 F src/hash.c d139319967164f139c8d1bb8a11b14db9c4ba3cd F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22 @@ -220,7 +220,7 @@ F src/pragma.c 810ef31ccfaa233201dcf100637a9777cc24e897 F src/prepare.c 677521ab7132615a8a26107a1d1c3132f44ae337 F src/printf.c af06f66927919730f03479fed6ae9854f73419f4 F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece -F src/resolve.c 273d5f47c4e2c05b2d3d2bffeda939551ab59e66 +F src/resolve.c 5fc110baeacf120a73fe34e103f052632ff11a02 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c 6762c62e11b504aa014edceab8886495165e3a77 F src/shell.c 058940e8a7198ea15ae90f60ffb0e2d67287b46c @@ -587,7 +587,7 @@ F test/fts4unicode.test 01ec3fe2a7c3cfff3b4c0581b83caa11b33efa36 F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d F test/func.test ae97561957aba6ca9e3a7b8a13aac41830d701ef F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f -F test/func3.test dbccee9133cfef1473c59ec07b5f0262b9d72f9a +F test/func3.test e82d16b13739f1a0c5efb20048583c79b767b625 F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f F test/func5.test cdd224400bc3e48d891827cc913a57051a426fa4 F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74 @@ -1108,7 +1108,7 @@ F test/whereC.test d6f4ecd4fa2d9429681a5b22a25d2bda8e86ab8a F test/whereD.test fd9120e262f9da3c45940f52aefeef4d15b904e5 F test/whereE.test b3a055eef928c992b0a33198a7b8dc10eea5ad2f F test/whereF.test 5b2ba0dbe8074aa13e416b37c753991f0a2492d7 -F test/whereG.test 0ac23e5e8311b69d87245f4a85112de321031658 +F test/whereG.test 69f5ec4b15760a8c860f80e2d55525669390aab3 F test/whereH.test e4b07f7a3c2f5d31195cd33710054c78667573b2 F test/whereI.test 1d89199697919d4930be05a71e7fe620f114e622 F test/whereJ.test 7dde28284d20f358b559ca592e294db03e1d7103 @@ -1178,7 +1178,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P fc918f7d332b8f7cabc79a0f1586bd6760d14d40 ffe3fea47b8ba8ec4557f68243ef3ef5aac00dfd -R 4590197fe44138640af30c15c42aaab1 +P 1272fb8991b3888c72dcebf947415883d7727241 +R c1d0749541351617b104ca64007ba8f1 U drh -Z e1065b9ffc1f6e99c7ac540aed1bd3ee +Z 26a05503f7dd3e6c9f856a3872db5b5a diff --git a/manifest.uuid b/manifest.uuid index 56bcfd55a5..50d789e8ee 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1272fb8991b3888c72dcebf947415883d7727241 \ No newline at end of file +38965484199153e3e5b999f5196c1d66e5296f60 \ No newline at end of file diff --git a/src/func.c b/src/func.c index bc5c78981e..efbb3efbb7 100644 --- a/src/func.c +++ b/src/func.c @@ -1691,6 +1691,7 @@ void sqlite3RegisterGlobalFunctions(void){ FUNCTION2(ifnull, 2, 0, 0, noopFunc, SQLITE_FUNC_COALESCE), FUNCTION2(unlikely, 1, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY), FUNCTION2(likelihood, 2, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY), + FUNCTION2(likely, 1, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY), VFUNCTION(random, 0, 0, 0, randomFunc ), VFUNCTION(randomblob, 1, 0, 0, randomBlob ), FUNCTION(nullif, 2, 0, 1, nullifFunc ), diff --git a/src/resolve.c b/src/resolve.c index 86169c51c1..ce26f00c66 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -711,7 +711,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ ** likelihood(X, 0.0625). ** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is short-hand for ** likelihood(X,0.0625). */ - pExpr->iTable = 62; /* TUNING: Default 2nd arg to unlikely() is 0.0625 */ + /* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */ + pExpr->iTable = pDef->zName[0]=='u' ? 62 : 938; } } } diff --git a/test/func3.test b/test/func3.test index 2a2b7be4f4..b5a082a4ca 100644 --- a/test/func3.test +++ b/test/func3.test @@ -149,8 +149,32 @@ do_execsql_test func3-5.35 { # the code generator optimizes away so that it consumes no CPU cycles at # run-time (that is, during calls to sqlite3_step()). # -do_test func3-5.40 { +do_test func3-5.39 { db eval {EXPLAIN SELECT unlikely(min(1.0+'2.0',4*11))} } [db eval {EXPLAIN SELECT min(1.0+'2.0',4*11)}] +do_execsql_test func3-5.40 { + SELECT likely(9223372036854775807); +} {9223372036854775807} +do_execsql_test func3-5.41 { + SELECT likely(-9223372036854775808); +} {-9223372036854775808} +do_execsql_test func3-5.42 { + SELECT likely(14.125); +} {14.125} +do_execsql_test func3-5.43 { + SELECT likely(NULL); +} {{}} +do_execsql_test func3-5.44 { + SELECT likely('test-string'); +} {test-string} +do_execsql_test func3-5.45 { + SELECT quote(likely(x'010203000405')); +} {X'010203000405'} +do_test func3-5.49 { + db eval {EXPLAIN SELECT likely(min(1.0+'2.0',4*11))} +} [db eval {EXPLAIN SELECT min(1.0+'2.0',4*11)}] + + + finish_test diff --git a/test/whereG.test b/test/whereG.test index 66918a35fa..c2c54db455 100644 --- a/test/whereG.test +++ b/test/whereG.test @@ -9,7 +9,7 @@ # #*********************************************************************** # -# Test cases for query planning decisions and the unlikely() and +# Test cases for query planning decisions and the likely(), unlikely(), and # likelihood() functions. set testdir [file dirname $argv0] @@ -199,6 +199,9 @@ do_eqp_test 5.1.2 { do_eqp_test 5.1.3 { SELECT * FROM t1 WHERE likelihood(a>?, 0.9) } {0 0 0 {SCAN TABLE t1}} +do_eqp_test 5.1.4 { + SELECT * FROM t1 WHERE likely(a>?) +} {0 0 0 {SCAN TABLE t1}} do_test 5.2 { for {set i 0} {$i < 100} {incr i} { @@ -213,6 +216,9 @@ do_eqp_test 5.2.2 { do_eqp_test 5.2.3 { SELECT * FROM t1 WHERE likelihood(b>?, 0.9) } {0 0 0 {SCAN TABLE t1}} +do_eqp_test 5.2.4 { + SELECT * FROM t1 WHERE likely(b>?) +} {0 0 0 {SCAN TABLE t1}} do_eqp_test 5.3.1 { SELECT * FROM t1 WHERE a=? @@ -220,6 +226,8 @@ do_eqp_test 5.3.1 { do_eqp_test 5.3.2 { SELECT * FROM t1 WHERE likelihood(a=?, 0.9) } {0 0 0 {SCAN TABLE t1}} +do_eqp_test 5.3.3 { + SELECT * FROM t1 WHERE likely(a=?) +} {0 0 0 {SCAN TABLE t1}} finish_test - From ef3ad02d90eb16c51c3f0baa81b3976b6b60f1d2 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 17 Jun 2014 17:00:42 +0000 Subject: [PATCH 27/55] Fix a missing space in a "wheretrace" comment. No changes to production code. FossilOrigin-Name: b500f2a09721b49c95a69c47a0205bc2375af2cd --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/where.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index fb571a7c97..8cea868013 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\slikely()\sfunction\sfor\ssymmetry\swith\sunlikely().\s\sThe\slikely(X)\nfunction\smeans\sthe\ssame\sthing\sas\slikelihood(X,0.9375). -D 2014-06-17T16:11:28.353 +C Fix\sa\smissing\sspace\sin\sa\s"wheretrace"\scomment.\s\sNo\schanges\sto\sproduction\scode. +D 2014-06-17T17:00:42.928 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c cd3110c7dca304ecbdf2ed07b23205e90b10475b +F src/where.c 7f59d3786a41ccb8d76148405f76c31658527c08 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1178,7 +1178,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 1272fb8991b3888c72dcebf947415883d7727241 -R c1d0749541351617b104ca64007ba8f1 +P 38965484199153e3e5b999f5196c1d66e5296f60 +R 8d914acb455fa768c8bfdec56d9704e4 U drh -Z 26a05503f7dd3e6c9f856a3872db5b5a +Z d423ee25f70180aacb18e67f6dbb4662 diff --git a/manifest.uuid b/manifest.uuid index 50d789e8ee..0e6051ab6d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -38965484199153e3e5b999f5196c1d66e5296f60 \ No newline at end of file +b500f2a09721b49c95a69c47a0205bc2375af2cd \ No newline at end of file diff --git a/src/where.c b/src/where.c index 5fd4618bb1..1865871eda 100644 --- a/src/where.c +++ b/src/where.c @@ -4053,7 +4053,7 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ *ppTail = pToDel->pNextLoop; #if WHERETRACE_ENABLED /* 0x8 */ if( sqlite3WhereTrace & 0x8 ){ - sqlite3DebugPrintf("ins-del: "); + sqlite3DebugPrintf("ins-del: "); whereLoopPrint(pToDel, pBuilder->pWC); } #endif From dabe36d9dd98f9daea843606b22cd0af9cdcfbaa Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 17 Jun 2014 20:16:43 +0000 Subject: [PATCH 28/55] Prevent an automatic index from taking the place of a declared index. FossilOrigin-Name: 4ece839d445ff578a449a339ab579a32e64c9d28 --- manifest | 13 +++++----- manifest.uuid | 2 +- src/where.c | 13 +++++++++- test/autoindex3.test | 58 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 test/autoindex3.test diff --git a/manifest b/manifest index 49473453ec..3e9fb58638 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sautoindex2.test\stesting\smodule. -D 2014-06-17T13:23:36.416 +C Prevent\san\sautomatic\sindex\sfrom\staking\sthe\splace\sof\sa\sdeclared\sindex. +D 2014-06-17T20:16:43.699 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c cd3110c7dca304ecbdf2ed07b23205e90b10475b +F src/where.c 0035f45de6a2f248e2ac57da16460858b2166089 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -336,6 +336,7 @@ F test/auth3.test a4755e6a2a2fea547ffe63c874eb569e60a28eb5 F test/autoinc.test c58912526998a39e11f66b533e23cfabea7f25b7 F test/autoindex1.test 762ff3f8e25d852aae55c6462ca166a80c0cde61 F test/autoindex2.test 60d2fc6f38364308ce73a9beb01b47ded38697de +F test/autoindex3.test 8254f689c3241081fad52b7bea18ba53e07e14a2 F test/autovacuum.test 941892505d2c0f410a0cb5970dfa1c7c4e5f6e74 F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4 F test/avtrans.test 0252654f4295ddda3b2cce0e894812259e655a85 @@ -1178,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f270fb6e9e0b5e77f918081962008c6195ab1e36 -R 4590197fe44138640af30c15c42aaab1 +P ffe3fea47b8ba8ec4557f68243ef3ef5aac00dfd +R b60de90301b6f096aa7fa9280f014db5 U drh -Z c2b8b2abeb08d5199560396ab0f820e5 +Z 58155d377c73e3b2e02e7af08e490e72 diff --git a/manifest.uuid b/manifest.uuid index 843a903c19..175b6dda01 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ffe3fea47b8ba8ec4557f68243ef3ef5aac00dfd \ No newline at end of file +4ece839d445ff578a449a339ab579a32e64c9d28 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 5fd4618bb1..20100662a3 100644 --- a/src/where.c +++ b/src/where.c @@ -3923,6 +3923,17 @@ static WhereLoop **whereLoopFindLesser( ** rSetup. Call this SETUP-INVARIANT */ assert( p->rSetup>=pTemplate->rSetup ); + /* Any loop using an appliation-defined index (or PRIMARY KEY or + ** UNIQUE constraint) with one or more == constraints is better + ** than an automatic index. */ + if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 + && (pTemplate->wsFlags & WHERE_INDEXED)!=0 + && (pTemplate->wsFlags & WHERE_COLUMN_EQ)!=0 + && (p->prereq & pTemplate->prereq)==pTemplate->prereq + ){ + break; + } + /* If existing WhereLoop p is better than pTemplate, pTemplate can be ** discarded. WhereLoop p is better if: ** (1) p has no more dependencies than pTemplate, and @@ -4047,7 +4058,7 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ WhereLoop *pToDel; while( *ppTail ){ ppTail = whereLoopFindLesser(ppTail, pTemplate); - if( NEVER(ppTail==0) ) break; + if( ppTail==0 ) break; pToDel = *ppTail; if( pToDel==0 ) break; *ppTail = pToDel->pNextLoop; diff --git a/test/autoindex3.test b/test/autoindex3.test new file mode 100644 index 0000000000..33053bba67 --- /dev/null +++ b/test/autoindex3.test @@ -0,0 +1,58 @@ +# 2014-06-17 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#************************************************************************* +# +# This file implements regression tests for SQLite library. The +# focus of this script is testing automatic index creation logic, +# and specifically that an automatic index will not be created that +# shadows a declared index. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# The t1b and t2d indexes are not very selective. It used to be that +# the autoindex mechanism would create automatic indexes on t1(b) or +# t2(d), make assumptions that they were reasonably selective, and use +# them instead of t1b or t2d. But that would be cheating, because the +# automatic index cannot be any more selective than the real index. +# +# This test verifies that the cheat is no longer allowed. +# +do_execsql_test autoindex3-100 { + CREATE TABLE t1(a,b,x); + CREATE TABLE t2(c,d,y); + CREATE INDEX t1b ON t1(b); + CREATE INDEX t2d ON t2(d); + ANALYZE sqlite_master; + INSERT INTO sqlite_stat1 VALUES('t1','t1b','10000 500'); + INSERT INTO sqlite_stat1 VALUES('t2','t2d','10000 500'); + ANALYZE sqlite_master; + EXPLAIN QUERY PLAN SELECT * FROM t1, t2 WHERE d=b; +} {~/AUTO/} + +# Automatic indexes can still be used if existing indexes do not +# participate in == constraints. +# +do_execsql_test autoindex3-110 { + EXPLAIN QUERY PLAN SELECT * FROM t1, t2 WHERE d>b AND x=y; +} {/AUTO/} +do_execsql_test autoindex3-120 { + EXPLAIN QUERY PLAN SELECT * FROM t1, t2 WHERE d Date: Wed, 18 Jun 2014 15:24:40 +0000 Subject: [PATCH 29/55] Fix a comment on the sqlite3Utf8Read() routine. No changes to code. FossilOrigin-Name: 5e514f6acebcfad4f18300d1a34f4917f1a746d9 --- manifest | 13 ++++++------- manifest.uuid | 2 +- src/utf.c | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index e6ed1d11b8..970aaa677e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Prevent\san\sautomatic\sindex\sfrom\staking\sthe\splace\sof\sa\sdeclared\sindex. -D 2014-06-18T15:11:54.897 +C Fix\sa\scomment\son\sthe\ssqlite3Utf8Read()\sroutine.\s\sNo\schanges\sto\scode. +D 2014-06-18T15:24:40.324 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -280,7 +280,7 @@ F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 6da2de6e12218ccb0aea5184b56727d011f4bee7 F src/trigger.c 66f3470b03b52b395e839155786966e3e037fddb F src/update.c 01564b3c430f6c7b0a35afaf7aba7987206fa3a5 -F src/utf.c 6dc9ec9f1b3db43ae8ba0365377f11df1ee4c01c +F src/utf.c a0314e637768a030e6e84a957d0c4f6ba910cc05 F src/util.c 049fe1d3c0e2209c1bee107aec2fcff6285f909f F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179 F src/vdbe.c 9bfe6becfc094382ae213656fbe511055ad83a54 @@ -1179,8 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b500f2a09721b49c95a69c47a0205bc2375af2cd 4ece839d445ff578a449a339ab579a32e64c9d28 -R 1a9a8498bcd344a9075e008919374ef9 -T +closed 4ece839d445ff578a449a339ab579a32e64c9d28 +P 0a52bddd9db49b2b79fc24888b50023d0fe74f7b +R 1483fc05b60a54244db236c2feca8e58 U drh -Z c3c3ed7d30575f073ff51d887a334d78 +Z 0243b0be22165644a3d48f8093dd6d50 diff --git a/manifest.uuid b/manifest.uuid index 585f159241..0488c4af6b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0a52bddd9db49b2b79fc24888b50023d0fe74f7b \ No newline at end of file +5e514f6acebcfad4f18300d1a34f4917f1a746d9 \ No newline at end of file diff --git a/src/utf.c b/src/utf.c index 96b679fff4..97898746a2 100644 --- a/src/utf.c +++ b/src/utf.c @@ -148,8 +148,8 @@ static const unsigned char sqlite3Utf8Trans1[] = { ** and rendered as themselves even though they are technically ** invalid characters. ** -** * This routine accepts an infinite number of different UTF8 encodings -** for unicode values 0x80 and greater. It do not change over-length +** * This routine accepts over-length UTF8 encodings +** for unicode values 0x80 and greater. It does not change over-length ** encodings to 0xfffd as some systems recommend. */ #define READ_UTF8(zIn, zTerm, c) \ From 267a13fd47741e88b5559526ef6680a6b9c44550 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 18 Jun 2014 18:10:12 +0000 Subject: [PATCH 30/55] Add the "LogEst" and "LogEst.exe" target to the makefiles. FossilOrigin-Name: 7b91b0581d169a353462d96120a2e0d4dcc8e8ae --- Makefile.in | 3 +++ Makefile.msc | 3 +++ main.mk | 3 +++ manifest | 16 ++++++++-------- manifest.uuid | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile.in b/Makefile.in index 920f3d893d..72f7cfc007 100644 --- a/Makefile.in +++ b/Makefile.in @@ -942,6 +942,9 @@ sqlite3_analyzer$(TEXE): sqlite3_analyzer.c showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.c $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.c $(TLIBS) +LogEst$(TEXE): $(TOP)/tool/logest.c sqlite3.h + $(LTLINK) -I. -o $@ $(TOP)/tool/logest.c + wordcount$(TEXE): $(TOP)/test/wordcount.c sqlite3.c $(LTLINK) -o $@ $(TOP)/test/wordcount.c sqlite3.c $(TLIBS) diff --git a/Makefile.msc b/Makefile.msc index fce958b947..409f7b3d28 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1435,6 +1435,9 @@ showdb.exe: $(TOP)\tool\showdb.c $(SQLITE3C) $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ $(TOP)\tool\showdb.c $(SQLITE3C) +LogEst.exe: $(TOP)\tool\logest.c sqlite3.h + $(LTLINK) -Fe$@ $(TOP)\tool\LogEst.c + wordcount.exe: $(TOP)\test\wordcount.c $(SQLITE3C) $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ $(TOP)\test\wordcount.c $(SQLITE3C) diff --git a/main.mk b/main.mk index 3076229d5e..30149eccab 100644 --- a/main.mk +++ b/main.mk @@ -632,6 +632,9 @@ showdb$(EXE): $(TOP)/tool/showdb.c sqlite3.c $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showdb$(EXE) \ $(TOP)/tool/showdb.c sqlite3.c +LogEst$(EXE): $(TOP)/tool/logest.c sqlite3.h + $(TCC) -o LogEst$(EXE) $(TOP)/tool/logest.c + wordcount$(EXE): $(TOP)/test/wordcount.c sqlite3.c $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o wordcount$(EXE) \ $(TOP)/test/wordcount.c sqlite3.c diff --git a/manifest b/manifest index 970aaa677e..e4246ebcc8 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Fix\sa\scomment\son\sthe\ssqlite3Utf8Read()\sroutine.\s\sNo\schanges\sto\scode. -D 2014-06-18T15:24:40.324 +C Add\sthe\s"LogEst"\sand\s"LogEst.exe"\starget\sto\sthe\smakefiles. +D 2014-06-18T18:10:12.200 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in ed5e4aae4799f724699d5509fac2977786414dbb +F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc b5ff082a24cd1e0694a0001891e13e3b56c8ef31 +F Makefile.msc b2d3ac211b479fa5a6c9aaf3b9c49fdea900d228 F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 F VERSION 9f823c026c6a32fc5f84d212a8aae0a221dba45c @@ -146,7 +146,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 0cb97ec3285474651736053ee741145ef8c5185f +F main.mk 7b1d0be0840f213405c977c87917241158126a33 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -1179,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 0a52bddd9db49b2b79fc24888b50023d0fe74f7b -R 1483fc05b60a54244db236c2feca8e58 +P 5e514f6acebcfad4f18300d1a34f4917f1a746d9 +R 608fed792452245bc29949099b24055c U drh -Z 0243b0be22165644a3d48f8093dd6d50 +Z 8ecf2902c498abf367d738a353cfaa20 diff --git a/manifest.uuid b/manifest.uuid index 0488c4af6b..858eff2d28 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5e514f6acebcfad4f18300d1a34f4917f1a746d9 \ No newline at end of file +7b91b0581d169a353462d96120a2e0d4dcc8e8ae \ No newline at end of file From 6a30cd5a446405d19b047de984d78c048da4ae08 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 19 Jun 2014 23:38:53 +0000 Subject: [PATCH 31/55] Add the ability to decode the headers of individual cells, byte-by-byte, in the "showdb.exe" utility. FossilOrigin-Name: 306b461d7c0643b6ac4df944759ecc9ce8581634 --- manifest | 12 ++-- manifest.uuid | 2 +- tool/showdb.c | 168 +++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 159 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index e4246ebcc8..d6ee27e4ac 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s"LogEst"\sand\s"LogEst.exe"\starget\sto\sthe\smakefiles. -D 2014-06-18T18:10:12.200 +C Add\sthe\sability\sto\sdecode\sthe\sheaders\sof\sindividual\scells,\sbyte-by-byte,\nin\sthe\s"showdb.exe"\sutility. +D 2014-06-19T23:38:53.722 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1158,7 +1158,7 @@ F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 -F tool/showdb.c 1f3fe634d6f690b8d39ab1b9fd34583d468921e1 +F tool/showdb.c c080dea3addc8440191aef2c7cf222ee7959529c F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02 F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe @@ -1179,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 5e514f6acebcfad4f18300d1a34f4917f1a746d9 -R 608fed792452245bc29949099b24055c +P 7b91b0581d169a353462d96120a2e0d4dcc8e8ae +R 80dc9f5b1256cb0818cbd9270f47db96 U drh -Z 8ecf2902c498abf367d738a353cfaa20 +Z ec7d321d3c2511a642cbe0539a129858 diff --git a/manifest.uuid b/manifest.uuid index 858eff2d28..204ffc59ee 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7b91b0581d169a353462d96120a2e0d4dcc8e8ae \ No newline at end of file +306b461d7c0643b6ac4df944759ecc9ce8581634 \ No newline at end of file diff --git a/tool/showdb.c b/tool/showdb.c index 4d274a7aac..d4e26f45c1 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -129,6 +129,7 @@ static void print_page(int iPg){ free(aData); } + /* Print a line of decode output showing a 4-byte integer. */ static void print_decode_line( @@ -341,6 +342,120 @@ static int describeCell( return nLocal+n; } +/* Print an offset followed by nByte bytes. Add extra white-space +** at the end so that subsequent text is aligned. +*/ +static void printBytes( + unsigned char *aData, /* Content being decoded */ + unsigned char *aStart, /* Start of content to be printed */ + int nByte /* Number of bytes to print */ +){ + int j; + printf(" %03x: ", (int)(aStart-aData)); + for(j=0; j<9; j++){ + if( j>=nByte ){ + printf(" "); + }else{ + printf("%02x ", aStart[j]); + } + } +} + + +/* +** Write a full decode on stdout for the cell at a[ofst]. +** Assume the page contains a header of size szPgHdr bytes. +*/ +static void decodeCell( + unsigned char *a, /* Page content (without the page-1 header) */ + unsigned pgno, /* Page number */ + int iCell, /* Cell index */ + int szPgHdr, /* Size of the page header. 0 or 100 */ + int ofst /* Cell begins at a[ofst] */ +){ + int i, j, k; + int leftChild; + i64 nPayload; + i64 rowid; + i64 nHdr; + i64 iType; + int nLocal; + unsigned char *x = a + ofst; + unsigned char *end; + unsigned char cType = a[0]; + + printf("Decode cell[%d] on page %d offset %04x....\n", + iCell, pgno, szPgHdr+ofst); + if( cType<=5 ){ + leftChild = ((x[0]*256 + x[1])*256 + x[2])*256 + x[3]; + printBytes(a, x, 4); + printf("left child page:: %d\n", leftChild); + x += 4; + } + if( cType!=5 ){ + i = decodeVarint(x, &nPayload); + printBytes(a, x, i); + nLocal = localPayload(nPayload, cType); + printf("bytes of payload: %d (local: %d)\n", (int)nPayload, nLocal); + x += i; + }else{ + nPayload = nLocal = 0; + } + end = x + nLocal; + if( cType==5 || cType==13 ){ + i = decodeVarint(x, &rowid); + printBytes(a, x, i); + printf("rowid: %lld\n", rowid); + x += i; + } + if( nLocal>0 ){ + i = decodeVarint(x, &nHdr); + printBytes(a, x, i); + printf("record header size: %d\n", (int)nHdr); + j = i; + k = 0; + while( x+j0 ){ - printf(" key: lx=left-child n=payload-size r=rowid\n"); + iCellPtr = (a[0]==2 || a[0]==5) ? 12 : 8; + if( cellToDecode==(-2) ){ + printf("Decode of btree page %d:\n", pgno); + print_decode_line(a, 0, 1, zType); + print_decode_line(a, 1, 2, "Offset to first freeblock"); + print_decode_line(a, 3, 2, "Number of cells on this page"); + print_decode_line(a, 5, 2, "Offset to cell content area"); + print_decode_line(a, 7, 1, "Fragmented byte count"); + if( a[0]==2 || a[0]==5 ){ + print_decode_line(a, 8, 4, "Right child"); + } + if( nCell>0 ){ + printf(" key: lx=left-child n=payload-size r=rowid\n"); + } + }else if( cellToDecode>=nCell ){ + printf("Page %d has only %d cells\n", pgno, nCell); + return; } if( showMap ){ zMap = malloc(pagesize); @@ -409,14 +540,18 @@ static void decode_btree_page( j = strlen(zBuf); if( j<=n-2 ) memcpy(&zMap[cofst+1], zBuf, j); } - printf(" %03x: cell[%d] %s\n", cofst, i, zDesc); + if( cellToDecode==(-2) ){ + printf(" %03x: cell[%d] %s\n", cofst, i, zDesc); + }else if( cellToDecode==(-1) || cellToDecode==i ){ + decodeCell(a, pgno, i, hdrSize, cofst-hdrSize); + } } if( showMap ){ for(i=0; i Date: Fri, 20 Jun 2014 01:32:42 +0000 Subject: [PATCH 32/55] In the showdb.exe utility, for the "NNNbd" command, also show data fields in addition to header fields on each record decoded. Improvements to formatting. FossilOrigin-Name: b451fe0cb92278deb7724e7995c1bd46ae83c119 --- manifest | 12 ++++---- manifest.uuid | 2 +- tool/showdb.c | 84 +++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 69 insertions(+), 29 deletions(-) diff --git a/manifest b/manifest index d6ee27e4ac..d8af3f1d0f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sability\sto\sdecode\sthe\sheaders\sof\sindividual\scells,\sbyte-by-byte,\nin\sthe\s"showdb.exe"\sutility. -D 2014-06-19T23:38:53.722 +C In\sthe\sshowdb.exe\sutility,\sfor\sthe\s"NNNbd"\scommand,\salso\sshow\sdata\sfields\nin\saddition\sto\sheader\sfields\son\seach\srecord\sdecoded.\s\sImprovements\sto\s\nformatting. +D 2014-06-20T01:32:42.411 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1158,7 +1158,7 @@ F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 -F tool/showdb.c c080dea3addc8440191aef2c7cf222ee7959529c +F tool/showdb.c eef4bd98ba995c6a9373cbc0e7b8a3201a658585 F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02 F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe @@ -1179,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7b91b0581d169a353462d96120a2e0d4dcc8e8ae -R 80dc9f5b1256cb0818cbd9270f47db96 +P 306b461d7c0643b6ac4df944759ecc9ce8581634 +R 1d1b4729d93a91658ee348794dbfb980 U drh -Z ec7d321d3c2511a642cbe0539a129858 +Z 8ea506b1401ff81840cba469aab2c6cc diff --git a/manifest.uuid b/manifest.uuid index 204ffc59ee..e90ca871c2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -306b461d7c0643b6ac4df944759ecc9ce8581634 \ No newline at end of file +b451fe0cb92278deb7724e7995c1bd46ae83c119 \ No newline at end of file diff --git a/tool/showdb.c b/tool/showdb.c index d4e26f45c1..d97838220a 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -383,9 +383,12 @@ static void decodeCell( unsigned char *x = a + ofst; unsigned char *end; unsigned char cType = a[0]; + int nCol = 0; + int szCol[2000]; + int ofstCol[2000]; + int typeCol[2000]; - printf("Decode cell[%d] on page %d offset %04x....\n", - iCell, pgno, szPgHdr+ofst); + printf("Cell[%d]:\n", iCell); if( cType<=5 ){ leftChild = ((x[0]*256 + x[1])*256 + x[2])*256 + x[3]; printBytes(a, x, 4); @@ -396,7 +399,12 @@ static void decodeCell( i = decodeVarint(x, &nPayload); printBytes(a, x, i); nLocal = localPayload(nPayload, cType); - printf("bytes of payload: %d (local: %d)\n", (int)nPayload, nLocal); + if( nLocal==nPayload ){ + printf("payload-size: %d\n", (int)nPayload); + }else{ + printf("payload-size: %d (%d local, %d overflow)\n", + (int)nPayload, nLocal, (int)(nPayload-nLocal)); + } x += i; }else{ nPayload = nLocal = 0; @@ -411,16 +419,17 @@ static void decodeCell( if( nLocal>0 ){ i = decodeVarint(x, &nHdr); printBytes(a, x, i); - printf("record header size: %d\n", (int)nHdr); + printf("record-header-size: %d\n", (int)nHdr); j = i; - k = 0; + nCol = 0; + k = nHdr; while( x+j0 ){ - printf(" key: lx=left-child n=payload-size r=rowid\n"); - } - }else if( cellToDecode>=nCell ){ + if( cellToDecode>=nCell ){ printf("Page %d has only %d cells\n", pgno, nCell); return; } + printf("Header on btree page %d:\n", pgno); + print_decode_line(a, 0, 1, zType); + print_decode_line(a, 1, 2, "Offset to first freeblock"); + print_decode_line(a, 3, 2, "Number of cells on this page"); + print_decode_line(a, 5, 2, "Offset to cell content area"); + print_decode_line(a, 7, 1, "Fragmented byte count"); + if( a[0]==2 || a[0]==5 ){ + print_decode_line(a, 8, 4, "Right child"); + } + if( cellToDecode==(-2) && nCell>0 ){ + printf(" key: lx=left-child n=payload-size r=rowid\n"); + } if( showMap ){ zMap = malloc(pagesize); memset(zMap, '.', pagesize); @@ -547,6 +586,7 @@ static void decode_btree_page( } } if( showMap ){ + printf("Page map: (H=header P=cell-index 1=page-1-header .=free-space)\n"); for(i=0; i Date: Fri, 20 Jun 2014 13:55:06 +0000 Subject: [PATCH 33/55] Improved display of record data in the "NNNbd" output of the showdb.exe utility program. FossilOrigin-Name: f735c2497eaad15216c90c6b92fd5ceff460220a --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/showdb.c | 23 +++++++++++++++++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d8af3f1d0f..1d0fee3b9d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sshowdb.exe\sutility,\sfor\sthe\s"NNNbd"\scommand,\salso\sshow\sdata\sfields\nin\saddition\sto\sheader\sfields\son\seach\srecord\sdecoded.\s\sImprovements\sto\s\nformatting. -D 2014-06-20T01:32:42.411 +C Improved\sdisplay\sof\srecord\sdata\sin\sthe\s"NNNbd"\soutput\sof\sthe\sshowdb.exe\nutility\sprogram. +D 2014-06-20T13:55:06.139 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1158,7 +1158,7 @@ F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 -F tool/showdb.c eef4bd98ba995c6a9373cbc0e7b8a3201a658585 +F tool/showdb.c b018a8a69d07050fc0fe9afcf17313cdef0cc599 F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02 F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe @@ -1179,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 306b461d7c0643b6ac4df944759ecc9ce8581634 -R 1d1b4729d93a91658ee348794dbfb980 +P b451fe0cb92278deb7724e7995c1bd46ae83c119 +R ed297bdcc3956dc354f00523f5ca1d92 U drh -Z 8ea506b1401ff81840cba469aab2c6cc +Z 0815d87a0909198bac782c1612f71277 diff --git a/manifest.uuid b/manifest.uuid index e90ca871c2..d85d37c37c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b451fe0cb92278deb7724e7995c1bd46ae83c119 \ No newline at end of file +f735c2497eaad15216c90c6b92fd5ceff460220a \ No newline at end of file diff --git a/tool/showdb.c b/tool/showdb.c index d97838220a..bf4af444b2 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -479,8 +479,27 @@ static void decodeCell( printf("%lld\n", v); } }else{ - printf("%d bytes of %s\n", szCol[i], - (typeCol[i]&1)==0 ? "BLOB" : "TEXT"); + int ii, jj; + char zConst[32]; + if( (typeCol[i]&1)==0 ){ + zConst[0] = 'x'; + zConst[1] = '\''; + for(ii=2, jj=0; jj Date: Mon, 23 Jun 2014 10:04:58 +0000 Subject: [PATCH 34/55] Fix a problem with SQLITE_OMIT_WAL builds. FossilOrigin-Name: 612b6d1b1f74eaf618520b90811eca10f978fc71 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_unix.c | 37 ++++++++++++++++++++----------------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/manifest b/manifest index 1d0fee3b9d..9d6dafaed6 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improved\sdisplay\sof\srecord\sdata\sin\sthe\s"NNNbd"\soutput\sof\sthe\sshowdb.exe\nutility\sprogram. -D 2014-06-20T13:55:06.139 +C Fix\sa\sproblem\swith\sSQLITE_OMIT_WAL\sbuilds. +D 2014-06-23T10:04:58.236 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -207,7 +207,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace F src/os.h 60d419395e32a8029fa380a80a3da2e9030f635e F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c 9a97268f1ea97ddea17f1c392f7c76197ac4cea9 +F src/os_unix.c a7baf1b30f3c58ba20b813e01aab23b18ae44f85 F src/os_win.c 8dbf6c11780fe2eb96c1f289e664d0c7b2911d37 F src/os_win.h 057344a6720b4c8405d9bd98f58cb37a6ee46c25 F src/pager.c f6bb1fa6cdf2062f2d8aec3e64db302bca519ab8 @@ -1179,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b451fe0cb92278deb7724e7995c1bd46ae83c119 -R ed297bdcc3956dc354f00523f5ca1d92 -U drh -Z 0815d87a0909198bac782c1612f71277 +P f735c2497eaad15216c90c6b92fd5ceff460220a +R d7976d2787b6fe6354165e317bb92fd4 +U dan +Z fd6ff630a9de62a9d7a43a3d2f98ba30 diff --git a/manifest.uuid b/manifest.uuid index d85d37c37c..4ccc4a184b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f735c2497eaad15216c90c6b92fd5ceff460220a \ No newline at end of file +612b6d1b1f74eaf618520b90811eca10f978fc71 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 7eb25c85f3..347e82220c 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -445,11 +445,11 @@ static struct unix_syscall { { "mremap", (sqlite3_syscall_ptr)0, 0 }, #endif #define osMremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[23].pCurrent) -#endif - { "getpagesize", (sqlite3_syscall_ptr)unixGetpagesize, 0 }, #define osGetpagesize ((int(*)(void))aSyscall[24].pCurrent) +#endif + }; /* End of the overrideable system calls */ /* @@ -3964,8 +3964,25 @@ static int unixDeviceCharacteristics(sqlite3_file *id){ return rc; } -#ifndef SQLITE_OMIT_WAL +#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 +/* +** Return the system page size. +** +** This function should not be called directly by other code in this file. +** Instead, it should be called via macro osGetpagesize(). +*/ +static int unixGetpagesize(void){ +#if defined(_BSD_SOURCE) + return getpagesize(); +#else + return (int)sysconf(_SC_PAGESIZE); +#endif +} + +#endif /* !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 */ + +#ifndef SQLITE_OMIT_WAL /* ** Object used to represent an shared memory buffer. @@ -4116,20 +4133,6 @@ static int unixShmSystemLock( return rc; } -/* -** Return the system page size. -** -** This function should not be called directly by other code in this file. -** Instead, it should be called via macro osGetpagesize(). -*/ -static int unixGetpagesize(void){ -#if defined(_BSD_SOURCE) - return getpagesize(); -#else - return (int)sysconf(_SC_PAGESIZE); -#endif -} - /* ** Return the minimum number of 32KB shm regions that should be mapped at ** a time, assuming that each mapping must be an integer multiple of the From 685ffb134af3f794e5a15ac8f4092a4ad9f37a68 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 23 Jun 2014 10:18:50 +0000 Subject: [PATCH 35/55] Fix a problem with SQLITE_OMIT_WSD builds. FossilOrigin-Name: 07dda49c1bf8997a18c3368acb81b6d863ea38d6 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/main.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 9d6dafaed6..fe8a9edf8e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sSQLITE_OMIT_WAL\sbuilds. -D 2014-06-23T10:04:58.236 +C Fix\sa\sproblem\swith\sSQLITE_OMIT_WSD\sbuilds. +D 2014-06-23T10:18:50.447 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -189,7 +189,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12 F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b F src/loadext.c 867c7b330b740c6c917af9956b13b81d0a048303 -F src/main.c 40d0837e5d0597eadc47c3acc2fc95bdbd9250b8 +F src/main.c 7c2c3cafdd6313c8f9319ebec1565782e624372e F src/malloc.c 0203ebce9152c6a0e5de520140b8ba65187350be F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b @@ -1179,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f735c2497eaad15216c90c6b92fd5ceff460220a -R d7976d2787b6fe6354165e317bb92fd4 +P 612b6d1b1f74eaf618520b90811eca10f978fc71 +R 283ec0802d51fd4e82222d529f6a8475 U dan -Z fd6ff630a9de62a9d7a43a3d2f98ba30 +Z de359222916ca6f6bd684ca986937509 diff --git a/manifest.uuid b/manifest.uuid index 4ccc4a184b..1a8777f6b6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -612b6d1b1f74eaf618520b90811eca10f978fc71 \ No newline at end of file +07dda49c1bf8997a18c3368acb81b6d863ea38d6 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 6b54ca6da5..564c012472 100644 --- a/src/main.c +++ b/src/main.c @@ -3128,10 +3128,10 @@ int sqlite3_test_control(int op, ...){ case SQLITE_TESTCTRL_FAULT_INSTALL: { /* MSVC is picky about pulling func ptrs from va lists. ** http://support.microsoft.com/kb/47961 - ** sqlite3Config.xTestCallback = va_arg(ap, int(*)(int)); + ** sqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int)); */ typedef int(*TESTCALLBACKFUNC_t)(int); - sqlite3Config.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t); + sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t); rc = sqlite3FaultSim(0); break; } From c1971541e4e98434e36d82f4c2a7b18ea17078be Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 23 Jun 2014 23:28:13 +0000 Subject: [PATCH 36/55] Add the .fullschema command to the sqlite3.exe utility. This command shows the schema and the content of the sqlite_stat tables, all in one go. Useful when reporting problems with the query planner. FossilOrigin-Name: ebec48921c092e20c9d7608242b63db40b40be5e --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index fe8a9edf8e..9a02b2a068 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sSQLITE_OMIT_WSD\sbuilds. -D 2014-06-23T10:18:50.447 +C Add\sthe\s.fullschema\scommand\sto\sthe\ssqlite3.exe\sutility.\s\sThis\scommand\sshows\nthe\sschema\sand\sthe\scontent\sof\sthe\ssqlite_stat\stables,\sall\sin\sone\sgo.\s\sUseful\nwhen\sreporting\sproblems\swith\sthe\squery\splanner. +D 2014-06-23T23:28:13.644 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -223,7 +223,7 @@ F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 5fc110baeacf120a73fe34e103f052632ff11a02 F src/rowset.c a9c9aae3234b44a6d7c6f5a3cadf90dce1e627be F src/select.c 6762c62e11b504aa014edceab8886495165e3a77 -F src/shell.c 058940e8a7198ea15ae90f60ffb0e2d67287b46c +F src/shell.c 56de2dfa3f25def4bf03098f7e2256fbb42f6e3c F src/sqlite.h.in a98eb3e8c86c934ea6f5bcfc6b69653dde2f4ed4 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc @@ -1179,7 +1179,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 612b6d1b1f74eaf618520b90811eca10f978fc71 -R 283ec0802d51fd4e82222d529f6a8475 -U dan -Z de359222916ca6f6bd684ca986937509 +P 07dda49c1bf8997a18c3368acb81b6d863ea38d6 +R 4c1bf033e13f45ce881081fa1f198f33 +U drh +Z 8c91ced329194a39e8cdf52b6d2ec4dd diff --git a/manifest.uuid b/manifest.uuid index 1a8777f6b6..bc939b8328 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -07dda49c1bf8997a18c3368acb81b6d863ea38d6 \ No newline at end of file +ebec48921c092e20c9d7608242b63db40b40be5e \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 00d4597545..ff87d817b9 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1583,6 +1583,7 @@ static char zHelp[] = ".exit Exit this program\n" ".explain ?on|off? Turn output mode suitable for EXPLAIN on or off.\n" " With no args, it turns EXPLAIN on.\n" + ".fullschema Show schema and the content of sqlite_stat tables\n" ".headers on|off Turn display of headers on or off\n" ".help Show this message\n" ".import FILE TABLE Import data from FILE into TABLE\n" @@ -2412,6 +2413,44 @@ static int do_meta_command(char *zLine, struct callback_data *p){ } }else + if( c=='f' && strncmp(azArg[0], "fullschema", n)==0 ){ + struct callback_data data; + char *zErrMsg = 0; + if( nArg!=1 ){ + fprintf(stderr, "Usage: .fullschema\n"); + rc = 1; + goto meta_command_exit; + } + open_db(p, 0); + memcpy(&data, p, sizeof(data)); + data.showHeader = 0; + data.mode = MODE_Semi; + rc = sqlite3_exec(p->db, + "SELECT sql FROM" + " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x" + " FROM sqlite_master UNION ALL" + " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) " + "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'" + "ORDER BY rowid", + callback, &data, &zErrMsg + ); + sqlite3_exec(p->db, "SELECT 'ANALYZE sqlite_master;'", + callback, &data, &zErrMsg); + data.mode = MODE_Insert; + data.zDestTable = "sqlite_stat1"; + shell_exec(p->db, "SELECT * FROM sqlite_stat1", + shell_callback, &data,&zErrMsg); + data.zDestTable = "sqlite_stat3"; + shell_exec(p->db, "SELECT * FROM sqlite_stat3", + shell_callback, &data,&zErrMsg); + data.zDestTable = "sqlite_stat4"; + shell_exec(p->db, "SELECT * FROM sqlite_stat4", + shell_callback, &data, &zErrMsg); + data.mode = MODE_Semi; + shell_exec(p->db, "SELECT 'ANALYZE sqlite_master;'", + shell_callback, &data, &zErrMsg); + }else + if( c=='h' && strncmp(azArg[0], "headers", n)==0 ){ if( nArg==2 ){ p->showHeader = booleanValue(azArg[1]); From f127814eaea2b71c63f620dab60be4ba7a37a72f Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 24 Jun 2014 00:59:15 +0000 Subject: [PATCH 37/55] Add the showstat4.exe utility program for decoding and displaying the content of the sqlite_stat4 table in a database. FossilOrigin-Name: b4d9f6053d1d95fdc1eab8ce610b51e7df8d896d --- manifest | 11 ++-- manifest.uuid | 2 +- tool/showstat4.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+), 6 deletions(-) create mode 100644 tool/showstat4.c diff --git a/manifest b/manifest index 9a02b2a068..14bc9eca79 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\s.fullschema\scommand\sto\sthe\ssqlite3.exe\sutility.\s\sThis\scommand\sshows\nthe\sschema\sand\sthe\scontent\sof\sthe\ssqlite_stat\stables,\sall\sin\sone\sgo.\s\sUseful\nwhen\sreporting\sproblems\swith\sthe\squery\splanner. -D 2014-06-23T23:28:13.644 +C Add\sthe\sshowstat4.exe\sutility\sprogram\sfor\sdecoding\sand\sdisplaying\sthe\s\ncontent\sof\sthe\ssqlite_stat4\stable\sin\sa\sdatabase. +D 2014-06-24T00:59:15.223 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1160,6 +1160,7 @@ F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/showdb.c b018a8a69d07050fc0fe9afcf17313cdef0cc599 F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02 +F tool/showstat4.c 47662af1e2c9567fd821da910b3a247c5c138021 F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b @@ -1179,7 +1180,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 07dda49c1bf8997a18c3368acb81b6d863ea38d6 -R 4c1bf033e13f45ce881081fa1f198f33 +P ebec48921c092e20c9d7608242b63db40b40be5e +R 0ce5547c26474f508ca16bdace146cd3 U drh -Z 8c91ced329194a39e8cdf52b6d2ec4dd +Z 0e7559d34a6f25f8be2f321b29251255 diff --git a/manifest.uuid b/manifest.uuid index bc939b8328..142fcbe956 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ebec48921c092e20c9d7608242b63db40b40be5e \ No newline at end of file +b4d9f6053d1d95fdc1eab8ce610b51e7df8d896d \ No newline at end of file diff --git a/tool/showstat4.c b/tool/showstat4.c new file mode 100644 index 0000000000..c85ab1c770 --- /dev/null +++ b/tool/showstat4.c @@ -0,0 +1,155 @@ +/* +** This utility program decodes and displays the content of the +** sqlite_stat4 table in the database file named on the command +** line. +*/ +#include +#include +#include +#include +#include "sqlite3.h" + +typedef sqlite3_int64 i64; /* 64-bit signed integer type */ + + +/* +** Convert the var-int format into i64. Return the number of bytes +** in the var-int. Write the var-int value into *pVal. +*/ +static int decodeVarint(const unsigned char *z, i64 *pVal){ + i64 v = 0; + int i; + for(i=0; i<8; i++){ + v = (v<<7) + (z[i]&0x7f); + if( (z[i]&0x80)==0 ){ *pVal = v; return i+1; } + } + v = (v<<8) + (z[i]&0xff); + *pVal = v; + return 9; +} + + + +int main(int argc, char **argv){ + sqlite3 *db; + sqlite3_stmt *pStmt; + char *zIdx = 0; + int rc, j, x, y, mxHdr; + const unsigned char *aSample; + int nSample; + i64 iVal; + const char *zSep; + + if( argc!=2 ){ + fprintf(stderr, "Usage: %s DATABASE-FILE\n", argv[0]); + exit(1); + } + rc = sqlite3_open(argv[1], &db); + if( rc!=SQLITE_OK || db==0 ){ + fprintf(stderr, "Cannot open database file [%s]\n", argv[1]); + exit(1); + } + rc = sqlite3_prepare_v2(db, + "SELECT tbl||'.'||idx, nEq, nLT, nDLt, sample " + "FROM sqlite_stat4 ORDER BY 1", -1, + &pStmt, 0); + if( rc!=SQLITE_OK || pStmt==0 ){ + fprintf(stderr, "%s\n", sqlite3_errmsg(db)); + sqlite3_close(db); + exit(1); + } + while( SQLITE_ROW==sqlite3_step(pStmt) ){ + if( zIdx==0 || strcmp(zIdx, (const char*)sqlite3_column_text(pStmt,0))!=0 ){ + if( zIdx ) printf("\n"); + sqlite3_free(zIdx); + zIdx = sqlite3_mprintf("%s", sqlite3_column_text(pStmt,0)); + printf("%s:\n", zIdx); + }else{ + printf(" -----------------------------------------------------------\n"); + } + printf(" nEq = %s\n", sqlite3_column_text(pStmt,1)); + printf(" nLt = %s\n", sqlite3_column_text(pStmt,2)); + printf(" nDLt = %s\n", sqlite3_column_text(pStmt,3)); + printf(" sample = x'"); + aSample = sqlite3_column_blob(pStmt,4); + nSample = sqlite3_column_bytes(pStmt,4); + for(j=0; jnSample ){ + printf(" \n"); + continue; + } + y = mxHdr = (int)iVal; + while( xmxHdr ) break; + if( iVal<0 ) break; + switch( iVal ){ + case 0: sz = 0; break; + case 1: sz = 1; break; + case 2: sz = 2; break; + case 3: sz = 3; break; + case 4: sz = 4; break; + case 5: sz = 6; break; + case 6: sz = 8; break; + case 7: sz = 8; break; + case 8: sz = 0; break; + case 9: sz = 0; break; + case 10: + case 11: sz = 0; break; + default: sz = (int)(iVal-12)/2; break; + } + if( y+sz>nSample ) break; + if( iVal==0 ){ + printf("%sNULL", zSep); + }else if( iVal<=7 ){ + v = (signed char)aSample[y]; + for(j=1; j Date: Tue, 24 Jun 2014 20:19:21 +0000 Subject: [PATCH 38/55] Fix showstat4.c so that it decodes typecodes 8 and 9 correctly. FossilOrigin-Name: 9ca737c0b41f87998d842e7772c3e483bb291c50 --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/showstat4.c | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 14bc9eca79..fea0a6e2cc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\sshowstat4.exe\sutility\sprogram\sfor\sdecoding\sand\sdisplaying\sthe\s\ncontent\sof\sthe\ssqlite_stat4\stable\sin\sa\sdatabase. -D 2014-06-24T00:59:15.223 +C Fix\sshowstat4.c\sso\sthat\sit\sdecodes\stypecodes\s8\sand\s9\scorrectly. +D 2014-06-24T20:19:21.030 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -1160,7 +1160,7 @@ F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 F tool/showdb.c b018a8a69d07050fc0fe9afcf17313cdef0cc599 F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02 -F tool/showstat4.c 47662af1e2c9567fd821da910b3a247c5c138021 +F tool/showstat4.c c39279d6bd37cb999b634f0064f6f86ad7af008f F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe F tool/space_used.tcl f714c41a59e326b8b9042f415b628b561bafa06b @@ -1180,7 +1180,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ebec48921c092e20c9d7608242b63db40b40be5e -R 0ce5547c26474f508ca16bdace146cd3 +P b4d9f6053d1d95fdc1eab8ce610b51e7df8d896d +R 508dd98757238bd14305734cabeeae37 U drh -Z 0e7559d34a6f25f8be2f321b29251255 +Z 96b01d8567714808bc64d5917b4d4853 diff --git a/manifest.uuid b/manifest.uuid index 142fcbe956..5313f68aef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b4d9f6053d1d95fdc1eab8ce610b51e7df8d896d \ No newline at end of file +9ca737c0b41f87998d842e7772c3e483bb291c50 \ No newline at end of file diff --git a/tool/showstat4.c b/tool/showstat4.c index c85ab1c770..668d2106af 100644 --- a/tool/showstat4.c +++ b/tool/showstat4.c @@ -106,6 +106,8 @@ int main(int argc, char **argv){ if( y+sz>nSample ) break; if( iVal==0 ){ printf("%sNULL", zSep); + }else if( iVal==8 || iVal==9 ){ + printf("%s%d", zSep, ((int)iVal)-8); }else if( iVal<=7 ){ v = (signed char)aSample[y]; for(j=1; j Date: Thu, 26 Jun 2014 20:21:46 +0000 Subject: [PATCH 39/55] Attempt to use sqlite_stat4 data to estimate the number of rows visited by a range query that uses a skip-scan. This code is largely untested. FossilOrigin-Name: 01dc8102592427b71a18c2cb82301d2266dd59c2 --- manifest | 21 ++-- manifest.uuid | 2 +- src/sqliteInt.h | 2 + src/vdbemem.c | 137 +++++++++++++++++++------ src/where.c | 261 +++++++++++++++++++++++++++++++++--------------- 5 files changed, 300 insertions(+), 123 deletions(-) diff --git a/manifest b/manifest index fea0a6e2cc..5a780681cb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sshowstat4.c\sso\sthat\sit\sdecodes\stypecodes\s8\sand\s9\scorrectly. -D 2014-06-24T20:19:21.030 +C Attempt\sto\suse\ssqlite_stat4\sdata\sto\sestimate\sthe\snumber\sof\srows\svisited\sby\sa\srange\squery\sthat\suses\sa\sskip-scan.\sThis\scode\sis\slargely\suntested. +D 2014-06-26T20:21:46.005 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -227,7 +227,7 @@ F src/shell.c 56de2dfa3f25def4bf03098f7e2256fbb42f6e3c F src/sqlite.h.in a98eb3e8c86c934ea6f5bcfc6b69653dde2f4ed4 F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc -F src/sqliteInt.h fccdc735c27b3dc12322fec7cdad8bc76be8d00b +F src/sqliteInt.h e88614d7371b80ff69dbbb5e4b9813ee93dfd890 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -289,14 +289,14 @@ F src/vdbeInt.h e6d83e5bfd62fc6685ba1ed6153f7099f82de9f7 F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3 F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac -F src/vdbemem.c 6fc77594c60f6155404f3f8d71bf36d1fdeb4447 +F src/vdbemem.c 8f28cb5bdd5b8748dba67aab5a07a47386fe40dc F src/vdbesort.c 44441d73b08b3a638dcdb725afffb87c6574ad27 F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767 F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 7b9e13cff91a2f14ac61e6a1bc3a83b5113e6298 +F src/where.c 643abd2dce6650d537c240c1ecdfc4090271091f F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1180,7 +1180,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b4d9f6053d1d95fdc1eab8ce610b51e7df8d896d -R 508dd98757238bd14305734cabeeae37 -U drh -Z 96b01d8567714808bc64d5917b4d4853 +P 9ca737c0b41f87998d842e7772c3e483bb291c50 +R 48ab9caf5628261ea5cdb35094645ef7 +T *branch * stat4-skipscan +T *sym-stat4-skipscan * +T -sym-trunk * +U dan +Z a77d7df51663ffd17fb07ab0f5d5231a diff --git a/manifest.uuid b/manifest.uuid index 5313f68aef..4422476212 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ca737c0b41f87998d842e7772c3e483bb291c50 \ No newline at end of file +01dc8102592427b71a18c2cb82301d2266dd59c2 \ No newline at end of file diff --git a/src/sqliteInt.h b/src/sqliteInt.h index cc3a030510..7e347c4ee2 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -3431,7 +3431,9 @@ void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 void sqlite3AnalyzeFunctions(void); int sqlite3Stat4ProbeSetValue(Parse*,Index*,UnpackedRecord**,Expr*,u8,int,int*); +int sqlite3Stat4ValueFromExpr(Parse*, Expr*, u8, sqlite3_value**); void sqlite3Stat4ProbeFree(UnpackedRecord*); +int sqlite3Stat4Column(sqlite3*, const void*, int, int, sqlite3_value**); #endif /* diff --git a/src/vdbemem.c b/src/vdbemem.c index 2c4aa4ad7f..67dea9c282 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1152,6 +1152,50 @@ void sqlite3AnalyzeFunctions(void){ } } +static int stat4ValueFromExpr( + Parse *pParse, /* Parse context */ + Expr *pExpr, /* The expression to extract a value from */ + u8 affinity, /* Affinity to use */ + struct ValueNewStat4Ctx *pAlloc,/* How to allocate space */ + sqlite3_value **ppVal /* OUT: New value object (or NULL) */ +){ + int rc = SQLITE_OK; + sqlite3_value *pVal = 0; + sqlite3 *db = pParse->db; + + /* Skip over any TK_COLLATE nodes */ + pExpr = sqlite3ExprSkipCollate(pExpr); + + if( !pExpr ){ + pVal = valueNew(db, pAlloc); + if( pVal ){ + sqlite3VdbeMemSetNull((Mem*)pVal); + } + }else if( pExpr->op==TK_VARIABLE + || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) + ){ + Vdbe *v; + int iBindVar = pExpr->iColumn; + sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar); + if( (v = pParse->pReprepare)!=0 ){ + pVal = valueNew(db, pAlloc); + if( pVal ){ + rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); + if( rc==SQLITE_OK ){ + sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); + } + pVal->db = pParse->db; + } + } + }else{ + rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, pAlloc); + } + + assert( pVal==0 || pVal->db==db ); + *ppVal = pVal; + return rc; +} + /* ** This function is used to allocate and populate UnpackedRecord ** structures intended to be compared against sample index keys stored @@ -1191,47 +1235,76 @@ int sqlite3Stat4ProbeSetValue( int iVal, /* Array element to populate */ int *pbOk /* OUT: True if value was extracted */ ){ - int rc = SQLITE_OK; + int rc; sqlite3_value *pVal = 0; - sqlite3 *db = pParse->db; - - struct ValueNewStat4Ctx alloc; + alloc.pParse = pParse; alloc.pIdx = pIdx; alloc.ppRec = ppRec; alloc.iVal = iVal; - /* Skip over any TK_COLLATE nodes */ - pExpr = sqlite3ExprSkipCollate(pExpr); - - if( !pExpr ){ - pVal = valueNew(db, &alloc); - if( pVal ){ - sqlite3VdbeMemSetNull((Mem*)pVal); - } - }else if( pExpr->op==TK_VARIABLE - || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) - ){ - Vdbe *v; - int iBindVar = pExpr->iColumn; - sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar); - if( (v = pParse->pReprepare)!=0 ){ - pVal = valueNew(db, &alloc); - if( pVal ){ - rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); - if( rc==SQLITE_OK ){ - sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); - } - pVal->db = pParse->db; - } - } - }else{ - rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, &alloc); - } + rc = stat4ValueFromExpr(pParse, pExpr, affinity, &alloc, &pVal); + assert( pVal==0 || pVal->db==pParse->db ); *pbOk = (pVal!=0); + return rc; +} - assert( pVal==0 || pVal->db==db ); +/* +** Attempt to extract a value from expression pExpr using the methods +** as described for sqlite3Stat4ProbeSetValue() above. +** +** If successful, set *ppVal to point to a new value object and return +** SQLITE_OK. If no value can be extracted, but no other error occurs +** (e.g. OOM), return SQLITE_OK and set *ppVal to NULL. Or, if an error +** does occur, return an SQLite error code. The final value of *ppVal +** is undefined in this case. +*/ +int sqlite3Stat4ValueFromExpr( + Parse *pParse, /* Parse context */ + Expr *pExpr, /* The expression to extract a value from */ + u8 affinity, /* Affinity to use */ + sqlite3_value **ppVal /* OUT: New value object (or NULL) */ +){ + return stat4ValueFromExpr(pParse, pExpr, affinity, 0, ppVal); +} + +int sqlite3Stat4Column( + sqlite3 *db, /* Database handle */ + const void *pRec, /* Pointer to buffer containing record */ + int nRec, /* Size of buffer pRec in bytes */ + int iCol, /* Column to extract */ + sqlite3_value **ppVal /* OUT: Extracted value */ +){ + int rc = SQLITE_OK; + Mem *pMem = *ppVal; + if( pMem==0 ){ + pMem = (Mem*)sqlite3ValueNew(db); + if( pMem==0 ){ + rc = SQLITE_NOMEM; + } + } + + if( rc==SQLITE_OK ){ + u32 t; + int nHdr; + int iHdr; + int iField; + int i; + u8 *a = (u8*)pRec; + + iHdr = getVarint32(a, nHdr); + iField = nHdr; + for(i=0; inOut is currently set to the estimated number of rows +** visited for scanning (a=? AND b=?). This function reduces that estimate +** by some factor to account for the (c BETWEEN ? AND ?) expression based +** on the stat4 data for the index. this scan will be peformed multiple +** times (once for each (a,b) combination that matches a=?) is dealt with +** by the caller. +** +** It does this by scanning through all stat4 samples, comparing values +** extracted from pLower and pUpper with the corresponding column in each +** sample. If L and U are the number of samples found to be less than or +** equal to the values extracted from pLower and pUpper respectively, and +** N is the total number of samples, the pLoop->nOut value is adjusted +** as follows: +** +** nOut = nOut * ( min(U - L, 1) / N ) +** +** If pLower is NULL, or a value cannot be extracted from the term, L is +** set to zero. If pUpper is NULL, or a value cannot be extracted from it, +** U is set to N. +** +** Normally, this function sets *pbDone to 1 before returning. However, +** if no value can be extracted from either pLower or pUpper (and so the +** estimate of the number of rows delivered remains unchanged), *pbDone +** is left as is. +** +** If an error occurs, an SQLite error code is returned. Otherwise, +** SQLITE_OK. +*/ +static int whereRangeSkipScanEst( + Parse *pParse, /* Parsing & code generating context */ + WhereTerm *pLower, /* Lower bound on the range. ex: "x>123" Might be NULL */ + WhereTerm *pUpper, /* Upper bound on the range. ex: "x<455" Might be NULL */ + WhereLoop *pLoop, /* Update the .nOut value of this loop */ + int *pbDone /* Set to true if at least one expr. value extracted */ +){ + Index *p = pLoop->u.btree.pIndex; + int nEq = pLoop->u.btree.nEq; + sqlite3 *db = pParse->db; + int nLower = 0; + int nUpper = 0; + int rc = SQLITE_OK; + u8 aff = p->pTable->aCol[ p->aiColumn[nEq] ].affinity; + CollSeq *pColl; + + sqlite3_value *p1 = 0; /* Value extracted from pLower */ + sqlite3_value *p2 = 0; /* Value extracted from pUpper */ + sqlite3_value *pVal = 0; /* Value extracted from record */ + + pColl = sqlite3LocateCollSeq(pParse, p->azColl[nEq]); + if( pLower ){ + rc = sqlite3Stat4ValueFromExpr(pParse, pLower->pExpr->pRight, aff, &p1); + } + if( pUpper && rc==SQLITE_OK ){ + rc = sqlite3Stat4ValueFromExpr(pParse, pUpper->pExpr->pRight, aff, &p2); + } + + if( p1 || p2 ){ + int i; + int nDiff; + for(i=0; rc==SQLITE_OK && inSample; i++){ + rc = sqlite3Stat4Column(db, p->aSample[i].p, p->aSample[i].n, nEq, &pVal); + if( rc==SQLITE_OK && p1 ){ + int res = sqlite3MemCompare(p1, pVal, pColl); + if( res<=0 ) nLower++; + } + if( rc==SQLITE_OK && p2 ){ + int res = sqlite3MemCompare(p2, pVal, pColl); + if( res<=0 ) nUpper++; + } + } + if( p2==0 ) nUpper = p->nSample; + nDiff = (nUpper - nLower); + if( nDiff<=0 ) nDiff = 1; + pLoop->nOut -= (sqlite3LogEst(p->nSample) - sqlite3LogEst(nDiff)); + *pbDone = 1; + }else{ + assert( *pbDone==0 ); + } + + sqlite3ValueFree(p1); + sqlite3ValueFree(p2); + sqlite3ValueFree(pVal); + + return rc; +} + /* ** This function is used to estimate the number of rows that will be visited ** by scanning an index for a range of values. The range may have an upper @@ -2054,95 +2148,100 @@ static int whereRangeScanEst( int nEq = pLoop->u.btree.nEq; if( p->nSample>0 - && nEq==pBuilder->nRecValid && nEqnSampleCol && OptimizationEnabled(pParse->db, SQLITE_Stat3) ){ - UnpackedRecord *pRec = pBuilder->pRec; - tRowcnt a[2]; - u8 aff; + if( nEq==pBuilder->nRecValid ){ + UnpackedRecord *pRec = pBuilder->pRec; + tRowcnt a[2]; + u8 aff; - /* Variable iLower will be set to the estimate of the number of rows in - ** the index that are less than the lower bound of the range query. The - ** lower bound being the concatenation of $P and $L, where $P is the - ** key-prefix formed by the nEq values matched against the nEq left-most - ** columns of the index, and $L is the value in pLower. - ** - ** Or, if pLower is NULL or $L cannot be extracted from it (because it - ** is not a simple variable or literal value), the lower bound of the - ** range is $P. Due to a quirk in the way whereKeyStats() works, even - ** if $L is available, whereKeyStats() is called for both ($P) and - ** ($P:$L) and the larger of the two returned values used. - ** - ** Similarly, iUpper is to be set to the estimate of the number of rows - ** less than the upper bound of the range query. Where the upper bound - ** is either ($P) or ($P:$U). Again, even if $U is available, both values - ** of iUpper are requested of whereKeyStats() and the smaller used. - */ - tRowcnt iLower; - tRowcnt iUpper; + /* Variable iLower will be set to the estimate of the number of rows in + ** the index that are less than the lower bound of the range query. The + ** lower bound being the concatenation of $P and $L, where $P is the + ** key-prefix formed by the nEq values matched against the nEq left-most + ** columns of the index, and $L is the value in pLower. + ** + ** Or, if pLower is NULL or $L cannot be extracted from it (because it + ** is not a simple variable or literal value), the lower bound of the + ** range is $P. Due to a quirk in the way whereKeyStats() works, even + ** if $L is available, whereKeyStats() is called for both ($P) and + ** ($P:$L) and the larger of the two returned values used. + ** + ** Similarly, iUpper is to be set to the estimate of the number of rows + ** less than the upper bound of the range query. Where the upper bound + ** is either ($P) or ($P:$U). Again, even if $U is available, both values + ** of iUpper are requested of whereKeyStats() and the smaller used. + */ + tRowcnt iLower; + tRowcnt iUpper; - if( nEq==p->nKeyCol ){ - aff = SQLITE_AFF_INTEGER; - }else{ - aff = p->pTable->aCol[p->aiColumn[nEq]].affinity; - } - /* Determine iLower and iUpper using ($P) only. */ - if( nEq==0 ){ - iLower = 0; - iUpper = sqlite3LogEstToInt(p->aiRowLogEst[0]); - }else{ - /* Note: this call could be optimized away - since the same values must - ** have been requested when testing key $P in whereEqualScanEst(). */ - whereKeyStats(pParse, p, pRec, 0, a); - iLower = a[0]; - iUpper = a[0] + a[1]; - } - - /* If possible, improve on the iLower estimate using ($P:$L). */ - if( pLower ){ - int bOk; /* True if value is extracted from pExpr */ - Expr *pExpr = pLower->pExpr->pRight; - assert( (pLower->eOperator & (WO_GT|WO_GE))!=0 ); - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); - if( rc==SQLITE_OK && bOk ){ - tRowcnt iNew; - whereKeyStats(pParse, p, pRec, 0, a); - iNew = a[0] + ((pLower->eOperator & WO_GT) ? a[1] : 0); - if( iNew>iLower ) iLower = iNew; - nOut--; - } - } - - /* If possible, improve on the iUpper estimate using ($P:$U). */ - if( pUpper ){ - int bOk; /* True if value is extracted from pExpr */ - Expr *pExpr = pUpper->pExpr->pRight; - assert( (pUpper->eOperator & (WO_LT|WO_LE))!=0 ); - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); - if( rc==SQLITE_OK && bOk ){ - tRowcnt iNew; - whereKeyStats(pParse, p, pRec, 1, a); - iNew = a[0] + ((pUpper->eOperator & WO_LE) ? a[1] : 0); - if( iNewpRec = pRec; - if( rc==SQLITE_OK ){ - if( iUpper>iLower ){ - nNew = sqlite3LogEst(iUpper - iLower); + if( nEq==p->nKeyCol ){ + aff = SQLITE_AFF_INTEGER; }else{ - nNew = 10; assert( 10==sqlite3LogEst(2) ); + aff = p->pTable->aCol[p->aiColumn[nEq]].affinity; } - if( nNewaiRowLogEst[0]); + }else{ + /* Note: this call could be optimized away - since the same values must + ** have been requested when testing key $P in whereEqualScanEst(). */ + whereKeyStats(pParse, p, pRec, 0, a); + iLower = a[0]; + iUpper = a[0] + a[1]; } - pLoop->nOut = (LogEst)nOut; - WHERETRACE(0x10, ("range scan regions: %u..%u est=%d\n", - (u32)iLower, (u32)iUpper, nOut)); - return SQLITE_OK; + + /* If possible, improve on the iLower estimate using ($P:$L). */ + if( pLower ){ + int bOk; /* True if value is extracted from pExpr */ + Expr *pExpr = pLower->pExpr->pRight; + assert( (pLower->eOperator & (WO_GT|WO_GE))!=0 ); + rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); + if( rc==SQLITE_OK && bOk ){ + tRowcnt iNew; + whereKeyStats(pParse, p, pRec, 0, a); + iNew = a[0] + ((pLower->eOperator & WO_GT) ? a[1] : 0); + if( iNew>iLower ) iLower = iNew; + nOut--; + } + } + + /* If possible, improve on the iUpper estimate using ($P:$U). */ + if( pUpper ){ + int bOk; /* True if value is extracted from pExpr */ + Expr *pExpr = pUpper->pExpr->pRight; + assert( (pUpper->eOperator & (WO_LT|WO_LE))!=0 ); + rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); + if( rc==SQLITE_OK && bOk ){ + tRowcnt iNew; + whereKeyStats(pParse, p, pRec, 1, a); + iNew = a[0] + ((pUpper->eOperator & WO_LE) ? a[1] : 0); + if( iNewpRec = pRec; + if( rc==SQLITE_OK ){ + if( iUpper>iLower ){ + nNew = sqlite3LogEst(iUpper - iLower); + }else{ + nNew = 10; assert( 10==sqlite3LogEst(2) ); + } + if( nNewnOut = (LogEst)nOut; + WHERETRACE(0x10, ("range scan regions: %u..%u est=%d\n", + (u32)iLower, (u32)iUpper, nOut)); + return SQLITE_OK; + } + }else{ + int bDone = 0; + rc = whereRangeSkipScanEst(pParse, pLower, pUpper, pLoop, &bDone); + if( bDone ) return rc; } } #else From 9bec6fb3efce29aebf89a37f2fb134d16868dff9 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 26 Jun 2014 21:28:21 +0000 Subject: [PATCH 40/55] Revise the affinity returned for expressions flagged as 'generic'. Fix for [9a8b09f8e6]. FossilOrigin-Name: 92f7ad43dbfe4e02490df2f932c3c74fb89064d6 --- manifest | 15 +-- manifest.uuid | 2 +- src/expr.c | 2 +- test/tkt-9a8b09f8e6.test | 265 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 275 insertions(+), 9 deletions(-) create mode 100644 test/tkt-9a8b09f8e6.test diff --git a/manifest b/manifest index fea0a6e2cc..31eaa743e5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sshowstat4.c\sso\sthat\sit\sdecodes\stypecodes\s8\sand\s9\scorrectly. -D 2014-06-24T20:19:21.030 +C Revise\sthe\saffinity\sreturned\sfor\sexpressions\sflagged\sas\s'generic'.\s\sFix\sfor\s[9a8b09f8e6]. +D 2014-06-26T21:28:21.292 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -176,7 +176,7 @@ F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/ctime.c 0231df905e2c4abba4483ee18ffc05adc321df2a F src/date.c 593c744b2623971e45affd0bde347631bdfa4625 F src/delete.c bcf8f72126cea80fc3d5bc5494cf19b3f8935aaf -F src/expr.c 4f9e497c66e2f25a4d139357a778c84d5713207c +F src/expr.c 40d06d1543b1355aa02efa9666178f7642a96ed6 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c a549cff9fe8b736cdae21650ea0af6de29b77619 F src/func.c 3bc223ea36cd29a91c481485343d0ee4257ab8dc @@ -904,6 +904,7 @@ F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356 F test/tkt-8c63ff0ec.test 258b7fc8d7e4e1cb5362c7d65c143528b9c4cbed F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5 F test/tkt-94c04eaadb.test f738c57c7f68ab8be1c054415af7774617cb6223 +F test/tkt-9a8b09f8e6.test 8b81b1fa5193246dbf5fe876929f71c3712ee755 F test/tkt-9d68c883.test 458f7d82a523d7644b54b497c986378a7d8c8b67 F test/tkt-9f2eb3abac.test 85bc63e749f050e6a61c8f9207f1eee65c9d3395 F test/tkt-a7b7803e.test 159ef554234fa1f9fb318c751b284bd1cf858da4 @@ -1180,7 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P b4d9f6053d1d95fdc1eab8ce610b51e7df8d896d -R 508dd98757238bd14305734cabeeae37 -U drh -Z 96b01d8567714808bc64d5917b4d4853 +P 9ca737c0b41f87998d842e7772c3e483bb291c50 +R 4121a5e953ac74e556013274c6ab2f95 +U mistachkin +Z 9298eeb693f0be09657ca6e474114119 diff --git a/manifest.uuid b/manifest.uuid index 5313f68aef..1b2cca87bd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ca737c0b41f87998d842e7772c3e483bb291c50 \ No newline at end of file +92f7ad43dbfe4e02490df2f932c3c74fb89064d6 \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 08c121e386..803d93f30d 100644 --- a/src/expr.c +++ b/src/expr.c @@ -33,7 +33,7 @@ char sqlite3ExprAffinity(Expr *pExpr){ int op; pExpr = sqlite3ExprSkipCollate(pExpr); - if( pExpr->flags & EP_Generic ) return SQLITE_AFF_NONE; + if( pExpr->flags & EP_Generic ) return 0; op = pExpr->op; if( op==TK_SELECT ){ assert( pExpr->flags&EP_xIsSelect ); diff --git a/test/tkt-9a8b09f8e6.test b/test/tkt-9a8b09f8e6.test new file mode 100644 index 0000000000..6bd3db5de0 --- /dev/null +++ b/test/tkt-9a8b09f8e6.test @@ -0,0 +1,265 @@ +# 2014 June 26 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. +# +# This file implements tests to verify that ticket [9a8b09f8e6] has been +# fixed. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix tkt-9a8b09f8e6 + +do_test 1.1 { + execsql { + CREATE TABLE t1(x TEXT); + INSERT INTO t1 VALUES('1'); + } +} {} + +do_test 1.2 { + execsql { + CREATE TABLE t2(x INTEGER); + INSERT INTO t2 VALUES(1); + } +} {} + +do_test 1.3 { + execsql { + CREATE TABLE t3(x REAL); + INSERT INTO t3 VALUES(1.0); + } +} {} + +do_test 1.4 { + execsql { + CREATE TABLE t4(x REAL); + INSERT INTO t4 VALUES(1.11); + } +} {} + +do_test 2.1 { + execsql { + SELECT x FROM t1 WHERE x IN (1); + } +} {1} + +do_test 2.2 { + execsql { + SELECT x FROM t1 WHERE x IN (1.0); + } +} {} + +do_test 2.3 { + execsql { + SELECT x FROM t1 WHERE x IN ('1'); + } +} {1} + +do_test 2.4 { + execsql { + SELECT x FROM t1 WHERE x IN ('1.0'); + } +} {} + +do_test 2.5 { + execsql { + SELECT x FROM t1 WHERE 1 IN (x); + } +} {} + +do_test 2.6 { + execsql { + SELECT x FROM t1 WHERE 1.0 IN (x); + } +} {} + +do_test 2.7 { + execsql { + SELECT x FROM t1 WHERE '1' IN (x); + } +} {1} + +do_test 2.8 { + execsql { + SELECT x FROM t1 WHERE '1.0' IN (x); + } +} {} + +do_test 3.1 { + execsql { + SELECT x FROM t2 WHERE x IN (1); + } +} {1} + +do_test 3.2 { + execsql { + SELECT x FROM t2 WHERE x IN (1.0); + } +} {1} + +do_test 3.3 { + execsql { + SELECT x FROM t2 WHERE x IN ('1'); + } +} {1} + +do_test 3.4 { + execsql { + SELECT x FROM t2 WHERE x IN ('1.0'); + } +} {1} + +do_test 3.5 { + execsql { + SELECT x FROM t2 WHERE 1 IN (x); + } +} {1} + +do_test 3.6 { + execsql { + SELECT x FROM t2 WHERE 1.0 IN (x); + } +} {1} + +do_test 3.7 { + execsql { + SELECT x FROM t2 WHERE '1' IN (x); + } +} {} + +do_test 3.8 { + execsql { + SELECT x FROM t2 WHERE '1.0' IN (x); + } +} {} + +do_test 4.1 { + execsql { + SELECT x FROM t3 WHERE x IN (1); + } +} {1.0} + +do_test 4.2 { + execsql { + SELECT x FROM t3 WHERE x IN (1.0); + } +} {1.0} + +do_test 4.3 { + execsql { + SELECT x FROM t3 WHERE x IN ('1'); + } +} {1.0} + +do_test 4.4 { + execsql { + SELECT x FROM t3 WHERE x IN ('1.0'); + } +} {1.0} + +do_test 4.5 { + execsql { + SELECT x FROM t3 WHERE 1 IN (x); + } +} {1.0} + +do_test 4.6 { + execsql { + SELECT x FROM t3 WHERE 1.0 IN (x); + } +} {1.0} + +do_test 4.7 { + execsql { + SELECT x FROM t3 WHERE '1' IN (x); + } +} {} + +do_test 4.8 { + execsql { + SELECT x FROM t3 WHERE '1.0' IN (x); + } +} {} + +do_test 5.1 { + execsql { + SELECT x FROM t4 WHERE x IN (1); + } +} {} + +do_test 5.2 { + execsql { + SELECT x FROM t4 WHERE x IN (1.0); + } +} {} + +do_test 5.3 { + execsql { + SELECT x FROM t4 WHERE x IN ('1'); + } +} {} + +do_test 5.4 { + execsql { + SELECT x FROM t4 WHERE x IN ('1.0'); + } +} {} + +do_test 5.5 { + execsql { + SELECT x FROM t4 WHERE x IN (1.11); + } +} {1.11} + +do_test 5.6 { + execsql { + SELECT x FROM t4 WHERE x IN ('1.11'); + } +} {1.11} + +do_test 5.7 { + execsql { + SELECT x FROM t4 WHERE 1 IN (x); + } +} {} + +do_test 5.8 { + execsql { + SELECT x FROM t4 WHERE 1.0 IN (x); + } +} {} + +do_test 5.9 { + execsql { + SELECT x FROM t4 WHERE '1' IN (x); + } +} {} + +do_test 5.10 { + execsql { + SELECT x FROM t4 WHERE '1.0' IN (x); + } +} {} + +do_test 5.11 { + execsql { + SELECT x FROM t4 WHERE 1.11 IN (x); + } +} {1.11} + +do_test 5.12 { + execsql { + SELECT x FROM t4 WHERE '1.11' IN (x); + } +} {} + +finish_test From 2d84ac480b2bf35619570b9e17a7e39dd7dd2100 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 26 Jun 2014 21:32:09 +0000 Subject: [PATCH 41/55] Fix compilation issue when STAT4 is not enabled. FossilOrigin-Name: 74a5454a710e1b7d8575cec2f872e6110aefce17 --- manifest | 17 +++++++---------- manifest.uuid | 2 +- src/where.c | 2 ++ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 5a780681cb..3a8265365f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Attempt\sto\suse\ssqlite_stat4\sdata\sto\sestimate\sthe\snumber\sof\srows\svisited\sby\sa\srange\squery\sthat\suses\sa\sskip-scan.\sThis\scode\sis\slargely\suntested. -D 2014-06-26T20:21:46.005 +C Fix\scompilation\sissue\swhen\sSTAT4\sis\snot\senabled. +D 2014-06-26T21:32:09.075 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 643abd2dce6650d537c240c1ecdfc4090271091f +F src/where.c 0396f040a1ffe31b1f63673c6cd6c469c5e4ce57 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1180,10 +1180,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9ca737c0b41f87998d842e7772c3e483bb291c50 -R 48ab9caf5628261ea5cdb35094645ef7 -T *branch * stat4-skipscan -T *sym-stat4-skipscan * -T -sym-trunk * -U dan -Z a77d7df51663ffd17fb07ab0f5d5231a +P 01dc8102592427b71a18c2cb82301d2266dd59c2 +R 1ded9652c09c1b748cd5e7181ce5016c +U mistachkin +Z b89953846d49961fb37fc288882b8874 diff --git a/manifest.uuid b/manifest.uuid index 4422476212..7e63e6d9db 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -01dc8102592427b71a18c2cb82301d2266dd59c2 \ No newline at end of file +74a5454a710e1b7d8575cec2f872e6110aefce17 \ No newline at end of file diff --git a/src/where.c b/src/where.c index a500b5a024..a8c8bccde4 100644 --- a/src/where.c +++ b/src/where.c @@ -1999,6 +1999,7 @@ static LogEst whereRangeAdjust(WhereTerm *pTerm, LogEst nNew){ return nRet; } +#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 /* ** This function is called to estimate the number of rows visited by a ** range-scan on a skip-scan index. For example: @@ -2091,6 +2092,7 @@ static int whereRangeSkipScanEst( return rc; } +#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ /* ** This function is used to estimate the number of rows that will be visited From 5d249518652c86e9aec977f529da7aa199b4790f Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 26 Jun 2014 22:17:21 +0000 Subject: [PATCH 42/55] Add some more IN operator tests. FossilOrigin-Name: fb32e374b75b160e7b535e732ced6c34dbb513eb --- manifest | 12 ++++----- manifest.uuid | 2 +- test/tkt-9a8b09f8e6.test | 58 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/manifest b/manifest index 31eaa743e5..27807f1cbc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revise\sthe\saffinity\sreturned\sfor\sexpressions\sflagged\sas\s'generic'.\s\sFix\sfor\s[9a8b09f8e6]. -D 2014-06-26T21:28:21.292 +C Add\ssome\smore\sIN\soperator\stests. +D 2014-06-26T22:17:21.764 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -904,7 +904,7 @@ F test/tkt-868145d012.test a5f941107ece6a64410ca4755c6329b7eb57a356 F test/tkt-8c63ff0ec.test 258b7fc8d7e4e1cb5362c7d65c143528b9c4cbed F test/tkt-91e2e8ba6f.test 08c4f94ae07696b05c9b822da0b4e5337a2f54c5 F test/tkt-94c04eaadb.test f738c57c7f68ab8be1c054415af7774617cb6223 -F test/tkt-9a8b09f8e6.test 8b81b1fa5193246dbf5fe876929f71c3712ee755 +F test/tkt-9a8b09f8e6.test b2ef151d0984b2ebf237760dbeaa50724e5a0667 F test/tkt-9d68c883.test 458f7d82a523d7644b54b497c986378a7d8c8b67 F test/tkt-9f2eb3abac.test 85bc63e749f050e6a61c8f9207f1eee65c9d3395 F test/tkt-a7b7803e.test 159ef554234fa1f9fb318c751b284bd1cf858da4 @@ -1181,7 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9ca737c0b41f87998d842e7772c3e483bb291c50 -R 4121a5e953ac74e556013274c6ab2f95 +P 92f7ad43dbfe4e02490df2f932c3c74fb89064d6 +R 61cea95999002249f7da20d93ec0602d U mistachkin -Z 9298eeb693f0be09657ca6e474114119 +Z 2021f223ccdab7be5b0b3bf69eadf881 diff --git a/manifest.uuid b/manifest.uuid index 1b2cca87bd..9daab53ded 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -92f7ad43dbfe4e02490df2f932c3c74fb89064d6 \ No newline at end of file +fb32e374b75b160e7b535e732ced6c34dbb513eb \ No newline at end of file diff --git a/test/tkt-9a8b09f8e6.test b/test/tkt-9a8b09f8e6.test index 6bd3db5de0..d6b22efb21 100644 --- a/test/tkt-9a8b09f8e6.test +++ b/test/tkt-9a8b09f8e6.test @@ -46,6 +46,16 @@ do_test 1.4 { } } {} +do_test 1.5 { + execsql { + CREATE TABLE t5(x, y); + INSERT INTO t5 VALUES('1', 'one'); + INSERT INTO t5 VALUES(1, 'two'); + INSERT INTO t5 VALUES('1.0', 'three'); + INSERT INTO t5 VALUES(1.0, 'four'); + } +} {} + do_test 2.1 { execsql { SELECT x FROM t1 WHERE x IN (1); @@ -262,4 +272,52 @@ do_test 5.12 { } } {} +do_test 6.1 { + execsql { + SELECT x, y FROM t5 WHERE x IN (1); + } +} {1 two 1.0 four} + +do_test 6.2 { + execsql { + SELECT x, y FROM t5 WHERE x IN (1.0); + } +} {1 two 1.0 four} + +do_test 6.3 { + execsql { + SELECT x, y FROM t5 WHERE x IN ('1'); + } +} {1 one} + +do_test 6.4 { + execsql { + SELECT x, y FROM t5 WHERE x IN ('1.0'); + } +} {1.0 three} + +do_test 6.5 { + execsql { + SELECT x, y FROM t5 WHERE 1 IN (x); + } +} {1 two 1.0 four} + +do_test 6.6 { + execsql { + SELECT x, y FROM t5 WHERE 1.0 IN (x); + } +} {1 two 1.0 four} + +do_test 6.7 { + execsql { + SELECT x, y FROM t5 WHERE '1' IN (x); + } +} {1 one} + +do_test 6.8 { + execsql { + SELECT x, y FROM t5 WHERE '1.0' IN (x); + } +} {1.0 three} + finish_test From 4e42ba4a356f21306a84a2958ee1a66a7f285cfd Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 27 Jun 2014 20:14:25 +0000 Subject: [PATCH 43/55] Fix a couple of problems in estimating the number of rows visited by a range query that uses a skip-scan. FossilOrigin-Name: 219736f54dcd1448af3400e699f1c20755ac6876 --- manifest | 17 ++++---- manifest.uuid | 2 +- src/vdbemem.c | 2 +- src/where.c | 27 +++++++++---- test/skipscan5.test | 95 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 126 insertions(+), 17 deletions(-) create mode 100644 test/skipscan5.test diff --git a/manifest b/manifest index 3a8265365f..14dfe69604 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\scompilation\sissue\swhen\sSTAT4\sis\snot\senabled. -D 2014-06-26T21:32:09.075 +C Fix\sa\scouple\sof\sproblems\sin\sestimating\sthe\snumber\sof\srows\svisited\sby\sa\srange\squery\sthat\suses\sa\sskip-scan. +D 2014-06-27T20:14:25.215 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -289,14 +289,14 @@ F src/vdbeInt.h e6d83e5bfd62fc6685ba1ed6153f7099f82de9f7 F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3 F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac -F src/vdbemem.c 8f28cb5bdd5b8748dba67aab5a07a47386fe40dc +F src/vdbemem.c 3f191d4113805e3c5e875b732c44c9d98bac0595 F src/vdbesort.c 44441d73b08b3a638dcdb725afffb87c6574ad27 F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767 F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 0396f040a1ffe31b1f63673c6cd6c469c5e4ce57 +F src/where.c fea270aeef23f978edac94b5591c74b0bf3ce884 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -829,6 +829,7 @@ F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868 F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329 F test/skipscan1.test 28c7faa41a0d7265040ecb0a0abd90c0904270b2 F test/skipscan2.test d1d1450952b7275f0b0a3a981f0230532743951a +F test/skipscan5.test 7eb78ace4e7145fb5005d47a8f837701d7027b85 F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f F test/softheap1.test 40562fe6cac6d9827b7b42b86d45aedf12c15e24 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 @@ -1180,7 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 01dc8102592427b71a18c2cb82301d2266dd59c2 -R 1ded9652c09c1b748cd5e7181ce5016c -U mistachkin -Z b89953846d49961fb37fc288882b8874 +P 74a5454a710e1b7d8575cec2f872e6110aefce17 +R 02edb14d4ef805eea40e69e5acdf39b7 +U dan +Z bd7cb892a5b1d67344c0bf9079bc8afa diff --git a/manifest.uuid b/manifest.uuid index 7e63e6d9db..d621593f3a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -74a5454a710e1b7d8575cec2f872e6110aefce17 \ No newline at end of file +219736f54dcd1448af3400e699f1c20755ac6876 \ No newline at end of file diff --git a/src/vdbemem.c b/src/vdbemem.c index 67dea9c282..634c881f2f 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1296,7 +1296,7 @@ int sqlite3Stat4Column( iHdr = getVarint32(a, nHdr); iField = nHdr; for(i=0; iu.btree.pIndex; int nEq = pLoop->u.btree.nEq; sqlite3 *db = pParse->db; - int nLower = 0; - int nUpper = 0; + int nLower = -1; + int nUpper = p->nSample+1; int rc = SQLITE_OK; u8 aff = p->pTable->aCol[ p->aiColumn[nEq] ].affinity; CollSeq *pColl; @@ -2058,9 +2058,11 @@ static int whereRangeSkipScanEst( pColl = sqlite3LocateCollSeq(pParse, p->azColl[nEq]); if( pLower ){ rc = sqlite3Stat4ValueFromExpr(pParse, pLower->pExpr->pRight, aff, &p1); + nLower = 0; } if( pUpper && rc==SQLITE_OK ){ rc = sqlite3Stat4ValueFromExpr(pParse, pUpper->pExpr->pRight, aff, &p2); + nUpper = p2 ? 0 : p->nSample; } if( p1 || p2 ){ @@ -2070,18 +2072,29 @@ static int whereRangeSkipScanEst( rc = sqlite3Stat4Column(db, p->aSample[i].p, p->aSample[i].n, nEq, &pVal); if( rc==SQLITE_OK && p1 ){ int res = sqlite3MemCompare(p1, pVal, pColl); - if( res<=0 ) nLower++; + if( res>=0 ) nLower++; } if( rc==SQLITE_OK && p2 ){ int res = sqlite3MemCompare(p2, pVal, pColl); - if( res<=0 ) nUpper++; + if( res>=0 ) nUpper++; } } - if( p2==0 ) nUpper = p->nSample; nDiff = (nUpper - nLower); if( nDiff<=0 ) nDiff = 1; - pLoop->nOut -= (sqlite3LogEst(p->nSample) - sqlite3LogEst(nDiff)); - *pbDone = 1; + + /* If there is both an upper and lower bound specified, and the + ** comparisons indicate that they are close together, use the fallback + ** method (assume that the scan visits 1/64 of the rows) for estimating + ** the number of rows visited. Otherwise, estimate the number of rows + ** using the method described in the header comment for this function. */ + if( nDiff!=1 || pUpper==0 || pLower==0 ){ + int nAdjust = (sqlite3LogEst(p->nSample) - sqlite3LogEst(nDiff)); + pLoop->nOut -= nAdjust; + *pbDone = 1; + WHERETRACE(0x10, ("range skip-scan regions: %u..%u adjust=%d est=%d\n", + (u32)nLower, (u32)nUpper, nAdjust*-1, pLoop->nOut)); + } + }else{ assert( *pbDone==0 ); } diff --git a/test/skipscan5.test b/test/skipscan5.test new file mode 100644 index 0000000000..b374302f83 --- /dev/null +++ b/test/skipscan5.test @@ -0,0 +1,95 @@ +# 2013-11-13 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# This file implements tests of the "skip-scan" query strategy. In +# particular it tests that stat4 data can be used by a range query +# that uses the skip-scan approach. +# + +set testdir [file dirname $argv0] +source $testdir/tester.tcl +set testprefix skipscan5 + +ifcapable !stat4 { + finish_test + return +} + +do_execsql_test 1.1 { + CREATE TABLE t1(a INT, b INT, c INT); + CREATE INDEX i1 ON t1(a, b); +} {} + +expr srand(4) +do_test 1.2 { + for {set i 0} {$i < 100} {incr i} { + set a [expr int(rand()*4.0) + 1] + set b [expr int(rand()*20.0) + 1] + execsql { INSERT INTO t1 VALUES($a, $b, NULL) } + } + execsql ANALYZE +} {} + +do_eqp_test 1.3 { + SELECT * FROM t1 WHERE b = 5; +} { + 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b=?)} +} + +do_eqp_test 1.4 { + SELECT * FROM t1 WHERE b > 12 AND b < 16; +} { + 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>? AND b 2 AND b < 16; +} { + 0 0 0 {SCAN TABLE t1} +} + +do_eqp_test 1.6 { + SELECT * FROM t1 WHERE b > 18 AND b < 25; +} { + 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>? AND b 18 AND b < 25; +} { + 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>? AND b 15; +} { + 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>?)} +} + +do_eqp_test 1.9 { + SELECT * FROM t1 WHERE b > 5; +} { + 0 0 0 {SCAN TABLE t1} +} + +do_eqp_test 1.10 { + SELECT * FROM t1 WHERE b < 5; +} { + 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b Date: Sat, 28 Jun 2014 14:28:06 +0000 Subject: [PATCH 44/55] Change the VDBE to export the sqlite3MemCompare() routine and thus free where.c from the dependency on vdbeInt.h. FossilOrigin-Name: d186d1ac3c47f0d814636c4b8386a6065a294750 --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/vdbe.h | 1 + src/vdbeInt.h | 1 - src/where.c | 1 - 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index fc497fbfa9..620657f6c1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\sfixes\sfrom\strunk\swith\sthis\sbranch. -D 2014-06-28T14:25:32.570 +C Change\sthe\sVDBE\sto\sexport\sthe\ssqlite3MemCompare()\sroutine\sand\sthus\sfree\nwhere.c\sfrom\sthe\sdependency\son\svdbeInt.h. +D 2014-06-28T14:28:06.405 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -284,8 +284,8 @@ F src/utf.c a0314e637768a030e6e84a957d0c4f6ba910cc05 F src/util.c 049fe1d3c0e2209c1bee107aec2fcff6285f909f F src/vacuum.c 3728d74919d4fb1356f9e9a13e27773db60b7179 F src/vdbe.c 9bfe6becfc094382ae213656fbe511055ad83a54 -F src/vdbe.h 394464909ed682334aa3d5831aae0c2fe2abef94 -F src/vdbeInt.h e6d83e5bfd62fc6685ba1ed6153f7099f82de9f7 +F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8 +F src/vdbeInt.h 5df5e9afe9b7839cd17256220fc4f7af84b8b1cd F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3 F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c fea270aeef23f978edac94b5591c74b0bf3ce884 +F src/where.c 1f448161f1d9ec8cb68e2a8eb2e4a9756a877f69 F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1182,7 +1182,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 219736f54dcd1448af3400e699f1c20755ac6876 fb32e374b75b160e7b535e732ced6c34dbb513eb -R 638c04374a356a745d9c2d2f0fa602ad -U dan -Z fc19d5103e4b8e0f744c9b3dd9fc467e +P 6af219d1b83ec54b3fb4ad4e6216d9ad9ea0fc70 +R 0d122ee9efb300dc8d78b79e592143bf +U drh +Z 93fe23c37a7fe2b9652da5b4873aa7c3 diff --git a/manifest.uuid b/manifest.uuid index bcfbef8325..172499a547 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6af219d1b83ec54b3fb4ad4e6216d9ad9ea0fc70 \ No newline at end of file +d186d1ac3c47f0d814636c4b8386a6065a294750 \ No newline at end of file diff --git a/src/vdbe.h b/src/vdbe.h index 10a4140ee1..ef91010d80 100644 --- a/src/vdbe.h +++ b/src/vdbe.h @@ -209,6 +209,7 @@ void sqlite3VdbeSetVarmask(Vdbe*, int); #ifndef SQLITE_OMIT_TRACE char *sqlite3VdbeExpandSql(Vdbe*, const char*); #endif +int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*,int); diff --git a/src/vdbeInt.h b/src/vdbeInt.h index 043b56da59..d629802a64 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -394,7 +394,6 @@ void sqlite3VdbeDeleteAuxData(Vdbe*, int, int); int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*); int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *); -int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); int sqlite3VdbeExec(Vdbe*); int sqlite3VdbeList(Vdbe*); int sqlite3VdbeHalt(Vdbe*); diff --git a/src/where.c b/src/where.c index 3cd566c46b..e431e9413e 100644 --- a/src/where.c +++ b/src/where.c @@ -18,7 +18,6 @@ */ #include "sqliteInt.h" #include "whereInt.h" -#include "vdbeInt.h" /* ** Return the estimated number of output rows from a WHERE clause From fa8874542c82254420e483650c9f49d94b413106 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 28 Jun 2014 15:26:10 +0000 Subject: [PATCH 45/55] Fix a problem with using stat4 samples of type text when estimating the rows visited by a range-query/skip-scan loop. FossilOrigin-Name: dfb09db6d412f3bc2a71bda393813783580dbad1 --- manifest | 18 +++++++-------- manifest.uuid | 2 +- src/vdbemem.c | 1 + src/where.c | 2 +- test/skipscan5.test | 56 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 620657f6c1..624fcba2fe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sVDBE\sto\sexport\sthe\ssqlite3MemCompare()\sroutine\sand\sthus\sfree\nwhere.c\sfrom\sthe\sdependency\son\svdbeInt.h. -D 2014-06-28T14:28:06.405 +C Fix\sa\sproblem\swith\susing\sstat4\ssamples\sof\stype\stext\swhen\sestimating\sthe\srows\svisited\sby\sa\srange-query/skip-scan\sloop. +D 2014-06-28T15:26:10.708 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -289,14 +289,14 @@ F src/vdbeInt.h 5df5e9afe9b7839cd17256220fc4f7af84b8b1cd F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3 F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac -F src/vdbemem.c 3f191d4113805e3c5e875b732c44c9d98bac0595 +F src/vdbemem.c 8228bc32622716d26ffd902ceca7b31690744fef F src/vdbesort.c 44441d73b08b3a638dcdb725afffb87c6574ad27 F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767 F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 1f448161f1d9ec8cb68e2a8eb2e4a9756a877f69 +F src/where.c 84659c308426b20be4efada82a06a26dd6b8545e F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -829,7 +829,7 @@ F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868 F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329 F test/skipscan1.test 28c7faa41a0d7265040ecb0a0abd90c0904270b2 F test/skipscan2.test d1d1450952b7275f0b0a3a981f0230532743951a -F test/skipscan5.test 7eb78ace4e7145fb5005d47a8f837701d7027b85 +F test/skipscan5.test 4b83d803bb17bf922569ce8c3637d0558d6abc83 F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f F test/softheap1.test 40562fe6cac6d9827b7b42b86d45aedf12c15e24 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 @@ -1182,7 +1182,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6af219d1b83ec54b3fb4ad4e6216d9ad9ea0fc70 -R 0d122ee9efb300dc8d78b79e592143bf -U drh -Z 93fe23c37a7fe2b9652da5b4873aa7c3 +P d186d1ac3c47f0d814636c4b8386a6065a294750 +R 737af1ae1f9d5e706af49b9d72dc98eb +U dan +Z c44a7d177df302c14a246c1d5d1d90b5 diff --git a/manifest.uuid b/manifest.uuid index 172499a547..f498e3b5e9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d186d1ac3c47f0d814636c4b8386a6065a294750 \ No newline at end of file +dfb09db6d412f3bc2a71bda393813783580dbad1 \ No newline at end of file diff --git a/src/vdbemem.c b/src/vdbemem.c index 634c881f2f..7e5c912f39 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1301,6 +1301,7 @@ int sqlite3Stat4Column( } iHdr = getVarint32(&a[iHdr], t); + pMem->enc = ENC(db); sqlite3VdbeSerialGet(&a[iField], t, pMem); } diff --git a/src/where.c b/src/where.c index e431e9413e..7610c20f9b 100644 --- a/src/where.c +++ b/src/where.c @@ -2091,7 +2091,7 @@ static int whereRangeSkipScanEst( pLoop->nOut -= nAdjust; *pbDone = 1; WHERETRACE(0x10, ("range skip-scan regions: %u..%u adjust=%d est=%d\n", - (u32)nLower, (u32)nUpper, nAdjust*-1, pLoop->nOut)); + nLower, nUpper, nAdjust*-1, pLoop->nOut)); } }else{ diff --git a/test/skipscan5.test b/test/skipscan5.test index b374302f83..6cf35f26a7 100644 --- a/test/skipscan5.test +++ b/test/skipscan5.test @@ -92,4 +92,60 @@ do_eqp_test 1.11 { 0 0 0 {SCAN TABLE t1} } +#------------------------------------------------------------------------- +# Test that range-query/skip-scan estimation works with text values. +# And on UTF-16 databases when there is no UTF-16 collation sequence +# available. + +proc test_collate {enc lhs rhs} { + string compare $lhs $rhs +} + +foreach {tn dbenc coll} { + 1 UTF-8 { add_test_collate db 0 0 1 } + 2 UTF-16 { add_test_collate db 1 0 0 } + 3 UTF-8 { add_test_collate db 0 1 0 } +} { + reset_db + eval $coll + + do_execsql_test 2.$tn.1 " PRAGMA encoding = '$dbenc' " + do_execsql_test 2.$tn.2 { + CREATE TABLE t2(a TEXT, b TEXT, c TEXT COLLATE test_collate, d TEXT); + CREATE INDEX i2 ON t2(a, b, c); + } + + set vocab(d) { :) } + set vocab(c) { a b c d e f g h i j k l m n o p q r s t } + set vocab(b) { one two three } + set vocab(a) { sql } + + do_test 2.$tn.3 { + for {set i 0} {$i < 100} {incr i} { + foreach var {a b c d} { + set $var [lindex $vocab($var) [expr $i % [llength $vocab($var)]]] + } + execsql { INSERT INTO t2 VALUES($a, $b, $c, $d) } + } + execsql ANALYZE + } {} + + foreach {tn2 q res} { + 1 { c BETWEEN 'd' AND 'e' } {/*ANY(a) AND ANY(b) AND c>? AND c 'q' } {/*ANY(a) AND ANY(b) AND c>?*/} + 4 { c > 'e' } {/*SCAN TABLE t2*/} + 5 { c < 'q' } {/*SCAN TABLE t2*/} + 4 { c < 'e' } {/*ANY(a) AND ANY(b) AND c Date: Sat, 28 Jun 2014 16:06:44 +0000 Subject: [PATCH 46/55] Add header comments on new routines. Rework the sqlite3Stat4Column() routine so that is (in theory) able to deal with corrupt samples. FossilOrigin-Name: ef5cdf949bb53a2958fa34e176b4b9eeda269de5 --- manifest | 14 ++++----- manifest.uuid | 2 +- src/vdbemem.c | 86 +++++++++++++++++++++++++++++++++------------------ 3 files changed, 64 insertions(+), 38 deletions(-) diff --git a/manifest b/manifest index 624fcba2fe..7600c076fe 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\susing\sstat4\ssamples\sof\stype\stext\swhen\sestimating\sthe\srows\svisited\sby\sa\srange-query/skip-scan\sloop. -D 2014-06-28T15:26:10.708 +C Add\sheader\scomments\son\snew\sroutines.\s\sRework\sthe\ssqlite3Stat4Column()\sroutine\nso\sthat\sis\s(in\stheory)\sable\sto\sdeal\swith\scorrupt\ssamples. +D 2014-06-28T16:06:44.822 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -289,7 +289,7 @@ F src/vdbeInt.h 5df5e9afe9b7839cd17256220fc4f7af84b8b1cd F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3 F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac -F src/vdbemem.c 8228bc32622716d26ffd902ceca7b31690744fef +F src/vdbemem.c d90a1e8acf8b63dc9d14cbbea12bfec6cec31394 F src/vdbesort.c 44441d73b08b3a638dcdb725afffb87c6574ad27 F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767 F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd @@ -1182,7 +1182,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P d186d1ac3c47f0d814636c4b8386a6065a294750 -R 737af1ae1f9d5e706af49b9d72dc98eb -U dan -Z c44a7d177df302c14a246c1d5d1d90b5 +P dfb09db6d412f3bc2a71bda393813783580dbad1 +R a461409aefe23981a1fbdd4418e17b64 +U drh +Z a2fad482dc40a73ef09e3690c963a5aa diff --git a/manifest.uuid b/manifest.uuid index f498e3b5e9..2e226ad371 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dfb09db6d412f3bc2a71bda393813783580dbad1 \ No newline at end of file +ef5cdf949bb53a2958fa34e176b4b9eeda269de5 \ No newline at end of file diff --git a/src/vdbemem.c b/src/vdbemem.c index 7e5c912f39..cf44aa7e2d 100644 --- a/src/vdbemem.c +++ b/src/vdbemem.c @@ -1152,11 +1152,29 @@ void sqlite3AnalyzeFunctions(void){ } } +/* +** Attempt to extract a value from pExpr and use it to construct *ppVal. +** +** If pAlloc is not NULL, then an UnpackedRecord object is created for +** pAlloc if one does not exist and the new value is added to the +** UnpackedRecord object. +** +** A value is extracted in the following cases: +** +** * (pExpr==0). In this case the value is assumed to be an SQL NULL, +** +** * The expression is a bound variable, and this is a reprepare, or +** +** * The expression is a literal value. +** +** On success, *ppVal is made to point to the extracted value. The caller +** is responsible for ensuring that the value is eventually freed. +*/ static int stat4ValueFromExpr( Parse *pParse, /* Parse context */ Expr *pExpr, /* The expression to extract a value from */ u8 affinity, /* Affinity to use */ - struct ValueNewStat4Ctx *pAlloc,/* How to allocate space */ + struct ValueNewStat4Ctx *pAlloc,/* How to allocate space. Or NULL */ sqlite3_value **ppVal /* OUT: New value object (or NULL) */ ){ int rc = SQLITE_OK; @@ -1269,6 +1287,14 @@ int sqlite3Stat4ValueFromExpr( return stat4ValueFromExpr(pParse, pExpr, affinity, 0, ppVal); } +/* +** Extract the iCol-th column from the nRec-byte record in pRec. Write +** the column value into *ppVal. If *ppVal is initially NULL then a new +** sqlite3_value object is allocated. +** +** If *ppVal is initially NULL then the caller is responsible for +** ensuring that the value written into *ppVal is eventually freed. +*/ int sqlite3Stat4Column( sqlite3 *db, /* Database handle */ const void *pRec, /* Pointer to buffer containing record */ @@ -1276,37 +1302,37 @@ int sqlite3Stat4Column( int iCol, /* Column to extract */ sqlite3_value **ppVal /* OUT: Extracted value */ ){ - int rc = SQLITE_OK; - Mem *pMem = *ppVal; + u32 t; /* a column type code */ + int nHdr; /* Size of the header in the record */ + int iHdr; /* Next unread header byte */ + int iField; /* Next unread data byte */ + int szField; /* Size of the current data field */ + int i; /* Column index */ + u8 *a = (u8*)pRec; /* Typecast byte array */ + Mem *pMem = *ppVal; /* Write result into this Mem object */ + + assert( iCol>0 ); + iHdr = getVarint32(a, nHdr); + if( nHdr>nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT; + iField = nHdr; + for(i=0; i<=iCol; i++){ + iHdr += getVarint32(&a[iHdr], t); + testcase( iHdr==nHdr ); + testcase( iHdr==nHdr+1 ); + if( iHdr>nHdr ) return SQLITE_CORRUPT_BKPT; + szField = sqlite3VdbeSerialTypeLen(t); + iField += szField; + } + testcase( iField==nRec ); + testcase( iField==nRec+1 ); + if( iField>nRec ) return SQLITE_CORRUPT_BKPT; if( pMem==0 ){ - pMem = (Mem*)sqlite3ValueNew(db); - if( pMem==0 ){ - rc = SQLITE_NOMEM; - } + pMem = *ppVal = sqlite3ValueNew(db); + if( pMem==0 ) return SQLITE_NOMEM; } - - if( rc==SQLITE_OK ){ - u32 t; - int nHdr; - int iHdr; - int iField; - int i; - u8 *a = (u8*)pRec; - - iHdr = getVarint32(a, nHdr); - iField = nHdr; - for(i=0; ienc = ENC(db); - sqlite3VdbeSerialGet(&a[iField], t, pMem); - } - - *ppVal = pMem; - return rc; + sqlite3VdbeSerialGet(&a[iField-szField], t, pMem); + pMem->enc = ENC(db); + return SQLITE_OK; } /* From 8e9028d0f862197aacd3f5213680f87275c1c67f Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 28 Jun 2014 17:35:15 +0000 Subject: [PATCH 47/55] Add further tests to skipscan5.test. FossilOrigin-Name: 4b8230e8fe93e73a615a46708aed5fa3557b6228 --- manifest | 14 ++--- manifest.uuid | 2 +- test/skipscan5.test | 135 ++++++++++++++++++++++++++++---------------- 3 files changed, 93 insertions(+), 58 deletions(-) diff --git a/manifest b/manifest index 7600c076fe..c6e5aaa9c2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sheader\scomments\son\snew\sroutines.\s\sRework\sthe\ssqlite3Stat4Column()\sroutine\nso\sthat\sis\s(in\stheory)\sable\sto\sdeal\swith\scorrupt\ssamples. -D 2014-06-28T16:06:44.822 +C Add\sfurther\stests\sto\sskipscan5.test. +D 2014-06-28T17:35:15.306 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -829,7 +829,7 @@ F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868 F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329 F test/skipscan1.test 28c7faa41a0d7265040ecb0a0abd90c0904270b2 F test/skipscan2.test d1d1450952b7275f0b0a3a981f0230532743951a -F test/skipscan5.test 4b83d803bb17bf922569ce8c3637d0558d6abc83 +F test/skipscan5.test d8b9692b702745a0e41c23f9da6beac81df01196 F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f F test/softheap1.test 40562fe6cac6d9827b7b42b86d45aedf12c15e24 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 @@ -1182,7 +1182,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P dfb09db6d412f3bc2a71bda393813783580dbad1 -R a461409aefe23981a1fbdd4418e17b64 -U drh -Z a2fad482dc40a73ef09e3690c963a5aa +P ef5cdf949bb53a2958fa34e176b4b9eeda269de5 +R f17ac3e5a608781f5afc70c3d4b0020c +U dan +Z 86f494cb467655f573b06b5ade5b9c90 diff --git a/manifest.uuid b/manifest.uuid index 2e226ad371..fa3d4db391 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ef5cdf949bb53a2958fa34e176b4b9eeda269de5 \ No newline at end of file +4b8230e8fe93e73a615a46708aed5fa3557b6228 \ No newline at end of file diff --git a/test/skipscan5.test b/test/skipscan5.test index 6cf35f26a7..5d6d392998 100644 --- a/test/skipscan5.test +++ b/test/skipscan5.test @@ -38,64 +38,36 @@ do_test 1.2 { execsql ANALYZE } {} -do_eqp_test 1.3 { - SELECT * FROM t1 WHERE b = 5; +foreach {tn q res} { + 1 "b = 5" {/*ANY(a) AND b=?*/} + 2 "b > 12 AND b < 16" {/*ANY(a) AND b>? AND b 2 AND b < 16" {/*SCAN TABLE t1*/} + 4 "b > 18 AND b < 25" {/*ANY(a) AND b>? AND b 15" {/*ANY(a) AND b>?*/} + 6 "b > 5" {/*SCAN TABLE t1*/} + 7 "b < 15" {/*SCAN TABLE t1*/} + 8 "b < 5" {/*ANY(a) AND b b" {/*ANY(a) AND b '12' AND b < '16'" {/*ANY(a) AND b>? AND b '2' AND b < '16'" {/*SCAN TABLE t1*/} + 13 "b > '18' AND b < '25'" {/*ANY(a) AND b>? AND b '15'" {/*ANY(a) AND b>?*/} + 15 "b > '5'" {/*SCAN TABLE t1*/} + 16 "b < '15'" {/*SCAN TABLE t1*/} + 17 "b < '5'" {/*ANY(a) AND b b" {/*ANY(a) AND b 12 AND b < 16; -} { - 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>? AND b 2 AND b < 16; -} { - 0 0 0 {SCAN TABLE t1} -} - -do_eqp_test 1.6 { - SELECT * FROM t1 WHERE b > 18 AND b < 25; -} { - 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>? AND b 18 AND b < 25; -} { - 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>? AND b 15; -} { - 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b>?)} -} - -do_eqp_test 1.9 { - SELECT * FROM t1 WHERE b > 5; -} { - 0 0 0 {SCAN TABLE t1} -} - -do_eqp_test 1.10 { - SELECT * FROM t1 WHERE b < 5; -} { - 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (ANY(a) AND b? AND b X'5555'" {/*ANY(a) AND b>?*/} + 5 "b > 'zzz'" {/*ANY(a) AND b>?*/} + 6 "b < 'zzz'" {/*SCAN TABLE t3*/} +} { + set sql "EXPLAIN QUERY PLAN SELECT * FROM t3 WHERE $q" + do_execsql_test 3.3.$tn $sql $res +} + finish_test From 6696ba3eab6a8a78ca72143aa8ed39809cecfa1b Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 28 Jun 2014 19:06:49 +0000 Subject: [PATCH 48/55] Add an OOM fault injection test for the new code on this branch. FossilOrigin-Name: c96de490ac77dd23c108004b95152cce4922fe27 --- manifest | 14 +++++----- manifest.uuid | 2 +- src/vdbeaux.c | 2 ++ test/mallocK.test | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index c6e5aaa9c2..84b9befd7b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sfurther\stests\sto\sskipscan5.test. -D 2014-06-28T17:35:15.306 +C Add\san\sOOM\sfault\sinjection\stest\sfor\sthe\snew\scode\son\sthis\sbranch. +D 2014-06-28T19:06:49.846 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -287,7 +287,7 @@ F src/vdbe.c 9bfe6becfc094382ae213656fbe511055ad83a54 F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8 F src/vdbeInt.h 5df5e9afe9b7839cd17256220fc4f7af84b8b1cd F src/vdbeapi.c 0ed6053f947edd0b30f64ce5aeb811872a3450a4 -F src/vdbeaux.c e493f38758c4b8f4ca2007cf6a700bd405d192f3 +F src/vdbeaux.c 8ce7dcdbb8c59e5c2194518ce3099b254ae94c15 F src/vdbeblob.c 9205ce9d3b064d9600f8418a897fc88b5687d9ac F src/vdbemem.c d90a1e8acf8b63dc9d14cbbea12bfec6cec31394 F src/vdbesort.c 44441d73b08b3a638dcdb725afffb87c6574ad27 @@ -693,7 +693,7 @@ F test/mallocG.test 0ff91b65c50bdaba680fb75d87fe4ad35bb7934f F test/mallocH.test 79b65aed612c9b3ed2dcdaa727c85895fd1bfbdb F test/mallocI.test a88c2b9627c8506bf4703d8397420043a786cdb6 F test/mallocJ.test b5d1839da331d96223e5f458856f8ffe1366f62e -F test/mallocK.test d79968641d1b70d88f6c01bdb9a7eb4a55582cc9 +F test/mallocK.test 3cff7c0f64735f6883bacdd294e45a6ed5714817 F test/malloc_common.tcl 58e54229c4132ef882a11fab6419ec4cd3073589 F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f @@ -1182,7 +1182,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P ef5cdf949bb53a2958fa34e176b4b9eeda269de5 -R f17ac3e5a608781f5afc70c3d4b0020c +P 4b8230e8fe93e73a615a46708aed5fa3557b6228 +R 626c4988935b78bcb3d2f8f34291bc5b U dan -Z 86f494cb467655f573b06b5ade5b9c90 +Z 19d12a554b06297187fc9a292703f2d4 diff --git a/manifest.uuid b/manifest.uuid index fa3d4db391..d74a6bd2f9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4b8230e8fe93e73a615a46708aed5fa3557b6228 \ No newline at end of file +c96de490ac77dd23c108004b95152cce4922fe27 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 0a6b536720..de61b55c83 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3589,6 +3589,7 @@ int sqlite3VdbeRecordCompare( ** value. */ assert( CORRUPT_DB || pPKey2->default_rc==vdbeRecordCompareDebug(nKey1, pKey1, pPKey2) + || pKeyInfo->db->mallocFailed ); return pPKey2->default_rc; } @@ -3754,6 +3755,7 @@ static int vdbeRecordCompareString( || (res<0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)<0) || (res>0 && vdbeRecordCompareDebug(nKey1, pKey1, pPKey2)>0) || CORRUPT_DB + || pPKey2->pKeyInfo->db->mallocFailed ); return res; } diff --git a/test/mallocK.test b/test/mallocK.test index 971bd56137..dcf00da9aa 100644 --- a/test/mallocK.test +++ b/test/mallocK.test @@ -16,6 +16,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/malloc_common.tcl +set testprefix mallocK set sql {SELECT * FROM t1, t2 WHERE (a=1 OR a=2)} for {set x 1} {$x<5} {incr x} { @@ -68,5 +69,70 @@ ifcapable vtab { } } +#------------------------------------------------------------------------- +# Test that OOM errors are correctly handled by the code that uses stat4 +# data to estimate the number of rows visited by a skip-scan range query. +# +add_alignment_test_collations db +do_execsql_test 6.0 { + CREATE TABLE t3(a TEXT, b TEXT COLLATE utf16_aligned, c); + INSERT INTO t3 VALUES('one', '.....', 0); + INSERT INTO t3 VALUES('one', '....x', 1); + INSERT INTO t3 VALUES('one', '...x.', 2); + INSERT INTO t3 VALUES('one', '...xx', 3); + INSERT INTO t3 VALUES('one', '..x..', 4); + INSERT INTO t3 VALUES('one', '..x.x', 5); + INSERT INTO t3 VALUES('one', '..xx.', 6); + INSERT INTO t3 VALUES('one', '..xxx', 7); + INSERT INTO t3 VALUES('one', '.x...', 8); + INSERT INTO t3 VALUES('one', '.x..x', 9); + INSERT INTO t3 VALUES('one', '.x.x.', 10); + INSERT INTO t3 VALUES('one', '.x.xx', 11); + INSERT INTO t3 VALUES('one', '.xx..', 12); + INSERT INTO t3 VALUES('one', '.xx.x', 13); + INSERT INTO t3 VALUES('one', '.xxx.', 14); + INSERT INTO t3 VALUES('one', '.xxxx', 15); + + INSERT INTO t3 VALUES('two', 'x....', 16); + INSERT INTO t3 VALUES('two', 'x...x', 17); + INSERT INTO t3 VALUES('two', 'x..x.', 18); + INSERT INTO t3 VALUES('two', 'x..xx', 19); + INSERT INTO t3 VALUES('two', 'x.x..', 20); + INSERT INTO t3 VALUES('two', 'x.x.x', 21); + INSERT INTO t3 VALUES('two', 'x.xx.', 22); + INSERT INTO t3 VALUES('two', 'x.xxx', 23); + INSERT INTO t3 VALUES('two', 'xx...', 24); + INSERT INTO t3 VALUES('two', 'xx..x', 25); + INSERT INTO t3 VALUES('two', 'xx.x.', 26); + INSERT INTO t3 VALUES('two', 'xx.xx', 27); + INSERT INTO t3 VALUES('two', 'xxx..', 28); + INSERT INTO t3 VALUES('two', 'xxx.x', 29); + INSERT INTO t3 VALUES('two', 'xxxx.', 30); + INSERT INTO t3 VALUES('two', 'xxxxx', 31); + + INSERT INTO t3 SELECT * FROM t3; + + CREATE INDEX i3 ON t3(a, b); + ANALYZE; + + SELECT 'x' > '.'; +} {1} + +ifcapable stat4 { + do_eqp_test 6.1 { + SELECT DISTINCT c FROM t3 WHERE b BETWEEN '.xx..' AND '.xxxx'; + } { + 0 0 0 {SEARCH TABLE t3 USING INDEX i3 (ANY(a) AND b>? AND b Date: Mon, 30 Jun 2014 11:14:26 +0000 Subject: [PATCH 49/55] Add makefile targets for various diagnostic tools, such as showstat4. Fix harmless compiler warnings in diagnostic tools. FossilOrigin-Name: 6f86d89b8800c50035da7809bff941d08a33a6a2 --- Makefile.in | 16 ++++++++++++++-- Makefile.msc | 16 ++++++++++++++++ main.mk | 20 ++++++++++++++++++-- manifest | 22 +++++++++++----------- manifest.uuid | 2 +- tool/showdb.c | 4 ++-- tool/showjournal.c | 19 +++++++++---------- 7 files changed, 71 insertions(+), 28 deletions(-) diff --git a/Makefile.in b/Makefile.in index 72f7cfc007..b5768e83a6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -939,8 +939,20 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/test_stat.c $(TOP)/src/tclsqlite.c $(TO sqlite3_analyzer$(TEXE): sqlite3_analyzer.c $(LTLINK) sqlite3_analyzer.c -o $@ $(LIBTCL) $(TLIBS) -showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.c - $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.c $(TLIBS) +showdb$(TEXE): $(TOP)/tool/showdb.c sqlite3.lo + $(LTLINK) -o $@ $(TOP)/tool/showdb.c sqlite3.lo $(TLIBS) + +showstat4$(TEXE): $(TOP)/tool/showstat4.c sqlite3.lo + $(LTLINK) -o $@ $(TOP)/tool/showstat4.c sqlite3.lo $(TLIBS) + +showjournal$(TEXE): $(TOP)/tool/showjournal.c sqlite3.lo + $(LTLINK) -o $@ $(TOP)/tool/showjournal.c sqlite3.lo $(TLIBS) + +showwal$(TEXE): $(TOP)/tool/showwal.c sqlite3.lo + $(LTLINK) -o $@ $(TOP)/tool/showwal.c sqlite3.lo $(TLIBS) + +rollback-test$(TEXE): $(TOP)/tool/rollback-test.c sqlite3.lo + $(LTLINK) -o $@ $(TOP)/tool/rollback-test.c sqlite3.lo $(TLIBS) LogEst$(TEXE): $(TOP)/tool/logest.c sqlite3.h $(LTLINK) -I. -o $@ $(TOP)/tool/logest.c diff --git a/Makefile.msc b/Makefile.msc index 409f7b3d28..55d26e3053 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -1435,6 +1435,22 @@ showdb.exe: $(TOP)\tool\showdb.c $(SQLITE3C) $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ $(TOP)\tool\showdb.c $(SQLITE3C) +showstat4.exe: $(TOP)\tool\showstat4.c $(SQLITE3C) + $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ + $(TOP)\tool\showstat4.c $(SQLITE3C) + +showjournal.exe: $(TOP)\tool\showjournal.c $(SQLITE3C) + $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ + $(TOP)\tool\showjournal.c $(SQLITE3C) + +showwal.exe: $(TOP)\tool\showwal.c $(SQLITE3C) + $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ + $(TOP)\tool\showwal.c $(SQLITE3C) + +rollback-test.exe: $(TOP)\tool\rollback-test.c $(SQLITE3C) + $(LTLINK) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -Fe$@ \ + $(TOP)\tool\rollback-test.c $(SQLITE3C) + LogEst.exe: $(TOP)\tool\logest.c sqlite3.h $(LTLINK) -Fe$@ $(TOP)\tool\LogEst.c diff --git a/main.mk b/main.mk index 30149eccab..62b6b22475 100644 --- a/main.mk +++ b/main.mk @@ -628,9 +628,25 @@ $(TEST_EXTENSION): $(TOP)/src/test_loadext.c extensiontest: testfixture$(EXE) $(TEST_EXTENSION) ./testfixture$(EXE) $(TOP)/test/loadext.test -showdb$(EXE): $(TOP)/tool/showdb.c sqlite3.c +showdb$(EXE): $(TOP)/tool/showdb.c sqlite3.o $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showdb$(EXE) \ - $(TOP)/tool/showdb.c sqlite3.c + $(TOP)/tool/showdb.c sqlite3.o $(THREADLIB) + +showstat4$(EXE): $(TOP)/tool/showstat4.c sqlite3.o + $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showstat4$(EXE) \ + $(TOP)/tool/showstat4.c sqlite3.o $(THREADLIB) + +showjournal$(EXE): $(TOP)/tool/showjournal.c sqlite3.o + $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showjournal$(EXE) \ + $(TOP)/tool/showjournal.c sqlite3.o $(THREADLIB) + +showwal$(EXE): $(TOP)/tool/showwal.c sqlite3.o + $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o showwal$(EXE) \ + $(TOP)/tool/showwal.c sqlite3.o $(THREADLIB) + +rollback-test$(EXE): $(TOP)/tool/rollback-test.c sqlite3.o + $(TCC) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -o rollback-test$(EXE) \ + $(TOP)/tool/rollback-test.c sqlite3.o $(THREADLIB) LogEst$(EXE): $(TOP)/tool/logest.c sqlite3.h $(TCC) -o LogEst$(EXE) $(TOP)/tool/logest.c diff --git a/manifest b/manifest index 27807f1cbc..5cda3a858e 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Add\ssome\smore\sIN\soperator\stests. -D 2014-06-26T22:17:21.764 +C Add\smakefile\stargets\sfor\svarious\sdiagnostic\stools,\ssuch\sas\sshowstat4.\nFix\sharmless\scompiler\swarnings\sin\sdiagnostic\stools. +D 2014-06-30T11:14:26.241 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f -F Makefile.in b03432313a3aad96c706f8164fb9f5307eaf19f5 +F Makefile.in 1732320ecac3fee229d560d7ef2afa34681d1815 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc b2d3ac211b479fa5a6c9aaf3b9c49fdea900d228 +F Makefile.msc ad60c4d8be35f98fdcca614088b84a91612b2b4c F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 F VERSION 9f823c026c6a32fc5f84d212a8aae0a221dba45c @@ -146,7 +146,7 @@ F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 F magic.txt 8273bf49ba3b0c8559cb2774495390c31fd61c60 -F main.mk 7b1d0be0840f213405c977c87917241158126a33 +F main.mk 7850d834ca7f3c772e2b0087631868d5bfdeabb9 F mkopcodec.awk c2ff431854d702cdd2d779c9c0d1f58fa16fa4ea F mkopcodeh.awk c6b3fa301db6ef7ac916b14c60868aeaec1337b5 F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83 @@ -1159,8 +1159,8 @@ F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c F tool/pagesig.c ff0ca355fd3c2398e933da5e22439bbff89b803b F tool/restore_jrnl.tcl 6957a34f8f1f0f8285e07536225ec3b292a9024a F tool/rollback-test.c 9fc98427d1e23e84429d7e6d07d9094fbdec65a5 -F tool/showdb.c b018a8a69d07050fc0fe9afcf17313cdef0cc599 -F tool/showjournal.c b62cecaab86a4053d944c276bb5232e4d17ece02 +F tool/showdb.c 213e0288501b2cf67c1b2c72a9e5b8acda4738b3 +F tool/showjournal.c 053eb1cc774710c6890b7dd6293300cc297b16a5 F tool/showstat4.c c39279d6bd37cb999b634f0064f6f86ad7af008f F tool/showwal.c 3f7f7da5ec0cba51b1449a75f700493377da57b5 F tool/soak1.tcl 8d407956e1a45b485a8e072470a3e629a27037fe @@ -1181,7 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 92f7ad43dbfe4e02490df2f932c3c74fb89064d6 -R 61cea95999002249f7da20d93ec0602d -U mistachkin -Z 2021f223ccdab7be5b0b3bf69eadf881 +P fb32e374b75b160e7b535e732ced6c34dbb513eb +R 46fc4bdeeae8d59d2e02be8ec2b2e5ac +U drh +Z cf9f7f35abbae67619fbb464751389eb diff --git a/manifest.uuid b/manifest.uuid index 9daab53ded..2b01869e56 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fb32e374b75b160e7b535e732ced6c34dbb513eb \ No newline at end of file +6f86d89b8800c50035da7809bff941d08a33a6a2 \ No newline at end of file diff --git a/tool/showdb.c b/tool/showdb.c index bf4af444b2..8dd387365c 100644 --- a/tool/showdb.c +++ b/tool/showdb.c @@ -66,7 +66,7 @@ static unsigned char *getContent(int ofst, int nByte){ if( aData==0 ) out_of_memory(); memset(aData, 0, nByte+32); lseek(db, ofst, SEEK_SET); - read(db, aData, nByte); + if( read(db, aData, nByte)=nByte ){ @@ -74,7 +73,7 @@ static unsigned print_decode_line( ** in global variables. */ static unsigned decode_journal_header(int iOfst){ - char *pHdr = read_content(64, iOfst); + unsigned char *pHdr = read_content(64, iOfst); unsigned nPage; printf("Header at offset %d:\n", iOfst); print_decode_line(pHdr, 0, 4, "Header part 1 (3654616569)"); @@ -101,12 +100,11 @@ static void print_page(int iOfst){ char zTitle[50]; aData = read_content(pageSize+8, iOfst); sprintf(zTitle, "page number for page at offset %d", iOfst); - print_decode_line(aData, 0, 4, zTitle); + print_decode_line(aData-iOfst, iOfst, 4, zTitle); free(aData); } int main(int argc, char **argv){ - int rc; int nPage, cnt; int iOfst; if( argc!=2 ){ @@ -136,4 +134,5 @@ int main(int argc, char **argv){ iOfst = (iOfst/sectorSize + 1)*sectorSize; } fclose(db); + return 0; } From 48be0c51d4ed30e9a3d9f492870796f4bd13b85f Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 30 Jun 2014 13:32:39 +0000 Subject: [PATCH 50/55] Generate complete samples for sqlite_stat4 on WITHOUT ROWID tables. Ticket [b2fa5424e6fcb15b5] FossilOrigin-Name: 8cb43eddab83c68b2163441df70e0e9496d5fa33 --- manifest | 15 +++++++++------ manifest.uuid | 2 +- src/analyze.c | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 5cda3a858e..cbc32f11a2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\smakefile\stargets\sfor\svarious\sdiagnostic\stools,\ssuch\sas\sshowstat4.\nFix\sharmless\scompiler\swarnings\sin\sdiagnostic\stools. -D 2014-06-30T11:14:26.241 +C Generate\scomplete\ssamples\sfor\ssqlite_stat4\son\sWITHOUT\sROWID\stables.\nTicket\s[b2fa5424e6fcb15b5] +D 2014-06-30T13:32:39.153 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1732320ecac3fee229d560d7ef2afa34681d1815 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -161,7 +161,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F src/alter.c b00900877f766f116f9e16116f1ccacdc21d82f1 -F src/analyze.c e8c8a9d20beb2ad156321330e8f4fea002d8deee +F src/analyze.c b53dddb5a1bc4c28877952cd9ea6943aea62215d F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52 F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53 @@ -1181,7 +1181,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P fb32e374b75b160e7b535e732ced6c34dbb513eb -R 46fc4bdeeae8d59d2e02be8ec2b2e5ac +P 6f86d89b8800c50035da7809bff941d08a33a6a2 +R 63e5822670c3cf845c9d764a3e96a618 +T *branch * stat4-without-rowid +T *sym-stat4-without-rowid * +T -sym-trunk * U drh -Z cf9f7f35abbae67619fbb464751389eb +Z 2446f0a421b05370ddd23634c032efe0 diff --git a/manifest.uuid b/manifest.uuid index 2b01869e56..3cbe4903ed 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6f86d89b8800c50035da7809bff941d08a33a6a2 \ No newline at end of file +8cb43eddab83c68b2163441df70e0e9496d5fa33 \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index 4dcd7e8b8f..e112239a74 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -1045,7 +1045,7 @@ static void analyzeOneTable( ** the regPrev array and a trailing rowid (the rowid slot is required ** when building a record to insert into the sample column of ** the sqlite_stat4 table. */ - pParse->nMem = MAX(pParse->nMem, regPrev+nCol); + pParse->nMem = MAX(pParse->nMem, regPrev+pIdx->nColumn); /* Open a read-only cursor on the index being analyzed. */ assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) ); @@ -1186,11 +1186,12 @@ static void analyzeOneTable( sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, pIdx->aiColumn[0], regSample); #else - for(i=0; inColumn-1; + for(; i>=0; i--){ i16 iCol = pIdx->aiColumn[i]; sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, iCol, regCol+i); } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, nCol+1, regSample); + sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, pIdx->nColumn, regSample); #endif sqlite3VdbeAddOp3(v, OP_MakeRecord, regTabname, 6, regTemp); sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid); From 971fd0713572a7b3c2420e516327bbe8c97711da Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 30 Jun 2014 13:56:34 +0000 Subject: [PATCH 51/55] Omit non-primary-key columns from the STAT4 samples for WITHOUT ROWID tables. Indexes, both rowid and without-rowid, still hold an exact copy of the index entry. FossilOrigin-Name: de826c31589258f0906f87d65796944103e36d5b --- manifest | 15 ++++++--------- manifest.uuid | 2 +- src/analyze.c | 11 ++++++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/manifest b/manifest index cbc32f11a2..e5da47ab1f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Generate\scomplete\ssamples\sfor\ssqlite_stat4\son\sWITHOUT\sROWID\stables.\nTicket\s[b2fa5424e6fcb15b5] -D 2014-06-30T13:32:39.153 +C Omit\snon-primary-key\scolumns\sfrom\sthe\sSTAT4\ssamples\sfor\sWITHOUT\sROWID\stables.\nIndexes,\sboth\srowid\sand\swithout-rowid,\sstill\shold\san\sexact\scopy\nof\sthe\sindex\sentry. +D 2014-06-30T13:56:34.968 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1732320ecac3fee229d560d7ef2afa34681d1815 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -161,7 +161,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F src/alter.c b00900877f766f116f9e16116f1ccacdc21d82f1 -F src/analyze.c b53dddb5a1bc4c28877952cd9ea6943aea62215d +F src/analyze.c 0f9ee2f88f7c564cedb16f8e0236f2d5ac8429aa F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52 F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53 @@ -1181,10 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6f86d89b8800c50035da7809bff941d08a33a6a2 -R 63e5822670c3cf845c9d764a3e96a618 -T *branch * stat4-without-rowid -T *sym-stat4-without-rowid * -T -sym-trunk * +P 8cb43eddab83c68b2163441df70e0e9496d5fa33 +R 76a8cf4e27cd1a26fe3722da49c987a3 U drh -Z 2446f0a421b05370ddd23634c032efe0 +Z d18fb0d5c10defb46f6f8aaff06ea5cb diff --git a/manifest.uuid b/manifest.uuid index 3cbe4903ed..96bf983d21 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8cb43eddab83c68b2163441df70e0e9496d5fa33 \ No newline at end of file +de826c31589258f0906f87d65796944103e36d5b \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index e112239a74..9a2b38f2b7 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -1166,6 +1166,7 @@ static void analyzeOneTable( int regSampleRowid = regCol + nCol; int addrNext; int addrIsNull; + int nSampleCol; u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; pParse->nMem = MAX(pParse->nMem, regCol+nCol+1); @@ -1186,12 +1187,16 @@ static void analyzeOneTable( sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, pIdx->aiColumn[0], regSample); #else - i = HasRowid(pTab) ? nCol-1 : pIdx->nColumn-1; - for(; i>=0; i--){ + if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){ + nSampleCol = pIdx->nKeyCol; + }else{ + nSampleCol = pIdx->nColumn; + } + for(i=nSampleCol-1; i>=0; i--){ i16 iCol = pIdx->aiColumn[i]; sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, iCol, regCol+i); } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, pIdx->nColumn, regSample); + sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, nSampleCol, regSample); #endif sqlite3VdbeAddOp3(v, OP_MakeRecord, regTabname, 6, regTemp); sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid); From 39129ce8d9cb0101bad783fa06365332e0ddd83d Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 30 Jun 2014 15:23:57 +0000 Subject: [PATCH 52/55] Fix where.c so that the primary key values appended to every index entry on a WITHOUT ROWID table may be used when useful. FossilOrigin-Name: 6624a61d16e47ad691c4195ca8a1d68b7348118d --- manifest | 16 +++++----- manifest.uuid | 2 +- src/where.c | 20 ++++++------- test/without_rowid1.test | 64 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 20 deletions(-) diff --git a/manifest b/manifest index e5da47ab1f..91948b0449 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Omit\snon-primary-key\scolumns\sfrom\sthe\sSTAT4\ssamples\sfor\sWITHOUT\sROWID\stables.\nIndexes,\sboth\srowid\sand\swithout-rowid,\sstill\shold\san\sexact\scopy\nof\sthe\sindex\sentry. -D 2014-06-30T13:56:34.968 +C Fix\swhere.c\sso\sthat\sthe\sprimary\skey\svalues\sappended\sto\severy\sindex\sentry\son\sa\sWITHOUT\sROWID\stable\smay\sbe\sused\swhen\suseful. +D 2014-06-30T15:23:57.908 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1732320ecac3fee229d560d7ef2afa34681d1815 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 7b9e13cff91a2f14ac61e6a1bc3a83b5113e6298 +F src/where.c da15506cd52de8717836921da8ebd9109228f94e F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1122,7 +1122,7 @@ F test/win32longpath.test 169c75a3b2e43481f4a62122510210c67b08f26d F test/with1.test 268081a6b14817a262ced4d0ee34d4d2a1dd2068 F test/with2.test ee227a663586aa09771cafd4fa269c5217eaf775 F test/withM.test e97f2a8c506ab3ea9eab94e6f6072f6cc924c991 -F test/without_rowid1.test e00a0a9dc9f0be651f011d61e8a32b7add5afb30 +F test/without_rowid1.test 7862e605753c8d25329f665fa09072e842183151 F test/without_rowid2.test af260339f79d13cb220288b67cd287fbcf81ad99 F test/without_rowid3.test eac3d5c8a1924725b58503a368f2cbd24fd6c8a0 F test/without_rowid4.test 4e08bcbaee0399f35d58b5581881e7a6243d458a @@ -1181,7 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 8cb43eddab83c68b2163441df70e0e9496d5fa33 -R 76a8cf4e27cd1a26fe3722da49c987a3 -U drh -Z d18fb0d5c10defb46f6f8aaff06ea5cb +P de826c31589258f0906f87d65796944103e36d5b +R 8442f880f57a242b77225992393b657c +U dan +Z 6c9f8a4d0a3c007f8c2ac1857a8d9913 diff --git a/manifest.uuid b/manifest.uuid index 96bf983d21..cff31f409b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -de826c31589258f0906f87d65796944103e36d5b \ No newline at end of file +6624a61d16e47ad691c4195ca8a1d68b7348118d \ No newline at end of file diff --git a/src/where.c b/src/where.c index fd5831872b..2ec5caf99d 100644 --- a/src/where.c +++ b/src/where.c @@ -544,7 +544,7 @@ static WhereTerm *whereScanInit( if( pIdx && iColumn>=0 ){ pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity; for(j=0; pIdx->aiColumn[j]!=iColumn; j++){ - if( NEVER(j>=pIdx->nKeyCol) ) return 0; + if( NEVER(j>pIdx->nColumn) ) return 0; } pScan->zCollName = pIdx->azColl[j]; }else{ @@ -2645,7 +2645,7 @@ static char *explainIndexRange(sqlite3 *db, WhereLoop *pLoop, Table *pTab){ txt.db = db; sqlite3StrAccumAppend(&txt, " (", 2); for(i=0; inKeyCol ) ? "rowid" : aCol[aiColumn[i]].zName; + char *z = aiColumn[i] < 0 ? "rowid" : aCol[aiColumn[i]].zName; if( i>=nSkip ){ explainAppendTerm(&txt, i, z, "="); }else{ @@ -2658,11 +2658,11 @@ static char *explainIndexRange(sqlite3 *db, WhereLoop *pLoop, Table *pTab){ j = i; if( pLoop->wsFlags&WHERE_BTM_LIMIT ){ - char *z = (j==pIndex->nKeyCol ) ? "rowid" : aCol[aiColumn[j]].zName; + char *z = aiColumn[j] < 0 ? "rowid" : aCol[aiColumn[j]].zName; explainAppendTerm(&txt, i++, z, ">"); } if( pLoop->wsFlags&WHERE_TOP_LIMIT ){ - char *z = (j==pIndex->nKeyCol ) ? "rowid" : aCol[aiColumn[j]].zName; + char *z = aiColumn[j] < 0 ? "rowid" : aCol[aiColumn[j]].zName; explainAppendTerm(&txt, i, z, "<"); } sqlite3StrAccumAppend(&txt, ")", 1); @@ -4164,12 +4164,9 @@ static int whereLoopAddBtreeIndex( } if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); - assert( pNew->u.btree.nEq<=pProbe->nKeyCol ); - if( pNew->u.btree.nEq < pProbe->nKeyCol ){ - iCol = pProbe->aiColumn[pNew->u.btree.nEq]; - }else{ - iCol = -1; - } + assert( pNew->u.btree.nEqnColumn ); + iCol = pProbe->aiColumn[pNew->u.btree.nEq]; + pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, iCol, opMask, pProbe); saved_nEq = pNew->u.btree.nEq; @@ -4359,7 +4356,7 @@ static int whereLoopAddBtreeIndex( } if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 - && pNew->u.btree.nEq<(pProbe->nKeyCol + (pProbe->zName!=0)) + && pNew->u.btree.nEqnColumn ){ whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn); } @@ -4506,6 +4503,7 @@ static int whereLoopAddBtree( Index *pFirst; /* First of real indices on the table */ memset(&sPk, 0, sizeof(Index)); sPk.nKeyCol = 1; + sPk.nColumn = 1; sPk.aiColumn = &aiColumnPk; sPk.aiRowLogEst = aiRowEstPk; sPk.onError = OE_Replace; diff --git a/test/without_rowid1.test b/test/without_rowid1.test index bdd03c57bb..9d7a6430fe 100644 --- a/test/without_rowid1.test +++ b/test/without_rowid1.test @@ -213,5 +213,69 @@ do_execsql_test 4.1 { do_execsql_test 4.2 { SELECT t42.rowid FROM t42, t41; } {1} + + +#-------------------------------------------------------------------------- +# The following tests verify that the trailing PK fields added to each +# entry in an index on a WITHOUT ROWID table are used correctly. +# +do_execsql_test 5.0 { + CREATE TABLE t45(a PRIMARY KEY, b, c) WITHOUT ROWID; + CREATE INDEX i45 ON t45(b); + + INSERT INTO t45 VALUES(2, 'one', 'x'); + INSERT INTO t45 VALUES(4, 'one', 'x'); + INSERT INTO t45 VALUES(6, 'one', 'x'); + INSERT INTO t45 VALUES(8, 'one', 'x'); + INSERT INTO t45 VALUES(10, 'one', 'x'); + + INSERT INTO t45 VALUES(1, 'two', 'x'); + INSERT INTO t45 VALUES(3, 'two', 'x'); + INSERT INTO t45 VALUES(5, 'two', 'x'); + INSERT INTO t45 VALUES(7, 'two', 'x'); + INSERT INTO t45 VALUES(9, 'two', 'x'); +} + +do_eqp_test 5.1 { + SELECT * FROM t45 WHERE b=? AND a>? +} {/*USING INDEX i45 (b=? AND a>?)*/} + +do_execsql_test 5.2 { + SELECT * FROM t45 WHERE b='two' AND a>4 +} {5 two x 7 two x 9 two x} + +do_execsql_test 5.3 { + SELECT * FROM t45 WHERE b='one' AND a<8 +} { 2 one x 4 one x 6 one x } + +do_execsql_test 5.4 { + CREATE TABLE t46(a, b, c, d, PRIMARY KEY(a, b)) WITHOUT ROWID; + WITH r(x) AS ( + SELECT 1 UNION ALL SELECT x+1 FROM r WHERE x<100 + ) + INSERT INTO t46 SELECT x / 20, x % 20, x % 10, x FROM r; +} + +set queries { + 1 2 "c = 5 AND a = 1" {/*i46 (c=? AND a=?)*/} + 2 6 "c = 4 AND a < 3" {/*i46 (c=? AND a= 3" {/*i46 (c=? AND a>?)*/} + 4 1 "c = 2 AND a = 1 AND b<10" {/*i46 (c=? AND a=? AND b5" {/*i46 (c=? AND a=? AND b>?)*/} +} + +foreach {tn cnt where eqp} $queries { + do_execsql_test 5.5.$tn.1 "SELECT count(*) FROM t46 WHERE $where" $cnt +} + +do_execsql_test 5.6 { + CREATE INDEX i46 ON t46(c); +} + +foreach {tn cnt where eqp} $queries { + do_execsql_test 5.7.$tn.1 "SELECT count(*) FROM t46 WHERE $where" $cnt + do_eqp_test 5.7.$tn.2 "SELECT count(*) FROM t46 WHERE $where" $eqp +} + finish_test From ec9e55d35818a428140fd31a6004efb039175311 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 30 Jun 2014 17:07:39 +0000 Subject: [PATCH 53/55] Fix the STAT4 information for WITHOUT ROWID tables. FossilOrigin-Name: 5d8628fdffbcf837313958f0ee1ed8a2043d384e --- manifest | 14 +++++----- manifest.uuid | 2 +- src/analyze.c | 73 +++++++++++++++++++++++++++++---------------------- 3 files changed, 50 insertions(+), 39 deletions(-) diff --git a/manifest b/manifest index 91948b0449..0580d58225 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\swhere.c\sso\sthat\sthe\sprimary\skey\svalues\sappended\sto\severy\sindex\sentry\son\sa\sWITHOUT\sROWID\stable\smay\sbe\sused\swhen\suseful. -D 2014-06-30T15:23:57.908 +C Fix\sthe\sSTAT4\sinformation\sfor\sWITHOUT\sROWID\stables. +D 2014-06-30T17:07:39.466 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1732320ecac3fee229d560d7ef2afa34681d1815 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -161,7 +161,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F src/alter.c b00900877f766f116f9e16116f1ccacdc21d82f1 -F src/analyze.c 0f9ee2f88f7c564cedb16f8e0236f2d5ac8429aa +F src/analyze.c ec6e0691a6a23e0239dc733109b906ee04b89cc3 F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52 F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53 @@ -1181,7 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P de826c31589258f0906f87d65796944103e36d5b -R 8442f880f57a242b77225992393b657c -U dan -Z 6c9f8a4d0a3c007f8c2ac1857a8d9913 +P 6624a61d16e47ad691c4195ca8a1d68b7348118d +R 54d510c828cc71c8f4dcbc102dfc2a66 +U drh +Z 6aa7249d11aa6d73980f37e6212dc38c diff --git a/manifest.uuid b/manifest.uuid index cff31f409b..6c0650f1c9 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6624a61d16e47ad691c4195ca8a1d68b7348118d \ No newline at end of file +5d8628fdffbcf837313958f0ee1ed8a2043d384e \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index 9a2b38f2b7..364f3b7131 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -246,6 +246,7 @@ static void openStatTable( assert( i1 ); /* >1 because it includes the rowid column */ + assert( nCol>0 ); nColUp = sizeof(tRowcnt)<8 ? (nCol+1)&~1 : nCol; + nKeyCol = sqlite3_value_int(argv[1]); + assert( nKeyCol<=nCol ); + assert( nKeyCol>0 ); /* Allocate the space required for the Stat4Accum object */ n = sizeof(*p) @@ -415,6 +429,7 @@ static void statInit( p->db = db; p->nRow = 0; p->nCol = nCol; + p->nKeyCol = nKeyCol; p->current.anDLt = (tRowcnt*)&p[1]; p->current.anEq = &p->current.anDLt[nColUp]; @@ -425,9 +440,9 @@ static void statInit( p->iGet = -1; p->mxSample = mxSample; - p->nPSample = (tRowcnt)(sqlite3_value_int64(argv[1])/(mxSample/3+1) + 1); + p->nPSample = (tRowcnt)(sqlite3_value_int64(argv[2])/(mxSample/3+1) + 1); p->current.anLt = &p->current.anEq[nColUp]; - p->iPrn = nCol*0x689e962d ^ sqlite3_value_int(argv[1])*0xd0944565; + p->iPrn = nCol*0x689e962d ^ sqlite3_value_int(argv[2])*0xd0944565; /* Set up the Stat4Accum.a[] and aBest[] arrays */ p->a = (struct Stat4Sample*)&p->current.anLt[nColUp]; @@ -450,7 +465,7 @@ static void statInit( sqlite3_result_blob(context, p, sizeof(p), stat4Destructor); } static const FuncDef statInitFuncdef = { - 1+IsStat34, /* nArg */ + 2+IsStat34, /* nArg */ SQLITE_UTF8, /* funcFlags */ 0, /* pUserData */ 0, /* pNext */ @@ -691,7 +706,7 @@ static void statPush( UNUSED_PARAMETER( argc ); UNUSED_PARAMETER( context ); - assert( p->nCol>1 ); /* Includes rowid field */ + assert( p->nCol>0 ); assert( iChngnCol ); if( p->nRow==0 ){ @@ -819,7 +834,7 @@ static void statGet( char *z; int i; - char *zRet = sqlite3MallocZero(p->nCol * 25); + char *zRet = sqlite3MallocZero( (p->nKeyCol+1)*25 ); if( zRet==0 ){ sqlite3_result_error_nomem(context); return; @@ -827,7 +842,7 @@ static void statGet( sqlite3_snprintf(24, zRet, "%llu", (u64)p->nRow); z = zRet + sqlite3Strlen30(zRet); - for(i=0; i<(p->nCol-1); i++){ + for(i=0; inKeyCol; i++){ u64 nDistinct = p->current.anDLt[i] + 1; u64 iVal = (p->nRow + nDistinct - 1) / nDistinct; sqlite3_snprintf(24, z, " %llu", iVal); @@ -996,18 +1011,19 @@ static void analyzeOneTable( if( pOnlyIdx && pOnlyIdx!=pIdx ) continue; if( pIdx->pPartIdxWhere==0 ) needTableCnt = 0; - VdbeNoopComment((v, "Begin analysis of %s", pIdx->zName)); - nCol = pIdx->nKeyCol; + if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){ + nCol = pIdx->nKeyCol; + zIdxName = pTab->zName; + }else{ + nCol = pIdx->nColumn; + zIdxName = pIdx->zName; + } aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*(nCol+1)); if( aGotoChng==0 ) continue; /* Populate the register containing the index name. */ - if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ - zIdxName = pTab->zName; - }else{ - zIdxName = pIdx->zName; - } sqlite3VdbeAddOp4(v, OP_String8, 0, regIdxname, 0, zIdxName, 0); + VdbeComment((v, "Analysis for %s.%s", pTab->zName, zIdxName)); /* ** Pseudo-code for loop that calls stat_push(): @@ -1045,7 +1061,7 @@ static void analyzeOneTable( ** the regPrev array and a trailing rowid (the rowid slot is required ** when building a record to insert into the sample column of ** the sqlite_stat4 table. */ - pParse->nMem = MAX(pParse->nMem, regPrev+pIdx->nColumn); + pParse->nMem = MAX(pParse->nMem, regPrev+nCol); /* Open a read-only cursor on the index being analyzed. */ assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) ); @@ -1061,12 +1077,13 @@ static void analyzeOneTable( ** The second argument is only used for STAT3 and STAT4 */ #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+2); + sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+3); #endif - sqlite3VdbeAddOp2(v, OP_Integer, nCol+1, regStat4+1); + sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat4+1); + sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regStat4+2); sqlite3VdbeAddOp3(v, OP_Function, 0, regStat4+1, regStat4); sqlite3VdbeChangeP4(v, -1, (char*)&statInitFuncdef, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, 1+IsStat34); + sqlite3VdbeChangeP5(v, 2+IsStat34); /* Implementation of the following: ** @@ -1166,10 +1183,9 @@ static void analyzeOneTable( int regSampleRowid = regCol + nCol; int addrNext; int addrIsNull; - int nSampleCol; u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; - pParse->nMem = MAX(pParse->nMem, regCol+nCol+1); + pParse->nMem = MAX(pParse->nMem, regCol+nCol); addrNext = sqlite3VdbeCurrentAddr(v); callStatGet(v, regStat4, STAT_GET_ROWID, regSampleRowid); @@ -1187,16 +1203,11 @@ static void analyzeOneTable( sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, pIdx->aiColumn[0], regSample); #else - if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){ - nSampleCol = pIdx->nKeyCol; - }else{ - nSampleCol = pIdx->nColumn; - } - for(i=nSampleCol-1; i>=0; i--){ + for(i=0; iaiColumn[i]; sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, iCol, regCol+i); } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, nSampleCol, regSample); + sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, nCol, regSample); #endif sqlite3VdbeAddOp3(v, OP_MakeRecord, regTabname, 6, regTemp); sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid); From fd984b81146f7e909b9e0ecbfad80cbcc6b25343 Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 30 Jun 2014 18:02:20 +0000 Subject: [PATCH 54/55] Fix a problem in where.c with using the stat4 sample data of an index on a WITHOUT ROWID table. FossilOrigin-Name: 053a210e3169732c58f84cb54c9b6f6df3a8f4ea --- manifest | 16 +++++------ manifest.uuid | 2 +- src/where.c | 4 +-- test/analyze9.test | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 11 deletions(-) diff --git a/manifest b/manifest index 0580d58225..73bea2a8c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sSTAT4\sinformation\sfor\sWITHOUT\sROWID\stables. -D 2014-06-30T17:07:39.466 +C Fix\sa\sproblem\sin\swhere.c\swith\susing\sthe\sstat4\ssample\sdata\sof\san\sindex\son\sa\sWITHOUT\sROWID\stable. +D 2014-06-30T18:02:20.849 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1732320ecac3fee229d560d7ef2afa34681d1815 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -296,7 +296,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 264df50a1b33124130b23180ded2e2c5663c652a F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c da15506cd52de8717836921da8ebd9109228f94e +F src/where.c 2bc0226fced128686c432748324351beb127829b F src/whereInt.h 929c1349b5355fd44f22cee5c14d72b3329c58a6 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -316,7 +316,7 @@ F test/analyze5.test 765c4e284aa69ca172772aa940946f55629bc8c4 F test/analyze6.test d31defa011a561b938b4608d3538c1b4e0b5e92c F test/analyze7.test bb1409afc9e8629e414387ef048b8e0e3e0bdc4f F test/analyze8.test 093d15c1c888eed5034304a98c992f7360130b88 -F test/analyze9.test 623e02a99a78fa12fe5def2fd559032d5d887e0f +F test/analyze9.test 93619368fff2db833747a6dfa9b1146a82e5d4d2 F test/analyzeA.test 1a5c40079894847976d983ca39c707aaa44b6944 F test/analyzeB.test 8bf35ee0a548aea831bf56762cb8e7fdb1db083d F test/async.test 1d0e056ba1bb9729283a0f22718d3a25e82c277b @@ -1181,7 +1181,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6624a61d16e47ad691c4195ca8a1d68b7348118d -R 54d510c828cc71c8f4dcbc102dfc2a66 -U drh -Z 6aa7249d11aa6d73980f37e6212dc38c +P 5d8628fdffbcf837313958f0ee1ed8a2043d384e +R 48fee5f306f007e5e5bc0779449b568d +U dan +Z 6e1427ceae354dbee93842f8dd267647 diff --git a/manifest.uuid b/manifest.uuid index 6c0650f1c9..e4cd819c16 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -5d8628fdffbcf837313958f0ee1ed8a2043d384e \ No newline at end of file +053a210e3169732c58f84cb54c9b6f6df3a8f4ea \ No newline at end of file diff --git a/src/where.c b/src/where.c index 2ec5caf99d..57c5a2ad14 100644 --- a/src/where.c +++ b/src/where.c @@ -2201,7 +2201,7 @@ static int whereEqualScanEst( int bOk; assert( nEq>=1 ); - assert( nEq<=(p->nKeyCol+1) ); + assert( nEq<=p->nColumn ); assert( p->aSample!=0 ); assert( p->nSample>0 ); assert( pBuilder->nRecValidp->nKeyCol ){ + if( nEq>=p->nColumn ){ *pnRow = 1; return SQLITE_OK; } diff --git a/test/analyze9.test b/test/analyze9.test index f25e5924e6..d0d3b3524f 100644 --- a/test/analyze9.test +++ b/test/analyze9.test @@ -953,4 +953,72 @@ for {set i 0} {$i<16} {incr i} { } {1} } +#------------------------------------------------------------------------- +# +reset_db + +do_execsql_test 21.0 { + CREATE TABLE t2(a, b); + CREATE INDEX i2 ON t2(a); +} + +do_test 21.1 { + for {set i 1} {$i < 100} {incr i} { + execsql { + INSERT INTO t2 VALUES(CASE WHEN $i < 80 THEN 'one' ELSE 'two' END, $i) + } + } + execsql ANALYZE +} {} + +# Condition (a='one') matches 80% of the table. (rowid<10) reduces this to +# 10%, but (rowid<50) only reduces it to 50%. So in the first case below +# the index is used. In the second, it is not. +# +do_eqp_test 21.2 { + SELECT * FROM t2 WHERE a='one' AND rowid < 10 +} {/*USING INDEX i2 (a=? AND rowid45 AND x<96) THEN 'B' ELSE 'A' END, /* Column "a" */ + x, /* Column "b" */ + CASE WHEN (x<51) THEN 'one' ELSE 'two' END, /* Column "c" */ + x /* Column "d" */ + FROM r; + + CREATE INDEX i3 ON t3(c); + CREATE INDEX i4 ON t3(d); + ANALYZE; +} + +# Expression (c='one' AND a='B') matches 5 table rows. But (c='one' AND a=A') +# matches 45. Expression (d Date: Mon, 30 Jun 2014 19:28:57 +0000 Subject: [PATCH 55/55] Bump the version number to 3.8.6. FossilOrigin-Name: f925e9baafea625f63105f8013abb3807b418379 --- VERSION | 2 +- configure | 18 +++++++++--------- manifest | 15 +++++++-------- manifest.uuid | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index 0cbfaed0d9..2e14a9557d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.8.5 +3.8.6 diff --git a/configure b/configure index 8be06033f0..8748a98406 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for sqlite 3.8.5. +# Generated by GNU Autoconf 2.62 for sqlite 3.8.6. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.8.5' -PACKAGE_STRING='sqlite 3.8.5' +PACKAGE_VERSION='3.8.6' +PACKAGE_STRING='sqlite 3.8.6' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. @@ -1483,7 +1483,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.8.5 to adapt to many kinds of systems. +\`configure' configures sqlite 3.8.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1548,7 +1548,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.8.5:";; + short | recursive ) echo "Configuration of sqlite 3.8.6:";; esac cat <<\_ACEOF @@ -1664,7 +1664,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.8.5 +sqlite configure 3.8.6 generated by GNU Autoconf 2.62 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1678,7 +1678,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.8.5, which was +It was created by sqlite $as_me 3.8.6, which was generated by GNU Autoconf 2.62. Invocation command line was $ $0 $@ @@ -14021,7 +14021,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.8.5, which was +This file was extended by sqlite $as_me 3.8.6, which was generated by GNU Autoconf 2.62. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14074,7 +14074,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -sqlite config.status 3.8.5 +sqlite config.status 3.8.6 configured by $0, generated by GNU Autoconf 2.62, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/manifest b/manifest index bbfeca06e9..d5d65422e5 100644 --- a/manifest +++ b/manifest @@ -1,12 +1,12 @@ -C Attempt\sto\suse\sSTAT4\sinformation\sto\sestimate\sthe\sselectivity\sof\sWHERE\sclause\nterms\swhen\susing\sthe\sskip-scan\soptimization. -D 2014-06-30T19:07:58.197 +C Bump\sthe\sversion\snumber\sto\s3.8.6. +D 2014-06-30T19:28:57.595 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 1732320ecac3fee229d560d7ef2afa34681d1815 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.msc ad60c4d8be35f98fdcca614088b84a91612b2b4c F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0 F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8 -F VERSION 9f823c026c6a32fc5f84d212a8aae0a221dba45c +F VERSION 1c877615a9db323e3cd301e3d57d853f9d5c4a07 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50 F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 @@ -38,7 +38,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977 F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55 -F configure 5de98fac90452f876511fee8a35565a55dfb191f x +F configure 513f1e2464c3673bcdb5471b13d98e7eeb6f5ca2 x F configure.ac 4cf9f60785143fa141b10962ccc885d973792e9a F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1 @@ -1182,8 +1182,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P bc2de8095fa9c385db0adf22ca55b0298a33c284 c96de490ac77dd23c108004b95152cce4922fe27 -R 55c9ac9304448ee4805a54515b7a2134 -T +closed c96de490ac77dd23c108004b95152cce4922fe27 +P d09ca6d5efad3e4cfa93a4dc711e6ba6079d4b4b +R 0b9fd011a99704759c36a48aebd29593 U drh -Z bab166b6f1bf8cfb185d9041a405176e +Z 99f7c1257c18120424d63d4c4b9a073c diff --git a/manifest.uuid b/manifest.uuid index 91daee692f..708593f343 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d09ca6d5efad3e4cfa93a4dc711e6ba6079d4b4b \ No newline at end of file +f925e9baafea625f63105f8013abb3807b418379 \ No newline at end of file