Fix RTREE so that it does not run queries against the sqlite_stat1 if that

table does not exist.

FossilOrigin-Name: 48526a2fe5373e3d19e8b813cc8a342d6b7c9c3d
This commit is contained in:
drh 2016-05-23 18:12:04 +00:00
parent daa14559d2
commit e62c2fe179
4 changed files with 47 additions and 7 deletions

View File

@ -3012,6 +3012,11 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){
int rc;
i64 nRow = 0;
if( sqlite3_table_column_metadata(db,pRtree->zDb,"sqlite_stat1",
0,0,0,0,0,0)==SQLITE_ERROR ){
pRtree->nRowEst = RTREE_DEFAULT_ROWEST;
return SQLITE_OK;
}
zSql = sqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName);
if( zSql==0 ){
rc = SQLITE_NOMEM;

34
ext/rtree/rtreeG.test Normal file
View File

@ -0,0 +1,34 @@
# 2016-05-32
#
# 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 contains tests for the r-tree module.
#
# Verify that no invalid SQL is run during initialization
if {![info exists testdir]} {
set testdir [file join [file dirname [info script]] .. .. test]
}
source $testdir/tester.tcl
ifcapable !rtree { finish_test ; return }
db close
sqlite3_shutdown
test_sqlite3_log [list lappend ::log]
set ::log [list]
sqlite3 db test.db
set ::log {}
do_test rtreeG-1.1 {
db eval {CREATE VIRTUAL TABLE t1 USING rtree(a,b,c);}
set ::log
} {}
finish_test

View File

@ -1,5 +1,5 @@
C Remove\san\sextra\s"finish_test"\sfrom\sthe\send\sof\srtreeC.test.
D 2016-05-23T18:06:51.504
C Fix\sRTREE\sso\sthat\sit\sdoes\snot\srun\squeries\sagainst\sthe\ssqlite_stat1\sif\sthat\ntable\sdoes\snot\sexist.
D 2016-05-23T18:12:04.371
F Makefile.in f59e0763ff448719fc1bd25513882b0567286317
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 306d73e854b1a92ea06e5d1e637faa5c44de53c7
@ -253,7 +253,7 @@ F ext/rbu/sqlite3rbu.c bf36625990c6865ecf08bd844d8097ed2d0a6958
F ext/rbu/sqlite3rbu.h 2acd0a6344a6079de15c8dc9d84d3df83a665930
F ext/rbu/test_rbu.c 9bbdf6bd8efd58fbc4f192698df50569598fbb9e
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/rtree.c 7ebca7d18261f402d67de9e151be7fb2ed62b8f5
F ext/rtree/rtree.c d26a815b0df1c412a6881dae8d7fd3c9c08cce68
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
F ext/rtree/rtree1.test 42dadfc7b44a436cd74a1bebc0b9b689e4eaf7ec
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
@ -270,6 +270,7 @@ F ext/rtree/rtreeC.test c0a9c67f2efa98b6fae12acb8a28348d231a481d
F ext/rtree/rtreeD.test 636630357638f5983701550b37f0f5867130d2ca
F ext/rtree/rtreeE.test 45a147a64a76306172819562309681d8e90f94bb
F ext/rtree/rtreeF.test 66deb9fd1611c7ca2e374adba63debdc2dbb12b4
F ext/rtree/rtreeG.test fad67b4ec080cbe41bafb68517361b74ac4632d5
F ext/rtree/rtree_perf.tcl 6c18c1f23cd48e0f948930c98dfdd37dfccb5195
F ext/rtree/rtree_util.tcl 06aab2ed5b826545bf215fff90ecb9255a8647ea
F ext/rtree/sqlite3rtree.h 9c5777af3d2921c7b4ae4954e8e5697502289d28
@ -1492,7 +1493,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 3ad2531efb64b7c53b777ddf3681203217052b32
R 181417728ff7d20d7df6a3bbac1c99fc
P bfbb6dd84b5e1335e1eae857a03fa33a71fd67a5
R 917b797124e2db7975ec6ce19d0d3f10
U drh
Z a9812f920562a373e5ac292c844442d4
Z 1720c00f1c890b6da656d7cb35d019e7

View File

@ -1 +1 @@
bfbb6dd84b5e1335e1eae857a03fa33a71fd67a5
48526a2fe5373e3d19e8b813cc8a342d6b7c9c3d