Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Make sure the reverse_unordered_selects pragma works even on unindexed tables that are queried without a WHERE clause (CVS 6453) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d8c6b28a734fccbbbd567d98ffa7e655 |
User & Date: | drh 2009-04-06 12:26:58.000 |
Context
2009-04-06
| ||
14:16 | Allow "default" to be a keyword used by PRAGMA statements. (CVS 6454) (check-in: ed99d2d97f user: drh tags: trunk) | |
12:26 | Make sure the reverse_unordered_selects pragma works even on unindexed tables that are queried without a WHERE clause (CVS 6453) (check-in: d8c6b28a73 user: drh tags: trunk) | |
11:11 | Check-in (6450) introduced the possibility of calling memset() with a negative 3rd argument. This fixes that bug. Ticket #3777. (CVS 6452) (check-in: 8ca612c42e user: drh tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is responsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is responsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** ** $Id: where.c,v 1.380 2009/04/06 12:26:58 drh Exp $ */ #include "sqliteInt.h" /* ** Trace output macros */ #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) |
︙ | ︙ | |||
1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 | ** well put it first in the join order. That way, perhaps it can be ** referenced by other tables in the join. */ memset(pCost, 0, sizeof(*pCost)); if( pProbe==0 && findTerm(pWC, iCur, -1, 0, WO_EQ|WO_IN|WO_LT|WO_LE|WO_GT|WO_GE,0)==0 && (pOrderBy==0 || !sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev)) ){ return; } pCost->rCost = SQLITE_BIG_DBL; /* Check for a rowid=EXPR or rowid IN (...) constraints. If there was ** an INDEXED BY clause attached to this table, skip this step. */ | > > > > > > > | 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 | ** well put it first in the join order. That way, perhaps it can be ** referenced by other tables in the join. */ memset(pCost, 0, sizeof(*pCost)); if( pProbe==0 && findTerm(pWC, iCur, -1, 0, WO_EQ|WO_IN|WO_LT|WO_LE|WO_GT|WO_GE,0)==0 && (pOrderBy==0 || !sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev)) ){ if( pParse->db->flags & SQLITE_ReverseOrder ){ /* For application testing, randomly reverse the output order for ** SELECT statements that omit the ORDER BY clause. This will help ** to find cases where */ pCost->plan.wsFlags |= WHERE_REVERSE; } return; } pCost->rCost = SQLITE_BIG_DBL; /* Check for a rowid=EXPR or rowid IN (...) constraints. If there was ** an INDEXED BY clause attached to this table, skip this step. */ |
︙ | ︙ |
Changes to test/whereA.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2009 February 23 # # 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. The # focus of this file is testing the reverse_select_order pragma. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2009 February 23 # # 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. The # focus of this file is testing the reverse_select_order pragma. # # $Id: whereA.test,v 1.2 2009/04/06 12:26:58 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test whereA-1.1 { db eval { CREATE TABLE t1(a INTEGER PRIMARY KEY, b UNIQUE, c); |
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 | } {2 hello world 3 4.53 {} 1 2 3} do_test whereA-3.3 { db eval { PRAGMA reverse_unordered_selects=1; SELECT * FROM t1 WHERE b>0 ORDER BY b; } } {1 2 3 3 4.53 {} 2 hello world} finish_test | > > > > > > > > > > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | } {2 hello world 3 4.53 {} 1 2 3} do_test whereA-3.3 { db eval { PRAGMA reverse_unordered_selects=1; SELECT * FROM t1 WHERE b>0 ORDER BY b; } } {1 2 3 3 4.53 {} 2 hello world} do_test whereA-4.1 { db eval { CREATE TABLE t2(x); INSERT INTO t2 VALUES(1); INSERT INTO t2 VALUES(2); SELECT x FROM t2; } } {2 1} finish_test |