Compare commits

...

7 Commits

Author SHA1 Message Date
drh de016be9ad Version 3.8.7.3
FossilOrigin-Name: 647e77e853e81a5effeb4c33477910400a67ba86
2014-12-05 22:29:24 +00:00
dan 54a85187b2 Fix a buffer overread that might occur in analyze.c if SQLITE_ENABLE_STAT4 was defined.
FossilOrigin-Name: 194c90db637ad4197a54be83a665feb2a9c96014
2014-12-05 20:43:48 +00:00
drh 8a03a98ceb The KeyInfo cache must be cleared before closing the btree, not after.
Revised fix for ticket [e4a18565a36884b00edf].

FossilOrigin-Name: 48529508cfe2f9445a6940222fe5ff7cc92aef78
2014-12-05 15:25:49 +00:00
drh 69d5fb2c36 Increase the version number to 3.8.7.3.
FossilOrigin-Name: 9f7560bc453f55570eb67e1a03359f0133d66d99
2014-12-05 14:54:28 +00:00
drh 0faf7231be When closing a (shared-cache) database connection, be sure to clear out
all KeyInfo objects cached on Index objects. 
Fix for ticket [e4a18565a36884b00edf].

FossilOrigin-Name: b7905b8c5fe266f43c99a44c6b9aa4b56b2ba4d1
2014-12-05 14:51:22 +00:00
drh a4c4064d28 If a table is the right operand of a LEFT JOIN, then any column of that
table can be NULL even if that column has a NOT NULL constraint.
Fix for ticket [6f2222d550f5b0ee7ed].

FossilOrigin-Name: 5a80957b04d68cc7e0325873a409d83c1f11b52f
2014-12-04 16:29:21 +00:00
drh 5fc977b783 Version 3.8.7.2.
FossilOrigin-Name: 2ab564bf9655b7c7b97ab85cafc8a48329b27f93
2014-11-18 20:57:56 +00:00
11 changed files with 159 additions and 27 deletions
+1 -1
View File
@@ -1 +1 @@
3.8.7.2
3.8.7.3
Vendored
+9 -9
View File
@@ -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.7.2.
# Generated by GNU Autoconf 2.62 for sqlite 3.8.7.3.
#
# 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.7.2'
PACKAGE_STRING='sqlite 3.8.7.2'
PACKAGE_VERSION='3.8.7.3'
PACKAGE_STRING='sqlite 3.8.7.3'
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.7.2 to adapt to many kinds of systems.
\`configure' configures sqlite 3.8.7.3 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.7.2:";;
short | recursive ) echo "Configuration of sqlite 3.8.7.3:";;
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.7.2
sqlite configure 3.8.7.3
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.7.2, which was
It was created by sqlite $as_me 3.8.7.3, 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.7.2, which was
This file was extended by sqlite $as_me 3.8.7.3, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14074,7 +14074,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sqlite config.status 3.8.7.2
sqlite config.status 3.8.7.3
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+17 -13
View File
@@ -1,12 +1,12 @@
C Increment\sthe\sversion\snumber\sto\s3.8.7.2
D 2014-11-18T12:28:52.482
C Version\s3.8.7.3
D 2014-12-05T22:29:24.210
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc e31dee24038965fb6269d6d61073fd6b7e331dec
F Makefile.vxworks 034289efa9d591b04b1a73598623119c306cbba0
F README.md 64f270c43c38c46de749e419c22f0ae2f4499fe8
F VERSION 3978bf46d1599bc324ae171a99c4e8fca7481822
F VERSION f7ce2fe949b8b915bf1c451ffcb18160e13ba006
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 135207dac9b9ff35a91cdb17871322c26fa5de73 x
F configure 3e597ced685571768e370b3b7e04f92412b94e6e x
F configure.ac 4cf9f60785143fa141b10962ccc885d973792e9a
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
@@ -166,7 +166,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c ba266a779bc7ce10e52e59e7d3dc79fa342e8fdb
F src/analyze.c 8c322e1ecc08909526dbd5ab4421889d05f2263d
F src/analyze.c 614428e1de74f51f5db918e385f689d4fb3a895a
F src/attach.c f4e94df2d1826feda65eb0939f7f6f5f923a0ad9
F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2
F src/backup.c 8cdfeb0c8a6d8bdad3faefae418eb3dc767051b6
@@ -181,7 +181,7 @@ F src/complete.c 535183afb3c75628b78ce82612931ac7cdf26f14
F src/ctime.c bb434068b5308a857b181c2d204a320ff0d6c638
F src/date.c 57a7f9ba9f6b4d5268f5e411739066a611f99036
F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417
F src/expr.c 1891cb50510a31e96de8a54579e7d3aef60f0094
F src/expr.c 6796707fe680aa511568c9f5fc0e0b2d9d3ca57b
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7
F src/func.c ba47c1671ab3cfdafa6e9d6ee490939ea578adee
@@ -194,7 +194,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994
F src/main.c 1bdabb62205af168498a17460bdb7533b2a4a915
F src/main.c aefdbda97a8d88ffeb6c49fd72d5757a7e813594
F src/malloc.c 3c3ac67969612493d435e14b6832793209afd2ec
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
@@ -225,14 +225,14 @@ F src/pragma.c 3f3e959390a10c0131676f0e307acce372777e0f
F src/prepare.c 6ef0cf2f9274982988ed6b7cab1be23147e94196
F src/printf.c d83b573624f3f6bc12b800af7fd55ce90be70659
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
F src/resolve.c a3466128b52a86c466e47ac1a19e2174f7b5cf89
F src/resolve.c 64e9f612f68d60f8f3fcd23dcee5fc62da3c4c41
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
F src/select.c 428165951748151e87a15295b7357221433e311b
F src/shell.c 18ee8bbe9502d8848072dc2eddd1ea09254ba494
F src/sqlite.h.in 4a5e5158c189d2bcd45c7c4607c2c0eb6d25c153
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
F src/sqliteInt.h c97db3c4d20b34c050a801c93451ef18e4f22de1
F src/sqliteInt.h 474a00de22bfbbb810db22689e3d1e4099d1d921
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 961d5926e5a8fda611d385ec22c226b8635cd1cb
F src/table.c 2e99ef7ef16187e17033d9398dc962ce22dab5cb
@@ -657,7 +657,7 @@ F test/join.test 52d4d49f86d0cf46926672878c4eaf0da399104a
F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test 86675fc2919269aa923c84dd00ee4249b97990fe
F test/join5.test 5df23eba184f159ed9705a954957e765a10c141d
F test/join6.test cfe6503791ceb0cbb509966740286ec423cbf10b
F test/journal1.test 69abc726c51b4a0409189f9a85191205297c0577
F test/journal2.test ae06f566c28552c313ded3fee79a6c69e6d049b1
@@ -830,6 +830,7 @@ F test/shared7.test a81e99f83e6c51b02ac99c96fb3a2a7b5978c956
F test/shared8.test 00a07bf5e1337ecf72e94542bdefdc330d7a2538
F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21
F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
F test/shell1.test d60946b5fde4d85fe06db7331dfe89011f564350
@@ -1205,7 +1206,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 c5eae8a60d474131fbfa4d0c2b459005267e8be4
R 876a331fea8d7e2c7f47a110195c3ecb
P 194c90db637ad4197a54be83a665feb2a9c96014
R 9c03e40230b03e031df69c10ef418c3a
T +bgcolor * #d0c0ff
T +sym-release *
T +sym-version-3.8.7.3 *
U drh
Z 48596521afe0080c14cc5d1c64dcfe43
Z 1696edf186831fdcc944c05ffbed906a
+1 -1
View File
@@ -1 +1 @@
945a9e687fdfee5f7103d85d131024e85d594ac3
647e77e853e81a5effeb4c33477910400a67ba86
+1 -1
View File
@@ -1591,7 +1591,7 @@ static void initAvgEq(Index *pIdx){
i64 nSum100 = 0; /* Number of terms contributing to sumEq */
i64 nDist100; /* Number of distinct values in index */
if( pIdx->aiRowEst==0 || pIdx->aiRowEst[iCol+1]==0 ){
if( !pIdx->aiRowEst || iCol>=pIdx->nKeyCol || pIdx->aiRowEst[iCol+1]==0 ){
nRow = pFinal->anLt[iCol];
nDist100 = (i64)100 * pFinal->anDLt[iCol];
nSample--;
+2 -1
View File
@@ -1393,7 +1393,8 @@ int sqlite3ExprCanBeNull(const Expr *p){
return 0;
case TK_COLUMN:
assert( p->pTab!=0 );
return p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0;
return ExprHasProperty(p, EP_CanBeNull) ||
(p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0);
default:
return 1;
}
+8
View File
@@ -930,6 +930,14 @@ void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
for(j=0; j<db->nDb; j++){
struct Db *pDb = &db->aDb[j];
if( pDb->pBt ){
if( pDb->pSchema ){
/* Must clear the KeyInfo cache. See ticket [e4a18565a36884b00edf] */
for(i=sqliteHashFirst(&pDb->pSchema->idxHash); i; i=sqliteHashNext(i)){
Index *pIdx = sqliteHashData(i);
sqlite3KeyInfoUnref(pIdx->pKeyInfo);
pIdx->pKeyInfo = 0;
}
}
sqlite3BtreeClose(pDb->pBt);
pDb->pBt = 0;
if( j!=1 ){
+4
View File
@@ -320,6 +320,10 @@ static int lookupName(
if( pMatch ){
pExpr->iTable = pMatch->iCursor;
pExpr->pTab = pMatch->pTab;
assert( (pMatch->jointype & JT_RIGHT)==0 ); /* RIGHT JOIN not (yet) supported */
if( (pMatch->jointype & JT_LEFT)!=0 ){
ExprSetProperty(pExpr, EP_CanBeNull);
}
pSchema = pExpr->pTab->pSchema;
}
} /* if( pSrcList ) */
+2 -1
View File
@@ -2014,7 +2014,7 @@ struct Expr {
/*
** The following are the meanings of bits in the Expr.flags field.
*/
#define EP_FromJoin 0x000001 /* Originated in ON or USING clause of a join */
#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
#define EP_Agg 0x000002 /* Contains one or more aggregate functions */
#define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
#define EP_Error 0x000008 /* Expression contains one or more errors */
@@ -2034,6 +2034,7 @@ struct Expr {
#define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */
#define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */
#define EP_Constant 0x080000 /* Node is a constant */
#define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */
/*
** These macros can be used to test, set, or clear bits in the
+54
View File
@@ -106,5 +106,59 @@ do_test join5-2.12 {
execsql {SELECT * FROM xy LEFT JOIN ab ON NULL WHERE NULL}
} {}
# Ticket https://www.sqlite.org/src/tktview/6f2222d550f5b0ee7ed37601
# Incorrect output on a LEFT JOIN.
#
do_execsql_test join5-3.1 {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE TABLE x1(a);
INSERT INTO x1 VALUES(1);
CREATE TABLE x2(b NOT NULL);
CREATE TABLE x3(c, d);
INSERT INTO x3 VALUES('a', NULL);
INSERT INTO x3 VALUES('b', NULL);
INSERT INTO x3 VALUES('c', NULL);
SELECT * FROM x1 LEFT JOIN x2 LEFT JOIN x3 ON x3.d = x2.b;
} {1 {} {} {}}
do_execsql_test join5-3.2 {
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;
CREATE TABLE t1(x text NOT NULL, y text);
CREATE TABLE t2(u text NOT NULL, x text NOT NULL);
CREATE TABLE t3(w text NOT NULL, v text);
CREATE TABLE t4(w text NOT NULL, z text NOT NULL);
CREATE TABLE t5(z text NOT NULL, m text);
INSERT INTO t1 VALUES('f6d7661f-4efe-4c90-87b5-858e61cd178b',NULL);
INSERT INTO t1 VALUES('f6ea82c3-2cad-45ce-ae8f-3ddca4fb2f48',NULL);
INSERT INTO t1 VALUES('f6f47499-ecb4-474b-9a02-35be73c235e5',NULL);
INSERT INTO t1 VALUES('56f47499-ecb4-474b-9a02-35be73c235e5',NULL);
INSERT INTO t3 VALUES('007f2033-cb20-494c-b135-a1e4eb66130c',
'f6d7661f-4efe-4c90-87b5-858e61cd178b');
SELECT *
FROM t3
INNER JOIN t1 ON t1.x= t3.v AND t1.y IS NULL
LEFT JOIN t4 ON t4.w = t3.w
LEFT JOIN t5 ON t5.z = t4.z
LEFT JOIN t2 ON t2.u = t5.m
LEFT JOIN t1 xyz ON xyz.y = t2.x;
} {007f2033-cb20-494c-b135-a1e4eb66130c f6d7661f-4efe-4c90-87b5-858e61cd178b f6d7661f-4efe-4c90-87b5-858e61cd178b {} {} {} {} {} {} {} {} {}}
do_execsql_test join5-3.3 {
DROP TABLE IF EXISTS x1;
DROP TABLE IF EXISTS x2;
DROP TABLE IF EXISTS x3;
CREATE TABLE x1(a);
INSERT INTO x1 VALUES(1);
CREATE TABLE x2(b NOT NULL);
CREATE TABLE x3(c, d);
INSERT INTO x3 VALUES('a', NULL);
INSERT INTO x3 VALUES('b', NULL);
INSERT INTO x3 VALUES('c', NULL);
SELECT * FROM x1 LEFT JOIN x2 JOIN x3 WHERE x3.d = x2.b;
} {}
finish_test
+60
View File
@@ -0,0 +1,60 @@
# 2014-12-05
#
# 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.
#
#***********************************************************************
#
# Open two database connections on the same database in shared cache
# mode. Hold one open while repeatedly closing, reopening, and using
# the second.
#
# This test is designed to demostrate that the fix for ticket
# [e4a18565a36884b00edf66541f38c693827968ab] works.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
if {[run_thread_tests]==0} { finish_test ; return }
db close
set ::testprefix sharedB
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
#-------------------------------------------------------------------------
#
do_test 1.1 {
sqlite3 db1 test.db
sqlite3 db2 test.db
db1 eval {
CREATE TABLE t1(x,y TEXT COLLATE nocase);
WITH RECURSIVE
c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<100)
INSERT INTO t1(x,y) SELECT i, printf('x%03dy',i) FROM c;
CREATE INDEX t1yx ON t1(y,x);
}
db2 eval {
SELECT x FROM t1 WHERE y='X014Y';
}
} {14}
for {set j 1} {$j<=100} {incr j} {
do_test 1.2.$j {
db2 close
sqlite3 db2 test.db
db2 eval {
SELECT x FROM t1 WHERE y='X014Y';
}
} {14}
}
db1 close
db2 close
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test