1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

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