Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Disable query flattening when the outer query is a compound SELECT and the inner query has a LIMIT clause. Ticket [02a8e81d44]. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f96782b389b5b97b488dc5814f7082e0 |
User & Date: | drh 2010-04-15 23:24:29.000 |
Context
2010-04-17
| ||
12:53 | Change sqlite3_step() so that it automatically calls sqlite3_reset() instead of returning SQLITE_MISUSE when invoked on a prepared statement that previously returned any value other than SQLITE_ROW. (check-in: 3e646e3f4c user: drh tags: trunk) | |
2010-04-16
| ||
22:05 | Changes for branch coverage of notify.c. Fixed quirk of unlock_notify() where it would still think it was blocked after a callback was cleared (even after the transaction on the blocking connection was closed). (check-in: c54e8dad01 user: shaneh tags: experimental) | |
2010-04-15
| ||
23:24 | Disable query flattening when the outer query is a compound SELECT and the inner query has a LIMIT clause. Ticket [02a8e81d44]. (check-in: f96782b389 user: drh tags: trunk) | |
13:29 | The query planner fix of check-in [33b1f584ef] should have been on the trunk. (check-in: f538d759be user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
2522 2523 2524 2525 2526 2527 2528 | ** a separate restriction deriving from ticket #350. ** ** (13) The subquery and outer query do not both use LIMIT ** ** (14) The subquery does not use OFFSET ** ** (15) The outer query is not part of a compound select or the | | | | 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 | ** a separate restriction deriving from ticket #350. ** ** (13) The subquery and outer query do not both use LIMIT ** ** (14) The subquery does not use OFFSET ** ** (15) The outer query is not part of a compound select or the ** subquery does not have a LIMIT clause. ** (See ticket #2339 and ticket [02a8e81d44]). ** ** (16) The outer query is not an aggregate or the subquery does ** not contain ORDER BY. (Ticket #2942) This used to not matter ** until we introduced the group_concat() function. ** ** (17) The sub-query is not a compound select, or it is a UNION ALL ** compound clause made up entirely of non-aggregate queries, and |
︙ | ︙ | |||
2606 2607 2608 2609 2610 2611 2612 | /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET ** because they could be computed at compile-time. But when LIMIT and OFFSET ** became arbitrary expressions, we were forced to add restrictions (13) ** and (14). */ if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */ if( pSub->pOffset ) return 0; /* Restriction (14) */ | | | 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 | /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET ** because they could be computed at compile-time. But when LIMIT and OFFSET ** became arbitrary expressions, we were forced to add restrictions (13) ** and (14). */ if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */ if( pSub->pOffset ) return 0; /* Restriction (14) */ if( p->pRightmost && pSub->pLimit ){ return 0; /* Restriction (15) */ } if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */ if( ((pSub->selFlags & SF_Distinct)!=0 || pSub->pLimit) && (pSrc->nSrc>1 || isAgg) ){ /* Restrictions (4)(5)(8)(9) */ return 0; } |
︙ | ︙ |
Added test/tkt-02a8e81d44.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # 2010 April 15 # # 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. # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to verify that ticket [02a8e81d44] has been # fixed. # set testdir [file dirname $argv0] source $testdir/tester.tcl do_test tkt-02a838-1.1 { execsql { CREATE TABLE t1(a); INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2); INSERT INTO t1 VALUES(4); INSERT INTO t1 VALUES(5); SELECT * FROM (SELECT a FROM t1 LIMIT 1) UNION ALL SELECT 3; } } {1 3} finish_test |