]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix for ticket [787fa716be3a7f650cac]
authordrh <drh@noemail.net>
Fri, 9 Nov 2018 14:17:51 +0000 (14:17 +0000)
committerdrh <drh@noemail.net>
Fri, 9 Nov 2018 14:17:51 +0000 (14:17 +0000)
FossilOrigin-Name: 531eca6104e41e4301fa2cf58bb8fec811da31e151a0f766c93aece5521d235b

manifest
manifest.uuid
src/where.c
test/autoindex5.test

index 5b3bf34dfe6164677fafdc12c274ee69d524cb2d..93f8e9597f849e7fb6d1c3a3a5deccb85d85124d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C In\sthe\streeview.c\smodule,\sbreak\sout\sthe\sdisplay\sof\sSrcList\sinto\sa\sseparate\nsubroutine,\sso\sthat\sit\scan\sbe\sinvoked\swhile\sdebugging.
-D 2018-11-08T22:53:06.181
+C Fix\sfor\sticket\s[787fa716be3a7f650cac]
+D 2018-11-09T14:17:51.539
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in edbb6e20bb1decf65f6c64c9e61004a69bdf8afb39cdce5337c916b03dfcd1e3
@@ -589,7 +589,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
 F src/wal.c 3f4f653daf234fe713edbcbca3fec2350417d159d28801feabc702a22c4e213f
 F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a
 F src/walker.c fb94aadc9099ff9c6506d0a8b88d51266005bcaa265403f3d7caf732a562eb66
-F src/where.c a54a3d639bcd751d1474deff58e239b2e475a96e1b8f9178aa7864df8782a4e3
+F src/where.c f5da1079f084c569aa70fd4ada6b7e45b356e19708f1e5307493cc65857ec9e4
 F src/whereInt.h f125f29fca80890768e0b2caa14f95db74b2dacd3a122a168f97aa7b64d6968f
 F src/wherecode.c c45f03aefc2266b990df0fc4d7acc4e27f56f881f4fc0fc355b7cbc4d7189da5
 F src/whereexpr.c 491f0894ad9903750cdecb7894437a0cabdffdd88f574d2b1c9ac85d14fe4b9c
@@ -652,7 +652,7 @@ F test/autoindex1.test a09958fa756129af10b6582bcbf3cbdf11e305e027b393f393caef801
 F test/autoindex2.test 12ef578928102baaa0dc23ad397601a2f4ecb0df
 F test/autoindex3.test 2dd997d6590438b53e4f715f9278aa91c9299cf3f81246a0915269c35beb790e
 F test/autoindex4.test 49d3cd791a9baa16fb461d7ea3de80d019a819cf
-F test/autoindex5.test 5f0135dc3b266277b8c1904624439097d8e8020dd7197eda13fda23c35c21a05
+F test/autoindex5.test 4a0eb6c7c7ae456d97a2061d4c8d6380946272c5c91d91507c1feb1af3dc7cce
 F test/autovacuum.test 0831cd34e14695d297187f7f6519265e3121c5b0a1720e548e86829e796129e9
 F test/autovacuum_ioerr2.test 8a367b224183ad801e0e24dcb7d1501f45f244b4
 F test/avtrans.test b7dc25459ecbd86c6fa9c606ee3068f59d81e225118617dcf2bbb6ded2ade89e
@@ -1776,7 +1776,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 13e21b7da8fe754e230b09ca0b9f1f69cd9aa20d4407ddd8b95ca3fb18c9abeb
-R 915a30395d1ecdd8d23bc571af6386b9
+P 8c74065f0031274d9bc711d5d53c39aefcfb2b2679811105974a2c7c7a9e1dcb
+R 2aed8ed9bf698610f2ccf16db30ac97b
 U drh
-Z 043032fb93e658994b3c5096b42d8a7a
+Z 05df484bedb945ae17a7cf3ccd63a280
index 31859bc7313758bdfc306fcdf55a5907264f851a..7fbf2352be533d5efa09e83b302f8aa9e33cb3d8 100644 (file)
@@ -1 +1 @@
-8c74065f0031274d9bc711d5d53c39aefcfb2b2679811105974a2c7c7a9e1dcb
\ No newline at end of file
+531eca6104e41e4301fa2cf58bb8fec811da31e151a0f766c93aece5521d235b
\ No newline at end of file
index bfc11eec18eda4ec73fc91a69878422741eb2c74..f4d4138c8fa7305aa2c7bd4fa4f865acb78fa82a 100644 (file)
@@ -854,7 +854,6 @@ static void constructAutomaticIndex(
     translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
                           pTabItem->regResult, 1);
     sqlite3VdbeGoto(v, addrTop);
-    pTabItem->fg.viaCoroutine = 0;
   }else{
     sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
   }
index aba546a1ecaca096895c689278c7826849d78ddc..368f2d302c347d462c6fb498a7507cb2adb1c561 100644 (file)
@@ -123,6 +123,91 @@ do_execsql_test 2.1 {
       SELECT sum(z) FROM vvv WHERE x='aaa'
   ) FROM one;
 } {8.0}
+
+# Ticket https://www.sqlite.org/src/info/787fa716be3a7f65
+# Segfault due to multiple uses of the same subquery where the
+# subquery is implemented via coroutine.
+#
+sqlite3 db :memory:
+do_execsql_test 3.0 {
+  -- This is the original test case reported on the mailing list
+  CREATE TABLE artists (
+    id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
+    name varchar(255)
+  );
+  CREATE TABLE albums (
+    id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
+    name varchar(255),
+    artist_id integer REFERENCES artists
+  );
+  INSERT INTO artists (name) VALUES ('Ar');
+  INSERT INTO albums (name, artist_id) VALUES ('Al', 1);
+  SELECT artists.*
+  FROM artists
+  INNER JOIN artists AS 'b' ON (b.id = artists.id)
+  WHERE (artists.id IN (
+    SELECT albums.artist_id
+    FROM albums
+    WHERE ((name = 'Al')
+      AND (albums.artist_id IS NOT NULL)
+      AND (albums.id IN (
+        SELECT id
+        FROM (
+          SELECT albums.id,
+                 row_number() OVER (
+                   PARTITION BY albums.artist_id
+                   ORDER BY name
+                 ) AS 'x'
+          FROM albums
+          WHERE (name = 'Al')
+        ) AS 't1'
+        WHERE (x = 1)
+      ))
+      AND (albums.id IN (1, 2)))
+  ));
+} {1 Ar}
+# The remaining test cases were discovered (by Dan) during trouble-shooting
+sqlite3 db :memory:
+do_execsql_test 3.1 {
+  CREATE TABLE t1 (a); INSERT INTO t1 (a) VALUES (104);
+  CREATE TABLE t2 (b); INSERT INTO t2 (b) VALUES (104);
+  CREATE TABLE t3 (c); INSERT INTO t3 (c) VALUES (104);
+  CREATE TABLE t4 (d); INSERT INTO t4 (d) VALUES (104);
+  SELECT *
+  FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN (
+    SELECT t3.c
+    FROM t3
+    WHERE t3.c IN (
+      SELECT d FROM (SELECT DISTINCT d FROM t4) AS x WHERE x.d=104
+    )
+  );
+} {104 104}
+sqlite3 db :memory:
+do_execsql_test 3.2 {
+  CREATE TABLE t5(a, b, c, d);
+  CREATE INDEX t5a ON t5(a);
+  CREATE INDEX t5b ON t5(b);
+  CREATE TABLE t6(e);
+  INSERT INTO t6 VALUES(1);
+  INSERT INTO t5 VALUES(1,1,1,1), (2,2,2,2);
+  SELECT * FROM t5 WHERE (a=1 OR b=2) AND c IN (
+    SELECT e FROM (SELECT DISTINCT e FROM t6) WHERE e=1
+  );
+} {1 1 1 1}
+sqlite3 db :memory:
+do_execsql_test 3.3 {
+  CREATE TABLE t1(a1, a2, a3);
+  CREATE INDEX t1a2 ON t1(a2, a1);
+  CREATE INDEX t1a3 ON t1(a3, a1);
+  CREATE TABLE t2(d);
+  INSERT INTO t1 VALUES(3, 1, 1), (3, 2, 2);
+  INSERT INTO t2 VALUES(3);
+  SELECT *, 'x' FROM t1 WHERE (a2=1 OR a3=2) AND a1 = (
+    SELECT d FROM (SELECT DISTINCT d FROM t2) WHERE d=3
+  );
+} {3 1 1 x 3 2 2 x}
+
+
     
 
 finish_test