Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix an obscure problem in range estimation with STAT4. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1f16c9a76bc48331799f33b30d143c63 |
User & Date: | drh 2016-12-09 00:15:17.019 |
Context
2016-12-09
| ||
16:02 | Avoid unnecessary zeroing of fields in the MemPage object that are going to be reinitialized before use anyhow. A smaller and faster binary results. (check-in: 01ada3d106 user: drh tags: trunk) | |
00:15 | Fix an obscure problem in range estimation with STAT4. (check-in: 1f16c9a76b user: drh tags: trunk) | |
2016-12-08
| ||
23:52 | Fix the showstat4 utility program so that is displays strings using standard SQL notation (single quotes) rather than C-style notation. (check-in: 92998e4afb user: drh tags: trunk) | |
Changes
Changes to src/vdbemem.c.
︙ | ︙ | |||
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 | pVal->u.i = -pVal->u.i; } sqlite3ValueApplyAffinity(pVal, affinity, enc); } }else if( op==TK_NULL ){ pVal = valueNew(db, pCtx); if( pVal==0 ) goto no_mem; } #ifndef SQLITE_OMIT_BLOB_LITERAL else if( op==TK_BLOB ){ int nVal; assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' ); assert( pExpr->u.zToken[1]=='\'' ); pVal = valueNew(db, pCtx); | > | 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 | pVal->u.i = -pVal->u.i; } sqlite3ValueApplyAffinity(pVal, affinity, enc); } }else if( op==TK_NULL ){ pVal = valueNew(db, pCtx); if( pVal==0 ) goto no_mem; sqlite3VdbeMemNumerify(pVal); } #ifndef SQLITE_OMIT_BLOB_LITERAL else if( op==TK_BLOB ){ int nVal; assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' ); assert( pExpr->u.zToken[1]=='\'' ); pVal = valueNew(db, pCtx); |
︙ | ︙ |
Changes to test/analyzeF.test.
︙ | ︙ | |||
116 117 118 119 120 121 122 123 124 | SELECT * FROM t1 WHERE x = dstr() AND y = 11; } {1 {string or blob too big}} do_catchsql_test 4.4 { SELECT * FROM t1 WHERE x = test_zeroblob(1100000) AND y = 4; } {1 {string or blob too big}} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | SELECT * FROM t1 WHERE x = dstr() AND y = 11; } {1 {string or blob too big}} do_catchsql_test 4.4 { SELECT * FROM t1 WHERE x = test_zeroblob(1100000) AND y = 4; } {1 {string or blob too big}} # 2016-12-08: Constraints of the form "x=? AND x IS NOT NULL" were being # mishandled. The sqlite3Stat4ProbeSetValue() routine was assuming that # valueNew() was returning a Mem object that was preset to NULL, which is # not the case. The consequence was the the "x IS NOT NULL" constraint # was used to drive the index (via the "x>NULL" pseudo-constraint) rather # than the "x=?" constraint. # do_execsql_test 5.1 { DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT); WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<10000) INSERT INTO t1(a, c) SELECT x, x FROM c; UPDATE t1 SET b=printf('x%02x',a/500) WHERE a>4000; UPDATE t1 SET b='xyz' where a>=9998; CREATE INDEX t1b ON t1(b); ANALYZE; SELECT count(*), b FROM t1 GROUP BY 2 ORDER BY 2; } {4000 {} 499 x08 500 x09 500 x0a 500 x0b 500 x0c 500 x0d 500 x0e 500 x0f 500 x10 500 x11 500 x12 498 x13 3 xyz} do_execsql_test 5.2 { explain query plan SELECT * FROM t1 WHERE b='xyz' AND b IS NOT NULL ORDER BY +a; /* v---- Should be "=", not ">" */ } {/USING INDEX t1b .b=/} do_execsql_test 5.3 { SELECT * FROM t1 WHERE b='xyz' AND b IS NOT NULL ORDER BY +a; } {9998 xyz 9998 9999 xyz 9999 10000 xyz 10000} finish_test |