| OLD | NEW | 
|    1 # The author disclaims copyright to this source code.  In place of |    1 # The author disclaims copyright to this source code.  In place of | 
|    2 # a legal notice, here is a blessing: |    2 # a legal notice, here is a blessing: | 
|    3 # |    3 # | 
|    4 #    May you do good and not evil. |    4 #    May you do good and not evil. | 
|    5 #    May you find forgiveness for yourself and forgive others. |    5 #    May you find forgiveness for yourself and forgive others. | 
|    6 #    May you share freely, never taking more than you give. |    6 #    May you share freely, never taking more than you give. | 
|    7 # |    7 # | 
|    8 #*********************************************************************** |    8 #*********************************************************************** | 
|    9 # This file implements regression tests for SQLite library.  The |    9 # This file implements regression tests for SQLite library.  The | 
|   10 # focus of this file is testing compute SELECT statements and nested |   10 # focus of this file is testing compute SELECT statements and nested | 
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  149     do_test select7-6.1 { |  149     do_test select7-6.1 { | 
|  150       catchsql $sql |  150       catchsql $sql | 
|  151     } [list 0 $result] |  151     } [list 0 $result] | 
|  152     append sql { UNION ALL SELECT 99999999} |  152     append sql { UNION ALL SELECT 99999999} | 
|  153     do_test select7-6.2 { |  153     do_test select7-6.2 { | 
|  154       catchsql $sql |  154       catchsql $sql | 
|  155     } {1 {too many terms in compound SELECT}} |  155     } {1 {too many terms in compound SELECT}} | 
|  156   } |  156   } | 
|  157 } |  157 } | 
|  158  |  158  | 
 |  159 # This block of tests verifies that bug aa92c76cd4 is fixed. | 
 |  160 # | 
 |  161 do_test select7-7.1 { | 
 |  162   execsql { | 
 |  163     CREATE TABLE t3(a REAL); | 
 |  164     INSERT INTO t3 VALUES(44.0); | 
 |  165     INSERT INTO t3 VALUES(56.0); | 
 |  166   } | 
 |  167 } {} | 
 |  168 do_test select7-7.2 { | 
 |  169   execsql { | 
 |  170     pragma vdbe_trace = 0; | 
 |  171     SELECT (CASE WHEN a=0 THEN 0 ELSE (a + 25) / 50 END) AS categ, count(*) | 
 |  172     FROM t3 GROUP BY categ | 
 |  173   } | 
 |  174 } {1.38 1 1.62 1} | 
 |  175 do_test select7-7.3 { | 
 |  176   execsql { | 
 |  177     CREATE TABLE t4(a REAL); | 
 |  178     INSERT INTO t4 VALUES( 2.0 ); | 
 |  179     INSERT INTO t4 VALUES( 3.0 ); | 
 |  180   } | 
 |  181 } {} | 
 |  182 do_test select7-7.4 { | 
 |  183   execsql { | 
 |  184     SELECT (CASE WHEN a=0 THEN 'zero' ELSE a/2 END) AS t FROM t4 GROUP BY t; | 
 |  185   } | 
 |  186 } {1.0 1.5} | 
 |  187 do_test select7-7.5 { | 
 |  188   execsql { SELECT a=0, typeof(a) FROM t4 } | 
 |  189 } {0 real 0 real} | 
 |  190 do_test select7-7.6 { | 
 |  191   execsql { SELECT a=0, typeof(a) FROM t4 GROUP BY a } | 
 |  192 } {0 real 0 real} | 
 |  193  | 
 |  194 do_test select7-7.7 { | 
 |  195   execsql { | 
 |  196     CREATE TABLE t5(a TEXT, b INT); | 
 |  197     INSERT INTO t5 VALUES(123, 456); | 
 |  198     SELECT typeof(a), a FROM t5 GROUP BY a HAVING a<b; | 
 |  199   } | 
 |  200 } {text 123} | 
 |  201  | 
|  159 finish_test |  202 finish_test | 
| OLD | NEW |