Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a (harmless) assertion fault on nested views where the inner views are compound selects. Ticket #2192. (CVS 3605) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
942e7193bbf1ffe9a703891d175e0166 |
User & Date: | drh 2007-01-26 19:04:00.000 |
Context
2007-01-26
| ||
19:23 | Add code to select.c for printing the contents of parse-tree structures. The code is normally omitted. You must compile with -DSQLITE_TEST or -DSQLITE_DEBUG to enable it. (CVS 3606) (check-in: 1b26d68756 user: drh tags: trunk) | |
19:04 | Fix a (harmless) assertion fault on nested views where the inner views are compound selects. Ticket #2192. (CVS 3605) (check-in: 942e7193bb user: drh tags: trunk) | |
13:08 | Make sure the loadext.c module works even if all SQLITE_OMIT macros are defined. Tickets #2184 and #2069. (CVS 3604) (check-in: e1fae43c89 user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.324 2007/01/26 19:04:00 drh Exp $ */ #include "sqliteInt.h" /* ** Delete all the content of a Select structure but do not deallocate ** the select structure itself. |
︙ | ︙ | |||
1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 | /* If [0] is unused then [1] is also unused. So we can ** always safely abort as soon as the first unused slot is found */ assert( pLoop->addrOpenEphm[1]<0 ); break; } sqlite3VdbeChangeP2(v, addr, nCol); sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO); } } if( pOrderBy ){ struct ExprList_item *pOTerm = pOrderBy->a; int nOrderByExpr = pOrderBy->nExpr; int addr; | > | 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | /* If [0] is unused then [1] is also unused. So we can ** always safely abort as soon as the first unused slot is found */ assert( pLoop->addrOpenEphm[1]<0 ); break; } sqlite3VdbeChangeP2(v, addr, nCol); sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO); pLoop->addrOpenEphm[i] = -1; } } if( pOrderBy ){ struct ExprList_item *pOTerm = pOrderBy->a; int nOrderByExpr = pOrderBy->nExpr; int addr; |
︙ | ︙ |
Added test/tkt2192.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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | # 2007 January 26 # # 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 #2192 has been # fixed. # # # $Id: tkt2192.test,v 1.1 2007/01/26 19:04:00 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test tkt2191-1.1 { execsql { -- Raw data (RBS) -------- create table records ( date real, type text, description text, value integer, acc_name text, acc_no text ); -- Direct Debits ---------------- create view direct_debits as select * from records where type = 'D/D'; create view monthly_direct_debits as select strftime('%Y-%m', date) as date, (-1 * sum(value)) as value from direct_debits group by strftime('%Y-%m', date); -- Expense Categories --------------- create view energy as select strftime('%Y-%m', date) as date, (-1 * sum(value)) as value from direct_debits where description like '%NPOWER%' group by strftime('%Y-%m', date); create view phone_internet as select strftime('%Y-%m', date) as date, (-1 * sum(value)) as value from direct_debits where description like '%BT DIRECT%' or description like '%SUPANET%' or description like '%ORANGE%' group by strftime('%Y-%m', date); create view credit_cards as select strftime('%Y-%m', date) as date, (-1 * sum(value)) as value from direct_debits where description like '%VISA%' group by strftime('%Y-%m', date); -- Overview --------------------- create view expense_overview as select 'Energy' as expense, date, value from energy union select 'Phone/Internet' as expense, date, value from phone_internet union select 'Credit Card' as expense, date, value from credit_cards; create view jan as select 'jan', expense, value from expense_overview where date like '%-01'; create view nov as select 'nov', expense, value from expense_overview where date like '%-11'; create view summary as select * from jan join nov on (jan.expense = nov.expense); } } {} do_test tkt2192-1.2 { # set ::sqlite_addop_trace 1 execsql { select * from summary; } } {} do_test tkt2192-2.1 { execsql { CREATE TABLE t1(a,b); CREATE VIEW v1 AS SELECT * FROM t1 WHERE b%7=0 UNION SELECT * FROM t1 WHERE b%5=0; INSERT INTO t1 VALUES(1,7); INSERT INTO t1 VALUES(2,10); INSERT INTO t1 VALUES(3,14); INSERT INTO t1 VALUES(4,15); INSERT INTO t1 VALUES(1,16); INSERT INTO t1 VALUES(2,17); INSERT INTO t1 VALUES(3,20); INSERT INTO t1 VALUES(4,21); INSERT INTO t1 VALUES(1,22); INSERT INTO t1 VALUES(2,24); INSERT INTO t1 VALUES(3,25); INSERT INTO t1 VALUES(4,26); INSERT INTO t1 VALUES(1,27); SELECT b FROM v1 ORDER BY b; } } {7 10 14 15 20 21 25} do_test tkt2192-2.2 { execsql { SELECT * FROM v1 ORDER BY a, b; } } {1 7 2 10 3 14 3 20 3 25 4 15 4 21} do_test tkt2192-2.3 { execsql { SELECT x.a || '/' || x.b || '/' || y.b FROM v1 AS x JOIN v1 AS y ON x.a=y.a AND x.b<y.b ORDER BY x.a, x.b, y.b } } {3/14/20 3/14/25 3/20/25 4/15/21} do_test tkt2192-2.4 { execsql { CREATE VIEW v2 AS SELECT x.a || '/' || x.b || '/' || y.b AS z FROM v1 AS x JOIN v1 AS y ON x.a=y.a AND x.b<y.b ORDER BY x.a, x.b, y.b; SELECT * FROM v2; } } {3/14/20 3/14/25 3/20/25 4/15/21} finish_test |