Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a broken assert() in where.c. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | experimental |
Files: | files | file ages | folders |
SHA1: |
090b29177fbc9faa83b560d92ddc3710 |
User & Date: | dan 2011-07-02 06:44:05.968 |
Context
2011-07-02
| ||
09:46 | Merge experimental changes improving optimization of DISTINCT queries with the trunk. (check-in: 45e581bff7 user: dan tags: trunk) | |
06:44 | Fix a broken assert() in where.c. (Closed-Leaf check-in: 090b29177f user: dan tags: experimental) | |
2011-07-01
| ||
18:43 | Merge latest trunk changes with experimental branch. (check-in: e56be74eab user: dan tags: experimental) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
1509 1510 1511 1512 1513 1514 1515 | /* If there is more than one table or sub-select in the FROM clause of ** this query, then it will not be possible to show that the DISTINCT ** clause is redundant. */ if( pTabList->nSrc!=1 ) return 0; iBase = pTabList->a[0].iCursor; pTab = pTabList->a[0].pTab; | | > > > < | | 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | /* If there is more than one table or sub-select in the FROM clause of ** this query, then it will not be possible to show that the DISTINCT ** clause is redundant. */ if( pTabList->nSrc!=1 ) return 0; iBase = pTabList->a[0].iCursor; pTab = pTabList->a[0].pTab; /* If any of the expressions is an IPK column on table iBase, then return ** true. Note: The (p->iTable==iBase) part of this test may be false if the ** current SELECT is a correlated sub-query. */ for(i=0; i<pDistinct->nExpr; i++){ Expr *p = pDistinct->a[i].pExpr; if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1; } /* Loop through all indices on the table, checking each to see if it makes ** the DISTINCT qualifier redundant. It does so if: ** ** 1. The index is itself UNIQUE, and ** |
︙ | ︙ |
Changes to test/distinct.test.
︙ | ︙ | |||
152 153 154 155 156 157 158 159 160 161 162 163 | 8 "b COLLATE nocase FROM t1" {} {b} 9 "b COLLATE nocase FROM t1 ORDER BY b COLLATE nocase" {} {B} } { do_execsql_test 2.$tn.1 "SELECT DISTINCT $sql" $res do_temptables_test 2.$tn.2 "SELECT DISTINCT $sql" $temptables } finish_test | > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | 8 "b COLLATE nocase FROM t1" {} {b} 9 "b COLLATE nocase FROM t1 ORDER BY b COLLATE nocase" {} {B} } { do_execsql_test 2.$tn.1 "SELECT DISTINCT $sql" $res do_temptables_test 2.$tn.2 "SELECT DISTINCT $sql" $temptables } do_execsql_test 2.A { SELECT (SELECT DISTINCT o.a FROM t1 AS i) FROM t1 AS o; } {a A a A} finish_test |