Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix faulty asserts in the code generator. Ticket [c52b09c7f38903b1] |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
01cdc590f7894ea23ee0d674747d7ebf |
User & Date: | drh 2019-07-24 23:15:19.192 |
Context
2019-07-25
| ||
19:29 | Fix a potential buffer overread in fts5 triggered by a corrupt database record. (check-in: 16472112b6 user: dan tags: trunk) | |
2019-07-24
| ||
23:15 | Fix faulty asserts in the code generator. Ticket [c52b09c7f38903b1] (check-in: 01cdc590f7 user: drh tags: trunk) | |
20:10 | Improve the ".recover" command so that it handles intkey pages linked into non-intkey b-trees, and vice-versa, better. (check-in: 9c458acba5 user: dan tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
5865 5866 5867 5868 5869 5870 5871 | pSub = pItem->pSelect; if( pSub==0 ) continue; /* The code for a subquery should only be generated once, though it is ** technically harmless for it to be generated multiple times. The ** following assert() will detect if something changes to cause ** the same subquery to be coded multiple times, as a signal to the | | > > > > > > > | | 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 | pSub = pItem->pSelect; if( pSub==0 ) continue; /* The code for a subquery should only be generated once, though it is ** technically harmless for it to be generated multiple times. The ** following assert() will detect if something changes to cause ** the same subquery to be coded multiple times, as a signal to the ** developers to try to optimize the situation. ** ** Update 2019-07-24: ** See ticket https://sqlite.org/src/tktview/c52b09c7f38903b1311cec40. ** The dbsqlfuzz fuzzer found a case where the same subquery gets ** coded twice. So this assert() now becomes a testcase(). It should ** be very rare, though. */ testcase( pItem->addrFillSub!=0 ); /* Increment Parse.nHeight by the height of the largest expression ** tree referred to by this, the parent select. The child select ** may contain expression trees of at most ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit ** more conservative than necessary, but much easier than enforcing ** an exact limit. |
︙ | ︙ | |||
5940 5941 5942 5943 5944 5945 5946 | ** is a register allocated to hold the subroutine return address */ int topAddr; int onceAddr = 0; int retAddr; struct SrcList_item *pPrior; | | | 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 | ** is a register allocated to hold the subroutine return address */ int topAddr; int onceAddr = 0; int retAddr; struct SrcList_item *pPrior; testcase( pItem->addrFillSub==0 ); /* Ticket c52b09c7f38903b1311 */ pItem->regReturn = ++pParse->nMem; topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn); pItem->addrFillSub = topAddr+1; if( pItem->fg.isCorrelated==0 ){ /* If the subquery is not correlated and if we are not inside of ** a trigger, then we only need to compute the value of the subquery ** once. */ |
︙ | ︙ |
Changes to test/select1.test.
︙ | ︙ | |||
1095 1096 1097 1098 1099 1100 1101 1102 1103 | do_execsql_test select1-17.2 { SELECT * FROM t1,(SELECT * FROM t2 WHERE y=2 ORDER BY y,z LIMIT 4); } {1 2 3} do_execsql_test select1-17.3 { SELECT * FROM t1,(SELECT * FROM t2 WHERE y=2 UNION ALL SELECT * FROM t2 WHERE y=3 ORDER BY y,z LIMIT 4); } {1 2 3} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | do_execsql_test select1-17.2 { SELECT * FROM t1,(SELECT * FROM t2 WHERE y=2 ORDER BY y,z LIMIT 4); } {1 2 3} do_execsql_test select1-17.3 { SELECT * FROM t1,(SELECT * FROM t2 WHERE y=2 UNION ALL SELECT * FROM t2 WHERE y=3 ORDER BY y,z LIMIT 4); } {1 2 3} # 2019-07-24 Ticket https://sqlite.org/src/tktview/c52b09c7f38903b1311 # do_execsql_test select1-18.1 { DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; CREATE TABLE t1(c); CREATE TABLE t2(x PRIMARY KEY, y); INSERT INTO t1(c) VALUES(123); INSERT INTO t2(x) VALUES(123); SELECT x FROM t2, t1 WHERE x BETWEEN c AND null OR x AND x IN ((SELECT x FROM (SELECT x FROM t2, t1 WHERE x BETWEEN (SELECT x FROM (SELECT x COLLATE rtrim FROM t2, t1 WHERE x BETWEEN c AND null OR x AND x IN (c)), t1 WHERE x BETWEEN c AND null OR x AND x IN (c)) AND null OR NOT EXISTS(SELECT -4.81 FROM t1, t2 WHERE x BETWEEN c AND null OR x AND x IN ((SELECT x FROM (SELECT x FROM t2, t1 WHERE x BETWEEN (SELECT x FROM (SELECT x BETWEEN c AND null OR x AND x IN (c)), t1 WHERE x BETWEEN c AND null OR x AND x IN (c)) AND null OR x AND x IN (c)), t1 WHERE x BETWEEN c AND null OR x AND x IN (c)))) AND x IN (c) ), t1 WHERE x BETWEEN c AND null OR x AND x IN (c))); } {} do_execsql_test select1-18.2 { DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; CREATE TABLE t1(c); CREATE TABLE t2(x PRIMARY KEY, y); INSERT INTO t1(c) VALUES(123); INSERT INTO t2(x) VALUES(123); SELECT x FROM t2, t1 WHERE x BETWEEN c AND (c+1) OR x AND x IN ((SELECT x FROM (SELECT x FROM t2, t1 WHERE x BETWEEN (SELECT x FROM (SELECT x COLLATE rtrim FROM t2, t1 WHERE x BETWEEN c AND (c+1) OR x AND x IN (c)), t1 WHERE x BETWEEN c AND (c+1) OR x AND x IN (c)) AND (c+1) OR NOT EXISTS(SELECT -4.81 FROM t1, t2 WHERE x BETWEEN c AND (c+1) OR x AND x IN ((SELECT x FROM (SELECT x FROM t2, t1 WHERE x BETWEEN (SELECT x FROM (SELECT x BETWEEN c AND (c+1) OR x AND x IN (c)), t1 WHERE x BETWEEN c AND (c+1) OR x AND x IN (c)) AND (c+1) OR x AND x IN (c)), t1 WHERE x BETWEEN c AND (c+1) OR x AND x IN (c)))) AND x IN (c) ), t1 WHERE x BETWEEN c AND (c+1) OR x AND x IN (c))); } {123} do_execsql_test select1-18.3 { SELECT 1 FROM t1 WHERE ( SELECT 2 FROM t2 WHERE ( SELECT 3 FROM ( SELECT x FROM t2 WHERE x=c OR x=(SELECT x FROM (VALUES(0))) ) WHERE x>c OR x=c ) ); } {1} do_execsql_test select1-18.4 { SELECT 1 FROM t1, t2 WHERE ( SELECT 3 FROM ( SELECT x FROM t2 WHERE x=c OR x=(SELECT x FROM (VALUES(0))) ) WHERE x>c OR x=c ); } {1} finish_test |