Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Hi Release Team,

Please consider unblocking the current Sid version of SQLite3. It's one
of the rare upstream immediate bugfix release. There's an RC bug filed
against the source package of the Wheezy version. But as the reporter
states the version in Jessie is also effected. The bug is very hard to
reproduce so it's not yet known if this version fixes that bug or not.
There's an other upstream immediate bugfix release, which if allowed I
would like to upload. Diffs are attached and the upstream bugfix log is:
1) for 3.8.7.2[2]:
Enhance the ROLLBACK command so that pending queries are allowed to
continue as long as the schema is unchanged. Formerly, a ROLLBACK would
cause all pending queries to fail with an SQLITE_ABORT or
SQLITE_ABORT_ROLLBACK error. That error is still returned if the
ROLLBACK modifies the schema.
  * Bug fix: Make sure that NULL results from OP_Column are fully and
    completely NULL and do not have the MEM_Ephem bit set. Ticket
    094d39a4c95ee4.
  * Bug fix: The %c format in sqlite3_mprintf() is able to handle
    precisions greater than 70.
  * Bug fix: Do not automatically remove the DISTINCT keyword from a
    SELECT that forms the right-hand side of an IN operator since it is
    necessary if the SELECT also contains a LIMIT. Ticket db87229497.

2) for 3.8.7.3[3]:
Bug fix: Ensure the cached KeyInfo objects (an internal abstraction not
visible to the application) do not go stale when operating in shared
cache mode and frequently closing and reopening some database
connections while leaving other database connections on the same shared
cache open continuously. Ticket e4a18565a36884b00edf.
  * Bug fix: Recognize that any column in the right-hand table of a LEFT
    JOIN can be NULL even if the column has a NOT NULL constraint. Do
    not apply optimizations that assume the column is never NULL. Ticket
    6f2222d550f5b0ee7ed.

As SQLite3 is used by several other packages, it would be good to have
these safe, immediate upstream fixes for Jessie.

Thanks,
Laszlo/GCS

unblock sqlite3/3.8.7.2-1

[1] https://bugs.debian.org/771341
[2] http://www.sqlite.org/releaselog/3_8_7_2.html
[3] http://www.sqlite.org/releaselog/3_8_7_3.html
diff -Nur sqlite3-3.8.7.1/configure sqlite3-3.8.7.2/configure
--- sqlite3-3.8.7.1/configure	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/configure	2014-11-19 14:10:06.000000000 +0000
@@ -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.1.
+# Generated by GNU Autoconf 2.62 for sqlite 3.8.7.2.
 #
 # 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 @@
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.8.7.1'
-PACKAGE_STRING='sqlite 3.8.7.1'
+PACKAGE_VERSION='3.8.7.2'
+PACKAGE_STRING='sqlite 3.8.7.2'
 PACKAGE_BUGREPORT=''
 
 # Factoring default headers for most tests.
@@ -1483,7 +1483,7 @@
   # 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.1 to adapt to many kinds of systems.
+\`configure' configures sqlite 3.8.7.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1548,7 +1548,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of sqlite 3.8.7.1:";;
+     short | recursive ) echo "Configuration of sqlite 3.8.7.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1664,7 +1664,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.8.7.1
+sqlite configure 3.8.7.2
 generated by GNU Autoconf 2.62
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1678,7 +1678,7 @@
 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.1, which was
+It was created by sqlite $as_me 3.8.7.2, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   $ $0 $@
@@ -14021,7 +14021,7 @@
 # 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.1, which was
+This file was extended by sqlite $as_me 3.8.7.2, which was
 generated by GNU Autoconf 2.62.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14074,7 +14074,7 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-sqlite config.status 3.8.7.1
+sqlite config.status 3.8.7.2
 configured by $0, generated by GNU Autoconf 2.62,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff -Nur sqlite3-3.8.7.1/debian/changelog sqlite3-3.8.7.2/debian/changelog
--- sqlite3-3.8.7.1/debian/changelog	2014-11-06 16:25:11.000000000 +0000
+++ sqlite3-3.8.7.2/debian/changelog	2014-12-02 14:29:41.000000000 +0000
@@ -1,3 +1,9 @@
+sqlite3 (3.8.7.2-1) unstable; urgency=medium
+
+  * New upstream bugfix release.
+
+ -- Laszlo Boszormenyi (GCS) <g...@debian.org>  Tue, 02 Dec 2014 14:28:59 +0000
+
 sqlite3 (3.8.7.1-1) unstable; urgency=medium
 
   * New upstream bugfix release.
diff -Nur sqlite3-3.8.7.1/manifest sqlite3-3.8.7.2/manifest
--- sqlite3-3.8.7.1/manifest	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/manifest	2014-11-19 14:10:06.000000000 +0000
@@ -1,12 +1,12 @@
-C Version\s3.8.7.1
-D 2014-10-29T13:59:56.070
+C Version\s3.8.7.2.
+D 2014-11-18T20:57:56.794
 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 5cc0baaee7eeee3238f0f7b5871398d17f79d0cd
+F VERSION 3978bf46d1599bc324ae171a99c4e8fca7481822
 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
 F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811
 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
@@ -38,7 +38,7 @@
 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
 F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de
 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
-F configure 56fe985cf0e59cd594f9b929099d0be40260e667 x
+F configure 135207dac9b9ff35a91cdb17871322c26fa5de73 x
 F configure.ac 4cf9f60785143fa141b10962ccc885d973792e9a
 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
 F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
@@ -169,19 +169,19 @@
 F src/analyze.c 8c322e1ecc08909526dbd5ab4421889d05f2263d
 F src/attach.c f4e94df2d1826feda65eb0939f7f6f5f923a0ad9
 F src/auth.c d8abcde53426275dab6243b441256fcd8ccbebb2
-F src/backup.c a31809c65623cc41849b94d368917f8bb66e6a7e
+F src/backup.c 8cdfeb0c8a6d8bdad3faefae418eb3dc767051b6
 F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
 F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
-F src/btree.c 1b1123cba0c65caa0baa51e71b8c089e3167c3ed
-F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
-F src/btreeInt.h 026d0129724e8f265fdc60d44ec240cf5a4e6179
+F src/btree.c c961588f01bd95d37b90359220c640f9763a3f58
+F src/btree.h a4afc6b06f5a1dd2076d15aa168baec44fc0121b
+F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21
 F src/build.c 9dc2bd94347b878c89627000c92b0c8d97ec2919
 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
 F src/complete.c 535183afb3c75628b78ce82612931ac7cdf26f14
 F src/ctime.c bb434068b5308a857b181c2d204a320ff0d6c638
 F src/date.c 57a7f9ba9f6b4d5268f5e411739066a611f99036
 F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417
-F src/expr.c fc204d08af06437ddaffe5a1b1f1f6f9e1a55d6d
+F src/expr.c 1891cb50510a31e96de8a54579e7d3aef60f0094
 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
 F src/fkey.c da985ae673efef2c712caef825a5d2edb087ead7
 F src/func.c ba47c1671ab3cfdafa6e9d6ee490939ea578adee
@@ -194,7 +194,7 @@
 F src/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
 F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
 F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994
-F src/main.c bbe872b0ac0007bed0ebe1936fc493b039ad4f51
+F src/main.c 1bdabb62205af168498a17460bdb7533b2a4a915
 F src/malloc.c 3c3ac67969612493d435e14b6832793209afd2ec
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
@@ -223,7 +223,7 @@
 F src/pcache1.c e412cb585f777c840ddce0500eddc5c6043c2bb5
 F src/pragma.c 3f3e959390a10c0131676f0e307acce372777e0f
 F src/prepare.c 6ef0cf2f9274982988ed6b7cab1be23147e94196
-F src/printf.c 090fac0f779c93c8a95089a125339686648835e4
+F src/printf.c d83b573624f3f6bc12b800af7fd55ce90be70659
 F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
 F src/resolve.c a3466128b52a86c466e47ac1a19e2174f7b5cf89
 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
@@ -232,7 +232,7 @@
 F src/sqlite.h.in 4a5e5158c189d2bcd45c7c4607c2c0eb6d25c153
 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
 F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
-F src/sqliteInt.h f7812f74f2d0c6041ef6b91a99c5a45f775dd408
+F src/sqliteInt.h c97db3c4d20b34c050a801c93451ef18e4f22de1
 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
 F src/status.c 961d5926e5a8fda611d385ec22c226b8635cd1cb
 F src/table.c 2e99ef7ef16187e17033d9398dc962ce22dab5cb
@@ -289,7 +289,7 @@
 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
 F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8
 F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
-F src/vdbe.c 5a1afb571853ddb911d698ac996bc4fd8ddf1eed
+F src/vdbe.c 8bc291aa00646d07dab33047520960ea454c5a2f
 F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327
 F src/vdbeInt.h e2a060a55ee18a6ab973353a5e2ec7ee569bf787
 F src/vdbeapi.c 37a6c6ae284a97bcace365f2f0a225680c0499d9
@@ -299,7 +299,7 @@
 F src/vdbesort.c 975aeffa99acb0991b2f288d30294756bff41438
 F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010
 F src/vtab.c cb0c194303fea276b48d7d4b6d970b5a96bde8de
-F src/wal.c 10e7de7ce90865a68153f001a61f1d985cd17983
+F src/wal.c 095d41f7114d7a8699207f5313488aa88372d540
 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
 F src/where.c 2947912f1f3d6a7766fe087fd532a5d688d745b1
@@ -378,9 +378,9 @@
 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
 F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
 F test/capi2.test 011c16da245fdc0106a2785035de6b242c05e738
-F test/capi3.test 71bcf2fbd36a9732f617766dfd752552c8e491b5
+F test/capi3.test f0718f4f90d0efdc980119bfbdf1d7f1541ee5ef
 F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
-F test/capi3c.test a21869e4d50d5dbb7e566e328fc0bc7c2efa6a32
+F test/capi3c.test fdc0d67a2cb8e8fc400d5b7735e330161ea057a2
 F test/capi3d.test c84af0c49267f9c3fbf4c1c46aa647646023811e
 F test/capi3e.test 3d49c01ef2a1a55f41d73cba2b23b5059ec460fe
 F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3
@@ -616,7 +616,7 @@
 F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
 F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
 F test/in4.test d2b38cba404bc4320f4fe1b595b3d163f212c068
-F test/in5.test 99f9a40af01711b06d2d614ecfe96129f334fba3
+F test/in5.test 1de657472fa9ac2924be25c2c959ac5ca1aae554
 F test/incrblob.test e81846d214f3637622620fbde7cd526781cfe328
 F test/incrblob2.test bf4d549aa4a466d7fbe3e3a3693d3861263d5600
 F test/incrblob3.test d8d036fde015d4a159cd3cbae9d29003b37227a4
@@ -648,7 +648,7 @@
 F test/intpkey.test 7506090fc08e028712a8bf47e5f54111947e3844
 F test/io.test 3a7abcef18727cc0f2399e04b0e8903eccae50f8
 F test/ioerr.test 2a24bd6ed5a8b062e64bfe1f6cf94fb25e92210d
-F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d
+F test/ioerr2.test 2593563599e2cc6b6b4fcf5878b177bdd5d8df26
 F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
 F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
 F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
@@ -768,7 +768,7 @@
 F test/pragma.test 19d0241a007bcdd77fc2606ec60fc60357e7fc8b
 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13
 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
-F test/printf2.test bed79b4c3e5da08ba88ad637c0bf62586843cfb1
+F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a
 F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d
 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
 F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca
@@ -785,18 +785,19 @@
 F test/releasetest.mk 2eced2f9ae701fd0a29e714a241760503ccba25a
 F test/releasetest.tcl a4279c890698584feb2ffc86735857a4e4474180
 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a
-F test/rollback.test e9504a009a202c3ed711da2e6879ff60c5a4669c
+F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
+F test/rollback2.test 552abaab8e721b6060a727d639896427059e51ec
 F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
 F test/rowid.test 742b5741584a8a44fd83e856cc2896688401d645
 F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
 F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09
-F test/savepoint.test 51d3900dc071a7c2ad4248578a5925631b476313
+F test/savepoint.test c671fdbd34cd3bfe1518a777526ada595180cf8d
 F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
 F test/savepoint3.test e328085853b14898d78ceea00dfe7db18bb6a9ec
 F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0
 F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
 F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7
-F test/savepoint7.test fbf319a7b2dda089ec5be30a424a0e95f121d423
+F test/savepoint7.test db3db281486c925095f305aad09fe806e5188ff3
 F test/schema.test 8f7999be894260f151adf15c2c7540f1c6d6a481
 F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5
 F test/schema3.test 1bc1008e1f8cb5654b248c55f27249366eb7ed38
@@ -829,7 +830,7 @@
 F test/shared8.test 00a07bf5e1337ecf72e94542bdefdc330d7a2538
 F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21
 F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
-F test/shared_err.test 0079c05c97d88cfa03989b7c20a8b266983087aa
+F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506
 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
 F test/shell1.test d60946b5fde4d85fe06db7331dfe89011f564350
 F test/shell2.test c57da3a381c099b02c813ba156298d5c2f5c93a3
@@ -873,7 +874,7 @@
 F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85
 F test/syscall.test d2fdaad713f103ac611fe7ef9b724c7b69f8149c
 F test/sysfault.test fa776e60bf46bdd3ae69f0b73e46ee3977a58ae6
-F test/table.test 2a1d2fa52c531de5915f28023747d9a8c27b6f31
+F test/table.test 06271d61eb13871490d38168433c1ef3dd82bb2a
 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
 F test/tclsqlite.test 37a61c2da7e3bfe3b8c1a2867199f6b860df5d43
@@ -943,7 +944,7 @@
 F test/tkt-d82e3f3721.test bcc0dfba658d15bab30fd4a9320c9e35d214ce30
 F test/tkt-f3e5abed55.test d5a0126118142d13e27f6ce9f4c47096e9321c00
 F test/tkt-f67b41381a.test a23bc124c981662db712167bacd0ed8ad11abac9
-F test/tkt-f777251dc7a.test af6531446c64bfd268416f07b4df7be7f9c749d2
+F test/tkt-f777251dc7a.test 6295d235a03c82160549da4841a83dc8e758932f
 F test/tkt-f7b4edec.test d998a08ff2b18b7f62edce8e3044317c45efe6c7
 F test/tkt-f973c7ac31.test 28ef85c7f015477916795246d8286aeda39d4ead
 F test/tkt-fa7bf5ec.test 9102dfea58aa371d78969da735f9392c57e2e035
@@ -1038,7 +1039,7 @@
 F test/trace2.test 93b47ca6996c66b47f57224cfb146f34e07df382
 F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
 F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
-F test/trans3.test 373ac5183cc56be69f48ae44090e7f672939f732
+F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
 F test/transitive1.test 03f532954f46cdf5608f7766bff0b0c52bf2a7cd
 F test/trigger1.test dc47573ac79ffe0ee3eecaa517d70d8dacbccd03
 F test/trigger2.test 5cd7d69a7ba1143ee045e4ae2963ff32ae4c87a6
@@ -1204,10 +1205,10 @@
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 83afe23e553e802c0947c80d0ffdd120423e7c52
-R 5381895dceb9bc7ad4d425f399561cb7
+P 945a9e687fdfee5f7103d85d131024e85d594ac3
+R 876a331fea8d7e2c7f47a110195c3ecb
 T +bgcolor * #d0c0ff
 T +sym-release *
-T +sym-version-3.8.7.1 *
+T +sym-version-3.8.7.2 *
 U drh
-Z e5ce942eb65e60b92fcaefcb5b84039b
+Z 5e45593d4fc6c698f5107e76a586ede2
diff -Nur sqlite3-3.8.7.1/manifest.uuid sqlite3-3.8.7.2/manifest.uuid
--- sqlite3-3.8.7.1/manifest.uuid	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/manifest.uuid	2014-11-19 14:10:06.000000000 +0000
@@ -1 +1 @@
-3b7b72c4685aa5cf5e675c2c47ebec10d9704221
+2ab564bf9655b7c7b97ab85cafc8a48329b27f93
diff -Nur sqlite3-3.8.7.1/src/backup.c sqlite3-3.8.7.2/src/backup.c
--- sqlite3-3.8.7.1/src/backup.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/backup.c	2014-11-19 14:10:06.000000000 +0000
@@ -597,7 +597,7 @@
   }
 
   /* If a transaction is still open on the Btree, roll it back. */
-  sqlite3BtreeRollback(p->pDest, SQLITE_OK);
+  sqlite3BtreeRollback(p->pDest, SQLITE_OK, 0);
 
   /* Set the error code of the destination database handle. */
   rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;
diff -Nur sqlite3-3.8.7.1/src/btree.c sqlite3-3.8.7.2/src/btree.c
--- sqlite3-3.8.7.1/src/btree.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/btree.c	2014-11-19 14:10:06.000000000 +0000
@@ -2171,7 +2171,7 @@
   ** The call to sqlite3BtreeRollback() drops any table-locks held by
   ** this handle.
   */
-  sqlite3BtreeRollback(p, SQLITE_OK);
+  sqlite3BtreeRollback(p, SQLITE_OK, 0);
   sqlite3BtreeLeave(p);
 
   /* If there are still other outstanding references to the shared-btree
@@ -3464,60 +3464,91 @@
 
 /*
 ** This routine sets the state to CURSOR_FAULT and the error
-** code to errCode for every cursor on BtShared that pBtree
-** references.
+** code to errCode for every cursor on any BtShared that pBtree
+** references.  Or if the writeOnly flag is set to 1, then only
+** trip write cursors and leave read cursors unchanged.
+**
+** Every cursor is a candidate to be tripped, including cursors
+** that belong to other database connections that happen to be
+** sharing the cache with pBtree.
+**
+** This routine gets called when a rollback occurs. If the writeOnly
+** flag is true, then only write-cursors need be tripped - read-only
+** cursors save their current positions so that they may continue 
+** following the rollback. Or, if writeOnly is false, all cursors are 
+** tripped. In general, writeOnly is false if the transaction being
+** rolled back modified the database schema. In this case b-tree root
+** pages may be moved or deleted from the database altogether, making
+** it unsafe for read cursors to continue.
+**
+** If the writeOnly flag is true and an error is encountered while 
+** saving the current position of a read-only cursor, all cursors, 
+** including all read-cursors are tripped.
 **
-** Every cursor is tripped, including cursors that belong
-** to other database connections that happen to be sharing
-** the cache with pBtree.
-**
-** This routine gets called when a rollback occurs.
-** All cursors using the same cache must be tripped
-** to prevent them from trying to use the btree after
-** the rollback.  The rollback may have deleted tables
-** or moved root pages, so it is not sufficient to
-** save the state of the cursor.  The cursor must be
-** invalidated.
+** SQLITE_OK is returned if successful, or if an error occurs while
+** saving a cursor position, an SQLite error code.
 */
-void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
+int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){
   BtCursor *p;
-  if( pBtree==0 ) return;
-  sqlite3BtreeEnter(pBtree);
-  for(p=pBtree->pBt->pCursor; p; p=p->pNext){
-    int i;
-    sqlite3BtreeClearCursor(p);
-    p->eState = CURSOR_FAULT;
-    p->skipNext = errCode;
-    for(i=0; i<=p->iPage; i++){
-      releasePage(p->apPage[i]);
-      p->apPage[i] = 0;
+  int rc = SQLITE_OK;
+
+  assert( (writeOnly==0 || writeOnly==1) && BTCF_WriteFlag==1 );
+  if( pBtree ){
+    sqlite3BtreeEnter(pBtree);
+    for(p=pBtree->pBt->pCursor; p; p=p->pNext){
+      int i;
+      if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
+        if( p->eState==CURSOR_VALID ){
+          rc = saveCursorPosition(p);
+          if( rc!=SQLITE_OK ){
+            (void)sqlite3BtreeTripAllCursors(pBtree, rc, 0);
+            break;
+          }
+        }
+      }else{
+        sqlite3BtreeClearCursor(p);
+        p->eState = CURSOR_FAULT;
+        p->skipNext = errCode;
+      }
+      for(i=0; i<=p->iPage; i++){
+        releasePage(p->apPage[i]);
+        p->apPage[i] = 0;
+      }
     }
+    sqlite3BtreeLeave(pBtree);
   }
-  sqlite3BtreeLeave(pBtree);
+  return rc;
 }
 
 /*
-** Rollback the transaction in progress.  All cursors will be
-** invalided by this operation.  Any attempt to use a cursor
-** that was open at the beginning of this operation will result
-** in an error.
+** Rollback the transaction in progress.
+**
+** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).
+** Only write cursors are tripped if writeOnly is true but all cursors are
+** tripped if writeOnly is false.  Any attempt to use
+** a tripped cursor will result in an error.
 **
 ** This will release the write lock on the database file.  If there
 ** are no active cursors, it also releases the read lock.
 */
-int sqlite3BtreeRollback(Btree *p, int tripCode){
+int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){
   int rc;
   BtShared *pBt = p->pBt;
   MemPage *pPage1;
 
+  assert( writeOnly==1 || writeOnly==0 );
+  assert( tripCode==SQLITE_ABORT_ROLLBACK || tripCode==SQLITE_OK );
   sqlite3BtreeEnter(p);
   if( tripCode==SQLITE_OK ){
     rc = tripCode = saveAllCursors(pBt, 0, 0);
+    if( rc ) writeOnly = 0;
   }else{
     rc = SQLITE_OK;
   }
   if( tripCode ){
-    sqlite3BtreeTripAllCursors(p, tripCode);
+    int rc2 = sqlite3BtreeTripAllCursors(p, tripCode, writeOnly);
+    assert( rc==SQLITE_OK || (writeOnly==0 && rc2==SQLITE_OK) );
+    if( rc2!=SQLITE_OK ) rc = rc2;
   }
   btreeIntegrity(p);
 
@@ -3852,13 +3883,9 @@
 */
 int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
   assert( cursorHoldsMutex(pCur) );
-  assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );
-  if( pCur->eState!=CURSOR_VALID ){
-    *pSize = 0;
-  }else{
-    getCellInfo(pCur);
-    *pSize = pCur->info.nKey;
-  }
+  assert( pCur->eState==CURSOR_VALID );
+  getCellInfo(pCur);
+  *pSize = pCur->info.nKey;
   return SQLITE_OK;
 }
 
diff -Nur sqlite3-3.8.7.1/src/btree.h sqlite3-3.8.7.2/src/btree.h
--- sqlite3-3.8.7.1/src/btree.h	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/btree.h	2014-11-19 14:10:06.000000000 +0000
@@ -83,7 +83,7 @@
 int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
 int sqlite3BtreeCommitPhaseTwo(Btree*, int);
 int sqlite3BtreeCommit(Btree*);
-int sqlite3BtreeRollback(Btree*,int);
+int sqlite3BtreeRollback(Btree*,int,int);
 int sqlite3BtreeBeginStmt(Btree*,int);
 int sqlite3BtreeCreateTable(Btree*, int*, int flags);
 int sqlite3BtreeIsInTrans(Btree*);
@@ -116,7 +116,7 @@
 int sqlite3BtreeDropTable(Btree*, int, int*);
 int sqlite3BtreeClearTable(Btree*, int, int*);
 int sqlite3BtreeClearTableOfCursor(BtCursor*);
-void sqlite3BtreeTripAllCursors(Btree*, int);
+int sqlite3BtreeTripAllCursors(Btree*, int, int);
 
 void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
 int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
diff -Nur sqlite3-3.8.7.1/src/btreeInt.h sqlite3-3.8.7.2/src/btreeInt.h
--- sqlite3-3.8.7.1/src/btreeInt.h	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/btreeInt.h	2014-11-19 14:10:06.000000000 +0000
@@ -489,6 +489,11 @@
 **
 ** Fields in this structure are accessed under the BtShared.mutex
 ** found at self->pBt->mutex. 
+**
+** skipNext meaning:
+**    eState==SKIPNEXT && skipNext>0:  Next sqlite3BtreeNext() is no-op.
+**    eState==SKIPNEXT && skipNext<0:  Next sqlite3BtreePrevious() is no-op.
+**    eState==FAULT:                   Cursor fault with skipNext as error code.
 */
 struct BtCursor {
   Btree *pBtree;            /* The Btree to which this cursor belongs */
@@ -501,7 +506,8 @@
   void *pKey;               /* Saved key that was cursor last known position */
   Pgno pgnoRoot;            /* The root page of this tree */
   int nOvflAlloc;           /* Allocated size of aOverflow[] array */
-  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive */
+  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive.
+                   ** Error code if eState==CURSOR_FAULT */
   u8 curFlags;              /* zero or more BTCF_* flags defined below */
   u8 eState;                /* One of the CURSOR_XXX constants (see below) */
   u8 hints;                             /* As configured by CursorSetHints() */
@@ -547,7 +553,7 @@
 **   on a different connection that shares the BtShared cache with this
 **   cursor.  The error has left the cache in an inconsistent state.
 **   Do nothing else with this cursor.  Any attempt to use the cursor
-**   should return the error code stored in BtCursor.skip
+**   should return the error code stored in BtCursor.skipNext
 */
 #define CURSOR_INVALID           0
 #define CURSOR_VALID             1
diff -Nur sqlite3-3.8.7.1/src/expr.c sqlite3-3.8.7.2/src/expr.c
--- sqlite3-3.8.7.1/src/expr.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/expr.c	2014-11-19 14:10:06.000000000 +0000
@@ -1836,7 +1836,6 @@
         assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
         pSelect->iLimit = 0;
         testcase( pSelect->selFlags & SF_Distinct );
-        pSelect->selFlags &= ~SF_Distinct;
         testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */
         if( sqlite3Select(pParse, pSelect, &dest) ){
           sqlite3KeyInfoUnref(pKeyInfo);
diff -Nur sqlite3-3.8.7.1/src/main.c sqlite3-3.8.7.2/src/main.c
--- sqlite3-3.8.7.1/src/main.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/main.c	2014-11-19 14:10:06.000000000 +0000
@@ -1016,13 +1016,15 @@
 
 /*
 ** Rollback all database files.  If tripCode is not SQLITE_OK, then
-** any open cursors are invalidated ("tripped" - as in "tripping a circuit
+** any write cursors are invalidated ("tripped" - as in "tripping a circuit
 ** breaker") and made to return tripCode if there are any further
-** attempts to use that cursor.
+** attempts to use that cursor.  Read cursors remain open and valid
+** but are "saved" in case the table pages are moved around.
 */
 void sqlite3RollbackAll(sqlite3 *db, int tripCode){
   int i;
   int inTrans = 0;
+  int schemaChange;
   assert( sqlite3_mutex_held(db->mutex) );
   sqlite3BeginBenignMalloc();
 
@@ -1033,6 +1035,7 @@
   ** the database rollback and schema reset, which can cause false
   ** corruption reports in some cases.  */
   sqlite3BtreeEnterAll(db);
+  schemaChange = (db->flags & SQLITE_InternChanges)!=0 && db->init.busy==0;
 
   for(i=0; i<db->nDb; i++){
     Btree *p = db->aDb[i].pBt;
@@ -1040,7 +1043,7 @@
       if( sqlite3BtreeIsInTrans(p) ){
         inTrans = 1;
       }
-      sqlite3BtreeRollback(p, tripCode);
+      sqlite3BtreeRollback(p, tripCode, !schemaChange);
     }
   }
   sqlite3VtabRollback(db);
diff -Nur sqlite3-3.8.7.1/src/printf.c sqlite3-3.8.7.2/src/printf.c
--- sqlite3-3.8.7.1/src/printf.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/printf.c	2014-11-19 14:10:06.000000000 +0000
@@ -212,7 +212,7 @@
   const et_info *infop;      /* Pointer to the appropriate info structure */
   char *zOut;                /* Rendering buffer */
   int nOut;                  /* Size of the rendering buffer */
-  char *zExtra;              /* Malloced memory used by some conversion */
+  char *zExtra = 0;          /* Malloced memory used by some conversion */
 #ifndef SQLITE_OMIT_FLOATING_POINT
   int  exp, e2;              /* exponent of real numbers */
   int nsd;                   /* Number of significant digits returned */
@@ -329,7 +329,6 @@
         break;
       }
     }
-    zExtra = 0;
 
     /*
     ** At this point, variables are initialized as follows:
@@ -620,13 +619,16 @@
         }else{
           c = va_arg(ap,int);
         }
-        buf[0] = (char)c;
-        if( precision>=0 ){
-          for(idx=1; idx<precision; idx++) buf[idx] = (char)c;
-          length = precision;
-        }else{
-          length =1;
+        if( precision>1 ){
+          width -= precision-1;
+          if( width>1 && !flag_leftjustify ){
+            sqlite3AppendChar(pAccum, width-1, ' ');
+            width = 0;
+          }
+          sqlite3AppendChar(pAccum, precision-1, c);
         }
+        length = 1;
+        buf[0] = c;
         bufpt = buf;
         break;
       case etSTRING:
@@ -727,11 +729,14 @@
     ** the output.
     */
     width -= length;
-    if( width>0 && !flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
+    if( width>0 && !flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
     sqlite3StrAccumAppend(pAccum, bufpt, length);
-    if( width>0 && flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
+    if( width>0 && flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
 
-    if( zExtra ) sqlite3_free(zExtra);
+    if( zExtra ){
+      sqlite3_free(zExtra);
+      zExtra = 0;
+    }
   }/* End for loop over the format string */
 } /* End of function */
 
@@ -784,11 +789,11 @@
 }
 
 /*
-** Append N space characters to the given string buffer.
+** Append N copies of character c to the given string buffer.
 */
-void sqlite3AppendSpace(StrAccum *p, int N){
+void sqlite3AppendChar(StrAccum *p, int N, char c){
   if( p->nChar+N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ) return;
-  while( (N--)>0 ) p->zText[p->nChar++] = ' ';
+  while( (N--)>0 ) p->zText[p->nChar++] = c;
 }
 
 /*
diff -Nur sqlite3-3.8.7.1/src/sqliteInt.h sqlite3-3.8.7.2/src/sqliteInt.h
--- sqlite3-3.8.7.1/src/sqliteInt.h	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/sqliteInt.h	2014-11-19 14:10:06.000000000 +0000
@@ -3539,7 +3539,7 @@
 void sqlite3StrAccumInit(StrAccum*, char*, int, int);
 void sqlite3StrAccumAppend(StrAccum*,const char*,int);
 void sqlite3StrAccumAppendAll(StrAccum*,const char*);
-void sqlite3AppendSpace(StrAccum*,int);
+void sqlite3AppendChar(StrAccum*,int,char);
 char *sqlite3StrAccumFinish(StrAccum*);
 void sqlite3StrAccumReset(StrAccum*);
 void sqlite3SelectDestInit(SelectDest*,int,int);
diff -Nur sqlite3-3.8.7.1/src/vdbe.c sqlite3-3.8.7.2/src/vdbe.c
--- sqlite3-3.8.7.1/src/vdbe.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/vdbe.c	2014-11-19 14:10:06.000000000 +0000
@@ -2298,7 +2298,7 @@
         pC->payloadSize = pC->szRow = avail = pReg->n;
         pC->aRow = (u8*)pReg->z;
       }else{
-        MemSetTypeFlag(pDest, MEM_Null);
+        sqlite3VdbeMemSetNull(pDest);
         goto op_column_out;
       }
     }else{
@@ -2822,11 +2822,18 @@
         db->isTransactionSavepoint = 0;
         rc = p->rc;
       }else{
+        int isSchemaChange;
         iSavepoint = db->nSavepoint - iSavepoint - 1;
         if( p1==SAVEPOINT_ROLLBACK ){
+          isSchemaChange = (db->flags & SQLITE_InternChanges)!=0;
           for(ii=0; ii<db->nDb; ii++){
-            sqlite3BtreeTripAllCursors(db->aDb[ii].pBt, SQLITE_ABORT);
+            rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,
+                                       SQLITE_ABORT_ROLLBACK,
+                                       isSchemaChange==0);
+            if( rc!=SQLITE_OK ) goto abort_due_to_error;
           }
+        }else{
+          isSchemaChange = 0;
         }
         for(ii=0; ii<db->nDb; ii++){
           rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
@@ -2834,7 +2841,7 @@
             goto abort_due_to_error;
           }
         }
-        if( p1==SAVEPOINT_ROLLBACK && (db->flags&SQLITE_InternChanges)!=0 ){
+        if( isSchemaChange ){
           sqlite3ExpirePreparedStatements(db);
           sqlite3ResetAllSchemasOfConnection(db);
           db->flags = (db->flags | SQLITE_InternChanges);
@@ -3231,7 +3238,7 @@
           || p->readOnly==0 );
 
   if( p->expired ){
-    rc = SQLITE_ABORT;
+    rc = SQLITE_ABORT_ROLLBACK;
     break;
   }
 
@@ -4398,6 +4405,10 @@
     assert( pC->pCursor!=0 );
     rc = sqlite3VdbeCursorRestore(pC);
     if( rc ) goto abort_due_to_error;
+    if( pC->nullRow ){
+      pOut->flags = MEM_Null;
+      break;
+    }
     rc = sqlite3BtreeKeySize(pC->pCursor, &v);
     assert( rc==SQLITE_OK );  /* Always so because of CursorRestore() above */
   }
diff -Nur sqlite3-3.8.7.1/src/wal.c sqlite3-3.8.7.2/src/wal.c
--- sqlite3-3.8.7.1/src/wal.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/src/wal.c	2014-11-19 14:10:06.000000000 +0000
@@ -2525,7 +2525,6 @@
     }
     if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
   }
-  assert( rc==SQLITE_OK );
   return rc;
 }
 
diff -Nur sqlite3-3.8.7.1/VERSION sqlite3-3.8.7.2/VERSION
--- sqlite3-3.8.7.1/VERSION	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.2/VERSION	2014-11-19 14:10:06.000000000 +0000
@@ -1 +1 @@
-3.8.7.1
+3.8.7.2
diff -Nur sqlite3-3.8.7.1/configure sqlite3-3.8.7.3/configure
--- sqlite3-3.8.7.1/configure	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/configure	2014-12-06 20:51:02.000000000 +0000
@@ -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.1.
+# 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 @@
 # Identity of this package.
 PACKAGE_NAME='sqlite'
 PACKAGE_TARNAME='sqlite'
-PACKAGE_VERSION='3.8.7.1'
-PACKAGE_STRING='sqlite 3.8.7.1'
+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 @@
   # 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.1 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 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of sqlite 3.8.7.1:";;
+     short | recursive ) echo "Configuration of sqlite 3.8.7.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1664,7 +1664,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-sqlite configure 3.8.7.1
+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 @@
 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.1, 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 @@
 # 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.1, 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 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-sqlite config.status 3.8.7.1
+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'`\\"
 
diff -Nur sqlite3-3.8.7.1/debian/changelog sqlite3-3.8.7.3/debian/changelog
--- sqlite3-3.8.7.1/debian/changelog	2014-11-06 16:25:11.000000000 +0000
+++ sqlite3-3.8.7.3/debian/changelog	2014-12-07 13:51:27.000000000 +0000
@@ -1,3 +1,15 @@
+sqlite3 (3.8.7.3-1) unstable; urgency=medium
+
+  * New upstream bugfix release.
+
+ -- Laszlo Boszormenyi (GCS) <g...@debian.org>  Sun, 07 Dec 2014 13:50:53 +0000
+
+sqlite3 (3.8.7.2-1) unstable; urgency=medium
+
+  * New upstream bugfix release.
+
+ -- Laszlo Boszormenyi (GCS) <g...@debian.org>  Tue, 02 Dec 2014 14:28:59 +0000
+
 sqlite3 (3.8.7.1-1) unstable; urgency=medium
 
   * New upstream bugfix release.
diff -Nur sqlite3-3.8.7.1/manifest sqlite3-3.8.7.3/manifest
--- sqlite3-3.8.7.1/manifest	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/manifest	2014-12-06 20:51:02.000000000 +0000
@@ -1,12 +1,12 @@
-C Version\s3.8.7.1
-D 2014-10-29T13:59:56.070
+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 5cc0baaee7eeee3238f0f7b5871398d17f79d0cd
+F VERSION f7ce2fe949b8b915bf1c451ffcb18160e13ba006
 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
 F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811
 F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
@@ -38,7 +38,7 @@
 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
 F config.h.in 0921066a13130082764ab4ab6456f7b5bebe56de
 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
-F configure 56fe985cf0e59cd594f9b929099d0be40260e667 x
+F configure 3e597ced685571768e370b3b7e04f92412b94e6e x
 F configure.ac 4cf9f60785143fa141b10962ccc885d973792e9a
 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
 F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
@@ -166,22 +166,22 @@
 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 a31809c65623cc41849b94d368917f8bb66e6a7e
+F src/backup.c 8cdfeb0c8a6d8bdad3faefae418eb3dc767051b6
 F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
 F src/btmutex.c 49ca66250c7dfa844a4d4cb8272b87420d27d3a5
-F src/btree.c 1b1123cba0c65caa0baa51e71b8c089e3167c3ed
-F src/btree.h a79aa6a71e7f1055f01052b7f821bd1c2dce95c8
-F src/btreeInt.h 026d0129724e8f265fdc60d44ec240cf5a4e6179
+F src/btree.c c961588f01bd95d37b90359220c640f9763a3f58
+F src/btree.h a4afc6b06f5a1dd2076d15aa168baec44fc0121b
+F src/btreeInt.h 3363e18fd76f69a27a870b25221b2345b3fd4d21
 F src/build.c 9dc2bd94347b878c89627000c92b0c8d97ec2919
 F src/callback.c 7b44ce59674338ad48b0e84e7b72f935ea4f68b0
 F src/complete.c 535183afb3c75628b78ce82612931ac7cdf26f14
 F src/ctime.c bb434068b5308a857b181c2d204a320ff0d6c638
 F src/date.c 57a7f9ba9f6b4d5268f5e411739066a611f99036
 F src/delete.c 0750b1eb4d96cd3fb2c798599a3a7c85e92f1417
-F src/expr.c fc204d08af06437ddaffe5a1b1f1f6f9e1a55d6d
+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/legacy.c ba1863ea58c4c840335a84ec276fc2b25e22bc4e
 F src/lempar.c 7274c97d24bb46631e504332ccd3bd1b37841770
 F src/loadext.c de741e66e5ddc1598d904d7289239696e40ed994
-F src/main.c bbe872b0ac0007bed0ebe1936fc493b039ad4f51
+F src/main.c aefdbda97a8d88ffeb6c49fd72d5757a7e813594
 F src/malloc.c 3c3ac67969612493d435e14b6832793209afd2ec
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c faf615aafd8be74a71494dfa027c113ea5c6615f
@@ -223,16 +223,16 @@
 F src/pcache1.c e412cb585f777c840ddce0500eddc5c6043c2bb5
 F src/pragma.c 3f3e959390a10c0131676f0e307acce372777e0f
 F src/prepare.c 6ef0cf2f9274982988ed6b7cab1be23147e94196
-F src/printf.c 090fac0f779c93c8a95089a125339686648835e4
+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 f7812f74f2d0c6041ef6b91a99c5a45f775dd408
+F src/sqliteInt.h 474a00de22bfbbb810db22689e3d1e4099d1d921
 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
 F src/status.c 961d5926e5a8fda611d385ec22c226b8635cd1cb
 F src/table.c 2e99ef7ef16187e17033d9398dc962ce22dab5cb
@@ -289,7 +289,7 @@
 F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
 F src/util.c 4006c01772bd8d8ac4306d523bbcee41d3e392d8
 F src/vacuum.c 59f03f92bcff57faa6a8ca256eb29ccddfb0614a
-F src/vdbe.c 5a1afb571853ddb911d698ac996bc4fd8ddf1eed
+F src/vdbe.c 8bc291aa00646d07dab33047520960ea454c5a2f
 F src/vdbe.h 09f5b4e3719fa454f252322b1cdab5cf1f361327
 F src/vdbeInt.h e2a060a55ee18a6ab973353a5e2ec7ee569bf787
 F src/vdbeapi.c 37a6c6ae284a97bcace365f2f0a225680c0499d9
@@ -299,7 +299,7 @@
 F src/vdbesort.c 975aeffa99acb0991b2f288d30294756bff41438
 F src/vdbetrace.c 7e4222955e07dd707a2f360c0eb73452be1cb010
 F src/vtab.c cb0c194303fea276b48d7d4b6d970b5a96bde8de
-F src/wal.c 10e7de7ce90865a68153f001a61f1d985cd17983
+F src/wal.c 095d41f7114d7a8699207f5313488aa88372d540
 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
 F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
 F src/where.c 2947912f1f3d6a7766fe087fd532a5d688d745b1
@@ -378,9 +378,9 @@
 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
 F test/cache.test 13bc046b26210471ca6f2889aceb1ea52dc717de
 F test/capi2.test 011c16da245fdc0106a2785035de6b242c05e738
-F test/capi3.test 71bcf2fbd36a9732f617766dfd752552c8e491b5
+F test/capi3.test f0718f4f90d0efdc980119bfbdf1d7f1541ee5ef
 F test/capi3b.test efb2b9cfd127efa84433cd7a2d72ce0454ae0dc4
-F test/capi3c.test a21869e4d50d5dbb7e566e328fc0bc7c2efa6a32
+F test/capi3c.test fdc0d67a2cb8e8fc400d5b7735e330161ea057a2
 F test/capi3d.test c84af0c49267f9c3fbf4c1c46aa647646023811e
 F test/capi3e.test 3d49c01ef2a1a55f41d73cba2b23b5059ec460fe
 F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3
@@ -616,7 +616,7 @@
 F test/in2.test 5d4c61d17493c832f7d2d32bef785119e87bde75
 F test/in3.test 3cbf58c87f4052cee3a58b37b6389777505aa0c0
 F test/in4.test d2b38cba404bc4320f4fe1b595b3d163f212c068
-F test/in5.test 99f9a40af01711b06d2d614ecfe96129f334fba3
+F test/in5.test 1de657472fa9ac2924be25c2c959ac5ca1aae554
 F test/incrblob.test e81846d214f3637622620fbde7cd526781cfe328
 F test/incrblob2.test bf4d549aa4a466d7fbe3e3a3693d3861263d5600
 F test/incrblob3.test d8d036fde015d4a159cd3cbae9d29003b37227a4
@@ -648,7 +648,7 @@
 F test/intpkey.test 7506090fc08e028712a8bf47e5f54111947e3844
 F test/io.test 3a7abcef18727cc0f2399e04b0e8903eccae50f8
 F test/ioerr.test 2a24bd6ed5a8b062e64bfe1f6cf94fb25e92210d
-F test/ioerr2.test 9d71166f8466eda510f1af6137bdabaa82b5408d
+F test/ioerr2.test 2593563599e2cc6b6b4fcf5878b177bdd5d8df26
 F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
 F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
 F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
@@ -657,7 +657,7 @@
 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
@@ -768,7 +768,7 @@
 F test/pragma.test 19d0241a007bcdd77fc2606ec60fc60357e7fc8b
 F test/pragma2.test aea7b3d82c76034a2df2b38a13745172ddc0bc13
 F test/printf.test ec9870c4dce8686a37818e0bf1aba6e6a1863552
-F test/printf2.test bed79b4c3e5da08ba88ad637c0bf62586843cfb1
+F test/printf2.test b4acd4bf8734243257f01ddefa17c4fb090acc8a
 F test/progress.test a282973d1d17f08071bc58a77d6b80f2a81c354d
 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc
 F test/queryonly.test 5f653159e0f552f0552d43259890c1089391dcca
@@ -785,18 +785,19 @@
 F test/releasetest.mk 2eced2f9ae701fd0a29e714a241760503ccba25a
 F test/releasetest.tcl a4279c890698584feb2ffc86735857a4e4474180
 F test/resolver01.test 33abf37ff8335e6bf98f2b45a0af3e06996ccd9a
-F test/rollback.test e9504a009a202c3ed711da2e6879ff60c5a4669c
+F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
+F test/rollback2.test 552abaab8e721b6060a727d639896427059e51ec
 F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
 F test/rowid.test 742b5741584a8a44fd83e856cc2896688401d645
 F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
 F test/run-wordcount.sh 891e89c4c2d16e629cd45951d4ed899ad12afc09
-F test/savepoint.test 51d3900dc071a7c2ad4248578a5925631b476313
+F test/savepoint.test c671fdbd34cd3bfe1518a777526ada595180cf8d
 F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
 F test/savepoint3.test e328085853b14898d78ceea00dfe7db18bb6a9ec
 F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0
 F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
 F test/savepoint6.test f41279c5e137139fa5c21485773332c7adb98cd7
-F test/savepoint7.test fbf319a7b2dda089ec5be30a424a0e95f121d423
+F test/savepoint7.test db3db281486c925095f305aad09fe806e5188ff3
 F test/schema.test 8f7999be894260f151adf15c2c7540f1c6d6a481
 F test/schema2.test 906408621ea881fdb496d878b1822572a34e32c5
 F test/schema3.test 1bc1008e1f8cb5654b248c55f27249366eb7ed38
@@ -829,7 +830,8 @@
 F test/shared8.test 00a07bf5e1337ecf72e94542bdefdc330d7a2538
 F test/shared9.test 5f2a8f79b4d6c7d107a01ffa1ed05ae7e6333e21
 F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5
-F test/shared_err.test 0079c05c97d88cfa03989b7c20a8b266983087aa
+F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
+F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506
 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
 F test/shell1.test d60946b5fde4d85fe06db7331dfe89011f564350
 F test/shell2.test c57da3a381c099b02c813ba156298d5c2f5c93a3
@@ -873,7 +875,7 @@
 F test/sync.test a34cd43e98b7fb84eabbf38f7ed8f7349b3f3d85
 F test/syscall.test d2fdaad713f103ac611fe7ef9b724c7b69f8149c
 F test/sysfault.test fa776e60bf46bdd3ae69f0b73e46ee3977a58ae6
-F test/table.test 2a1d2fa52c531de5915f28023747d9a8c27b6f31
+F test/table.test 06271d61eb13871490d38168433c1ef3dd82bb2a
 F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
 F test/tclsqlite.test 37a61c2da7e3bfe3b8c1a2867199f6b860df5d43
@@ -943,7 +945,7 @@
 F test/tkt-d82e3f3721.test bcc0dfba658d15bab30fd4a9320c9e35d214ce30
 F test/tkt-f3e5abed55.test d5a0126118142d13e27f6ce9f4c47096e9321c00
 F test/tkt-f67b41381a.test a23bc124c981662db712167bacd0ed8ad11abac9
-F test/tkt-f777251dc7a.test af6531446c64bfd268416f07b4df7be7f9c749d2
+F test/tkt-f777251dc7a.test 6295d235a03c82160549da4841a83dc8e758932f
 F test/tkt-f7b4edec.test d998a08ff2b18b7f62edce8e3044317c45efe6c7
 F test/tkt-f973c7ac31.test 28ef85c7f015477916795246d8286aeda39d4ead
 F test/tkt-fa7bf5ec.test 9102dfea58aa371d78969da735f9392c57e2e035
@@ -1038,7 +1040,7 @@
 F test/trace2.test 93b47ca6996c66b47f57224cfb146f34e07df382
 F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
 F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
-F test/trans3.test 373ac5183cc56be69f48ae44090e7f672939f732
+F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
 F test/transitive1.test 03f532954f46cdf5608f7766bff0b0c52bf2a7cd
 F test/trigger1.test dc47573ac79ffe0ee3eecaa517d70d8dacbccd03
 F test/trigger2.test 5cd7d69a7ba1143ee045e4ae2963ff32ae4c87a6
@@ -1204,10 +1206,10 @@
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 83afe23e553e802c0947c80d0ffdd120423e7c52
-R 5381895dceb9bc7ad4d425f399561cb7
+P 194c90db637ad4197a54be83a665feb2a9c96014
+R 9c03e40230b03e031df69c10ef418c3a
 T +bgcolor * #d0c0ff
 T +sym-release *
-T +sym-version-3.8.7.1 *
+T +sym-version-3.8.7.3 *
 U drh
-Z e5ce942eb65e60b92fcaefcb5b84039b
+Z 1696edf186831fdcc944c05ffbed906a
diff -Nur sqlite3-3.8.7.1/manifest.uuid sqlite3-3.8.7.3/manifest.uuid
--- sqlite3-3.8.7.1/manifest.uuid	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/manifest.uuid	2014-12-06 20:51:02.000000000 +0000
@@ -1 +1 @@
-3b7b72c4685aa5cf5e675c2c47ebec10d9704221
+647e77e853e81a5effeb4c33477910400a67ba86
diff -Nur sqlite3-3.8.7.1/src/analyze.c sqlite3-3.8.7.3/src/analyze.c
--- sqlite3-3.8.7.1/src/analyze.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/analyze.c	2014-12-06 20:51:02.000000000 +0000
@@ -1591,7 +1591,7 @@
       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--;
diff -Nur sqlite3-3.8.7.1/src/backup.c sqlite3-3.8.7.3/src/backup.c
--- sqlite3-3.8.7.1/src/backup.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/backup.c	2014-12-06 20:51:02.000000000 +0000
@@ -597,7 +597,7 @@
   }
 
   /* If a transaction is still open on the Btree, roll it back. */
-  sqlite3BtreeRollback(p->pDest, SQLITE_OK);
+  sqlite3BtreeRollback(p->pDest, SQLITE_OK, 0);
 
   /* Set the error code of the destination database handle. */
   rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc;
diff -Nur sqlite3-3.8.7.1/src/btree.c sqlite3-3.8.7.3/src/btree.c
--- sqlite3-3.8.7.1/src/btree.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/btree.c	2014-12-06 20:51:02.000000000 +0000
@@ -2171,7 +2171,7 @@
   ** The call to sqlite3BtreeRollback() drops any table-locks held by
   ** this handle.
   */
-  sqlite3BtreeRollback(p, SQLITE_OK);
+  sqlite3BtreeRollback(p, SQLITE_OK, 0);
   sqlite3BtreeLeave(p);
 
   /* If there are still other outstanding references to the shared-btree
@@ -3464,60 +3464,91 @@
 
 /*
 ** This routine sets the state to CURSOR_FAULT and the error
-** code to errCode for every cursor on BtShared that pBtree
-** references.
+** code to errCode for every cursor on any BtShared that pBtree
+** references.  Or if the writeOnly flag is set to 1, then only
+** trip write cursors and leave read cursors unchanged.
+**
+** Every cursor is a candidate to be tripped, including cursors
+** that belong to other database connections that happen to be
+** sharing the cache with pBtree.
+**
+** This routine gets called when a rollback occurs. If the writeOnly
+** flag is true, then only write-cursors need be tripped - read-only
+** cursors save their current positions so that they may continue 
+** following the rollback. Or, if writeOnly is false, all cursors are 
+** tripped. In general, writeOnly is false if the transaction being
+** rolled back modified the database schema. In this case b-tree root
+** pages may be moved or deleted from the database altogether, making
+** it unsafe for read cursors to continue.
+**
+** If the writeOnly flag is true and an error is encountered while 
+** saving the current position of a read-only cursor, all cursors, 
+** including all read-cursors are tripped.
 **
-** Every cursor is tripped, including cursors that belong
-** to other database connections that happen to be sharing
-** the cache with pBtree.
-**
-** This routine gets called when a rollback occurs.
-** All cursors using the same cache must be tripped
-** to prevent them from trying to use the btree after
-** the rollback.  The rollback may have deleted tables
-** or moved root pages, so it is not sufficient to
-** save the state of the cursor.  The cursor must be
-** invalidated.
+** SQLITE_OK is returned if successful, or if an error occurs while
+** saving a cursor position, an SQLite error code.
 */
-void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
+int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int writeOnly){
   BtCursor *p;
-  if( pBtree==0 ) return;
-  sqlite3BtreeEnter(pBtree);
-  for(p=pBtree->pBt->pCursor; p; p=p->pNext){
-    int i;
-    sqlite3BtreeClearCursor(p);
-    p->eState = CURSOR_FAULT;
-    p->skipNext = errCode;
-    for(i=0; i<=p->iPage; i++){
-      releasePage(p->apPage[i]);
-      p->apPage[i] = 0;
+  int rc = SQLITE_OK;
+
+  assert( (writeOnly==0 || writeOnly==1) && BTCF_WriteFlag==1 );
+  if( pBtree ){
+    sqlite3BtreeEnter(pBtree);
+    for(p=pBtree->pBt->pCursor; p; p=p->pNext){
+      int i;
+      if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
+        if( p->eState==CURSOR_VALID ){
+          rc = saveCursorPosition(p);
+          if( rc!=SQLITE_OK ){
+            (void)sqlite3BtreeTripAllCursors(pBtree, rc, 0);
+            break;
+          }
+        }
+      }else{
+        sqlite3BtreeClearCursor(p);
+        p->eState = CURSOR_FAULT;
+        p->skipNext = errCode;
+      }
+      for(i=0; i<=p->iPage; i++){
+        releasePage(p->apPage[i]);
+        p->apPage[i] = 0;
+      }
     }
+    sqlite3BtreeLeave(pBtree);
   }
-  sqlite3BtreeLeave(pBtree);
+  return rc;
 }
 
 /*
-** Rollback the transaction in progress.  All cursors will be
-** invalided by this operation.  Any attempt to use a cursor
-** that was open at the beginning of this operation will result
-** in an error.
+** Rollback the transaction in progress.
+**
+** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped).
+** Only write cursors are tripped if writeOnly is true but all cursors are
+** tripped if writeOnly is false.  Any attempt to use
+** a tripped cursor will result in an error.
 **
 ** This will release the write lock on the database file.  If there
 ** are no active cursors, it also releases the read lock.
 */
-int sqlite3BtreeRollback(Btree *p, int tripCode){
+int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){
   int rc;
   BtShared *pBt = p->pBt;
   MemPage *pPage1;
 
+  assert( writeOnly==1 || writeOnly==0 );
+  assert( tripCode==SQLITE_ABORT_ROLLBACK || tripCode==SQLITE_OK );
   sqlite3BtreeEnter(p);
   if( tripCode==SQLITE_OK ){
     rc = tripCode = saveAllCursors(pBt, 0, 0);
+    if( rc ) writeOnly = 0;
   }else{
     rc = SQLITE_OK;
   }
   if( tripCode ){
-    sqlite3BtreeTripAllCursors(p, tripCode);
+    int rc2 = sqlite3BtreeTripAllCursors(p, tripCode, writeOnly);
+    assert( rc==SQLITE_OK || (writeOnly==0 && rc2==SQLITE_OK) );
+    if( rc2!=SQLITE_OK ) rc = rc2;
   }
   btreeIntegrity(p);
 
@@ -3852,13 +3883,9 @@
 */
 int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
   assert( cursorHoldsMutex(pCur) );
-  assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );
-  if( pCur->eState!=CURSOR_VALID ){
-    *pSize = 0;
-  }else{
-    getCellInfo(pCur);
-    *pSize = pCur->info.nKey;
-  }
+  assert( pCur->eState==CURSOR_VALID );
+  getCellInfo(pCur);
+  *pSize = pCur->info.nKey;
   return SQLITE_OK;
 }
 
diff -Nur sqlite3-3.8.7.1/src/btree.h sqlite3-3.8.7.3/src/btree.h
--- sqlite3-3.8.7.1/src/btree.h	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/btree.h	2014-12-06 20:51:02.000000000 +0000
@@ -83,7 +83,7 @@
 int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
 int sqlite3BtreeCommitPhaseTwo(Btree*, int);
 int sqlite3BtreeCommit(Btree*);
-int sqlite3BtreeRollback(Btree*,int);
+int sqlite3BtreeRollback(Btree*,int,int);
 int sqlite3BtreeBeginStmt(Btree*,int);
 int sqlite3BtreeCreateTable(Btree*, int*, int flags);
 int sqlite3BtreeIsInTrans(Btree*);
@@ -116,7 +116,7 @@
 int sqlite3BtreeDropTable(Btree*, int, int*);
 int sqlite3BtreeClearTable(Btree*, int, int*);
 int sqlite3BtreeClearTableOfCursor(BtCursor*);
-void sqlite3BtreeTripAllCursors(Btree*, int);
+int sqlite3BtreeTripAllCursors(Btree*, int, int);
 
 void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue);
 int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
diff -Nur sqlite3-3.8.7.1/src/btreeInt.h sqlite3-3.8.7.3/src/btreeInt.h
--- sqlite3-3.8.7.1/src/btreeInt.h	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/btreeInt.h	2014-12-06 20:51:02.000000000 +0000
@@ -489,6 +489,11 @@
 **
 ** Fields in this structure are accessed under the BtShared.mutex
 ** found at self->pBt->mutex. 
+**
+** skipNext meaning:
+**    eState==SKIPNEXT && skipNext>0:  Next sqlite3BtreeNext() is no-op.
+**    eState==SKIPNEXT && skipNext<0:  Next sqlite3BtreePrevious() is no-op.
+**    eState==FAULT:                   Cursor fault with skipNext as error code.
 */
 struct BtCursor {
   Btree *pBtree;            /* The Btree to which this cursor belongs */
@@ -501,7 +506,8 @@
   void *pKey;               /* Saved key that was cursor last known position */
   Pgno pgnoRoot;            /* The root page of this tree */
   int nOvflAlloc;           /* Allocated size of aOverflow[] array */
-  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive */
+  int skipNext;    /* Prev() is noop if negative. Next() is noop if positive.
+                   ** Error code if eState==CURSOR_FAULT */
   u8 curFlags;              /* zero or more BTCF_* flags defined below */
   u8 eState;                /* One of the CURSOR_XXX constants (see below) */
   u8 hints;                             /* As configured by CursorSetHints() */
@@ -547,7 +553,7 @@
 **   on a different connection that shares the BtShared cache with this
 **   cursor.  The error has left the cache in an inconsistent state.
 **   Do nothing else with this cursor.  Any attempt to use the cursor
-**   should return the error code stored in BtCursor.skip
+**   should return the error code stored in BtCursor.skipNext
 */
 #define CURSOR_INVALID           0
 #define CURSOR_VALID             1
diff -Nur sqlite3-3.8.7.1/src/expr.c sqlite3-3.8.7.3/src/expr.c
--- sqlite3-3.8.7.1/src/expr.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/expr.c	2014-12-06 20:51:02.000000000 +0000
@@ -1393,7 +1393,8 @@
       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;
   }
@@ -1836,7 +1837,6 @@
         assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
         pSelect->iLimit = 0;
         testcase( pSelect->selFlags & SF_Distinct );
-        pSelect->selFlags &= ~SF_Distinct;
         testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */
         if( sqlite3Select(pParse, pSelect, &dest) ){
           sqlite3KeyInfoUnref(pKeyInfo);
diff -Nur sqlite3-3.8.7.1/src/main.c sqlite3-3.8.7.3/src/main.c
--- sqlite3-3.8.7.1/src/main.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/main.c	2014-12-06 20:51:02.000000000 +0000
@@ -930,6 +930,14 @@
   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 ){
@@ -1016,13 +1024,15 @@
 
 /*
 ** Rollback all database files.  If tripCode is not SQLITE_OK, then
-** any open cursors are invalidated ("tripped" - as in "tripping a circuit
+** any write cursors are invalidated ("tripped" - as in "tripping a circuit
 ** breaker") and made to return tripCode if there are any further
-** attempts to use that cursor.
+** attempts to use that cursor.  Read cursors remain open and valid
+** but are "saved" in case the table pages are moved around.
 */
 void sqlite3RollbackAll(sqlite3 *db, int tripCode){
   int i;
   int inTrans = 0;
+  int schemaChange;
   assert( sqlite3_mutex_held(db->mutex) );
   sqlite3BeginBenignMalloc();
 
@@ -1033,6 +1043,7 @@
   ** the database rollback and schema reset, which can cause false
   ** corruption reports in some cases.  */
   sqlite3BtreeEnterAll(db);
+  schemaChange = (db->flags & SQLITE_InternChanges)!=0 && db->init.busy==0;
 
   for(i=0; i<db->nDb; i++){
     Btree *p = db->aDb[i].pBt;
@@ -1040,7 +1051,7 @@
       if( sqlite3BtreeIsInTrans(p) ){
         inTrans = 1;
       }
-      sqlite3BtreeRollback(p, tripCode);
+      sqlite3BtreeRollback(p, tripCode, !schemaChange);
     }
   }
   sqlite3VtabRollback(db);
diff -Nur sqlite3-3.8.7.1/src/printf.c sqlite3-3.8.7.3/src/printf.c
--- sqlite3-3.8.7.1/src/printf.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/printf.c	2014-12-06 20:51:02.000000000 +0000
@@ -212,7 +212,7 @@
   const et_info *infop;      /* Pointer to the appropriate info structure */
   char *zOut;                /* Rendering buffer */
   int nOut;                  /* Size of the rendering buffer */
-  char *zExtra;              /* Malloced memory used by some conversion */
+  char *zExtra = 0;          /* Malloced memory used by some conversion */
 #ifndef SQLITE_OMIT_FLOATING_POINT
   int  exp, e2;              /* exponent of real numbers */
   int nsd;                   /* Number of significant digits returned */
@@ -329,7 +329,6 @@
         break;
       }
     }
-    zExtra = 0;
 
     /*
     ** At this point, variables are initialized as follows:
@@ -620,13 +619,16 @@
         }else{
           c = va_arg(ap,int);
         }
-        buf[0] = (char)c;
-        if( precision>=0 ){
-          for(idx=1; idx<precision; idx++) buf[idx] = (char)c;
-          length = precision;
-        }else{
-          length =1;
+        if( precision>1 ){
+          width -= precision-1;
+          if( width>1 && !flag_leftjustify ){
+            sqlite3AppendChar(pAccum, width-1, ' ');
+            width = 0;
+          }
+          sqlite3AppendChar(pAccum, precision-1, c);
         }
+        length = 1;
+        buf[0] = c;
         bufpt = buf;
         break;
       case etSTRING:
@@ -727,11 +729,14 @@
     ** the output.
     */
     width -= length;
-    if( width>0 && !flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
+    if( width>0 && !flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
     sqlite3StrAccumAppend(pAccum, bufpt, length);
-    if( width>0 && flag_leftjustify ) sqlite3AppendSpace(pAccum, width);
+    if( width>0 && flag_leftjustify ) sqlite3AppendChar(pAccum, width, ' ');
 
-    if( zExtra ) sqlite3_free(zExtra);
+    if( zExtra ){
+      sqlite3_free(zExtra);
+      zExtra = 0;
+    }
   }/* End for loop over the format string */
 } /* End of function */
 
@@ -784,11 +789,11 @@
 }
 
 /*
-** Append N space characters to the given string buffer.
+** Append N copies of character c to the given string buffer.
 */
-void sqlite3AppendSpace(StrAccum *p, int N){
+void sqlite3AppendChar(StrAccum *p, int N, char c){
   if( p->nChar+N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ) return;
-  while( (N--)>0 ) p->zText[p->nChar++] = ' ';
+  while( (N--)>0 ) p->zText[p->nChar++] = c;
 }
 
 /*
diff -Nur sqlite3-3.8.7.1/src/resolve.c sqlite3-3.8.7.3/src/resolve.c
--- sqlite3-3.8.7.1/src/resolve.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/resolve.c	2014-12-06 20:51:02.000000000 +0000
@@ -320,6 +320,10 @@
       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 ) */
diff -Nur sqlite3-3.8.7.1/src/sqliteInt.h sqlite3-3.8.7.3/src/sqliteInt.h
--- sqlite3-3.8.7.1/src/sqliteInt.h	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/sqliteInt.h	2014-12-06 20:51:02.000000000 +0000
@@ -2014,7 +2014,7 @@
 /*
 ** 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 @@
 #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 
@@ -3539,7 +3540,7 @@
 void sqlite3StrAccumInit(StrAccum*, char*, int, int);
 void sqlite3StrAccumAppend(StrAccum*,const char*,int);
 void sqlite3StrAccumAppendAll(StrAccum*,const char*);
-void sqlite3AppendSpace(StrAccum*,int);
+void sqlite3AppendChar(StrAccum*,int,char);
 char *sqlite3StrAccumFinish(StrAccum*);
 void sqlite3StrAccumReset(StrAccum*);
 void sqlite3SelectDestInit(SelectDest*,int,int);
diff -Nur sqlite3-3.8.7.1/src/vdbe.c sqlite3-3.8.7.3/src/vdbe.c
--- sqlite3-3.8.7.1/src/vdbe.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/vdbe.c	2014-12-06 20:51:02.000000000 +0000
@@ -2298,7 +2298,7 @@
         pC->payloadSize = pC->szRow = avail = pReg->n;
         pC->aRow = (u8*)pReg->z;
       }else{
-        MemSetTypeFlag(pDest, MEM_Null);
+        sqlite3VdbeMemSetNull(pDest);
         goto op_column_out;
       }
     }else{
@@ -2822,11 +2822,18 @@
         db->isTransactionSavepoint = 0;
         rc = p->rc;
       }else{
+        int isSchemaChange;
         iSavepoint = db->nSavepoint - iSavepoint - 1;
         if( p1==SAVEPOINT_ROLLBACK ){
+          isSchemaChange = (db->flags & SQLITE_InternChanges)!=0;
           for(ii=0; ii<db->nDb; ii++){
-            sqlite3BtreeTripAllCursors(db->aDb[ii].pBt, SQLITE_ABORT);
+            rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,
+                                       SQLITE_ABORT_ROLLBACK,
+                                       isSchemaChange==0);
+            if( rc!=SQLITE_OK ) goto abort_due_to_error;
           }
+        }else{
+          isSchemaChange = 0;
         }
         for(ii=0; ii<db->nDb; ii++){
           rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);
@@ -2834,7 +2841,7 @@
             goto abort_due_to_error;
           }
         }
-        if( p1==SAVEPOINT_ROLLBACK && (db->flags&SQLITE_InternChanges)!=0 ){
+        if( isSchemaChange ){
           sqlite3ExpirePreparedStatements(db);
           sqlite3ResetAllSchemasOfConnection(db);
           db->flags = (db->flags | SQLITE_InternChanges);
@@ -3231,7 +3238,7 @@
           || p->readOnly==0 );
 
   if( p->expired ){
-    rc = SQLITE_ABORT;
+    rc = SQLITE_ABORT_ROLLBACK;
     break;
   }
 
@@ -4398,6 +4405,10 @@
     assert( pC->pCursor!=0 );
     rc = sqlite3VdbeCursorRestore(pC);
     if( rc ) goto abort_due_to_error;
+    if( pC->nullRow ){
+      pOut->flags = MEM_Null;
+      break;
+    }
     rc = sqlite3BtreeKeySize(pC->pCursor, &v);
     assert( rc==SQLITE_OK );  /* Always so because of CursorRestore() above */
   }
diff -Nur sqlite3-3.8.7.1/src/wal.c sqlite3-3.8.7.3/src/wal.c
--- sqlite3-3.8.7.1/src/wal.c	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/src/wal.c	2014-12-06 20:51:02.000000000 +0000
@@ -2525,7 +2525,6 @@
     }
     if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
   }
-  assert( rc==SQLITE_OK );
   return rc;
 }
 
diff -Nur sqlite3-3.8.7.1/VERSION sqlite3-3.8.7.3/VERSION
--- sqlite3-3.8.7.1/VERSION	2014-10-29 21:13:32.000000000 +0000
+++ sqlite3-3.8.7.3/VERSION	2014-12-06 20:51:02.000000000 +0000
@@ -1 +1 @@
-3.8.7.1
+3.8.7.3

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to