-C Fix\sa\sproblem\spreventing\sresumption\sof\sRBU\soperations\safter\srecovering\sfrom\sa\nprocess\sor\ssystem\sfailure\sthat\soccurs\sduring\sthe\sincremental-checkpoint\sphase.
-D 2017-01-13T18:24:37.297
+C Add\stest\scases\sfor\stickets\s[91e2e8ba6ff2e2]\sand\s[7ffd1ca1d2ad4ec].
+D 2017-01-16T16:01:50.379
F Makefile.in 41bd4cad981487345c4a84081074bcdb876e4b2e
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc b8ca53350ae545e3562403d5da2a69cec79308da
F src/whereexpr.c 35ad025389a632a3987a35617c878be3b3d70dc6
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
+F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/aggnested.test b35b4cd69fc913f90d39a575e171e1116c3a4bb7
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 8c85b8fdd7f0ba65fba83361d361a567b797a184
-R dc62936e86267740ae9736f88160b05f
-U dan
-Z f2366ce5ecd39574b5b5eb81b3b99a63
+P 97914266cb4ec63b0c9185ab139673139bd2f0ed
+R b7007367e54a15c0816f3ba9a91a394f
+T *branch * automatic-index-affinity
+T *sym-automatic-index-affinity *
+T -sym-trunk *
+U drh
+Z 2b3d4a827097e1fdb9a913f5a46e57c3
--- /dev/null
+# 2017-01-16
+#
+# 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.
+#
+#***********************************************************************
+#
+# Test cases for bugs:
+#
+# https://www.sqlite.org/src/info/91e2e8ba6ff2e2
+# https://www.sqlite.org/src/info/7ffd1ca1d2ad4ecf
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Ticket https://www.sqlite.org/src/info/91e2e8ba6ff2e2 (2011-09-19)
+# Automatic index causes undesired type conversions
+#
+do_execsql_test affinity3-100 {
+ CREATE TABLE customer (id INT PRIMARY KEY);
+ CREATE TABLE apr (id INT PRIMARY KEY, apr REAL);
+
+ CREATE VIEW v1 AS
+ SELECT c.id, i.apr
+ FROM customer c
+ LEFT JOIN apr i ON i.id=c.id;
+
+ CREATE VIEW v2 AS
+ SELECT c.id, v1.apr
+ FROM customer c
+ LEFT JOIN v1 ON v1.id=c.id;
+
+ INSERT INTO customer (id) VALUES (1);
+ INSERT INTO apr (id, apr) VALUES (1, 12);
+ INSERT INTO customer (id) VALUES (2);
+ INSERT INTO apr (id, apr) VALUES (2, 12.01);
+}
+do_execsql_test affinity3-110 {
+ PRAGMA automatic_index=ON;
+ SELECT id, (apr / 100), typeof(apr) apr_type FROM v1;
+} {1 0.12 real 2 0.1201 real}
+do_execsql_test affinity3-120 {
+ SELECT id, (apr / 100), typeof(apr) apr_type FROM v2;
+} {1 0.12 real 2 0.1201 real}
+do_execsql_test affinity3-130 {
+ PRAGMA automatic_index=OFF;
+ SELECT id, (apr / 100), typeof(apr) apr_type FROM v1;
+} {1 0.12 real 2 0.1201 real}
+do_execsql_test affinity3-140 {
+ SELECT id, (apr / 100), typeof(apr) apr_type FROM v2;
+} {1 0.12 real 2 0.1201 real}
+
+# Ticket https://www.sqlite.org/src/info/7ffd1ca1d2ad4ecf (2017-01-16)
+# Incorrect affinity when using automatic indexes
+#
+do_execsql_test affinity3-200 {
+ CREATE TABLE map_integer (id INT, name);
+ INSERT INTO map_integer VALUES(1,'a');
+ CREATE TABLE map_text (id TEXT, name);
+ INSERT INTO map_text VALUES('4','e');
+ CREATE TABLE data (id TEXT, name);
+ INSERT INTO data VALUES(1,'abc');
+ INSERT INTO data VALUES('4','xyz');
+ CREATE VIEW idmap as
+ SELECT * FROM map_integer
+ UNION SELECT * FROM map_text;
+ CREATE TABLE mzed AS SELECT * FROM idmap;
+}
+
+do_execsql_test affinity3-210 {
+ PRAGMA automatic_index=ON;
+ SELECT * FROM data JOIN idmap USING(id);
+} {1 abc a 4 xyz e}
+do_execsql_test affinity3-220 {
+ SELECT * FROM data JOIN mzed USING(id);
+} {1 abc a 4 xyz e}
+
+do_execsql_test affinity3-250 {
+ PRAGMA automatic_index=OFF;
+ SELECT * FROM data JOIN idmap USING(id);
+} {1 abc a 4 xyz e}
+do_execsql_test affinity3-260 {
+ SELECT * FROM data JOIN mzed USING(id);
+} {1 abc a 4 xyz e}
+
+finish_test