From 06ce41368035952845f5d1a98aa36996dd7d5b91 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 3 Sep 2010 10:58:47 +0000 Subject: [PATCH] Add a few more subquery tests to e_expr.test. FossilOrigin-Name: 189cba0072dd0b90e064f889457921aeaeefda01 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/e_expr.test | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 2a62b49a3f..8c38845191 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reduce\sthe\samount\sof\smemory\staken\sup\sby\sWAL\smmaped\sregions\sunder\sWindows. -D 2010-09-03T04:29:31 +C Add\sa\sfew\smore\ssubquery\stests\sto\se_expr.test. +D 2010-09-03T10:58:47 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -346,7 +346,7 @@ F test/descidx2.test 9f1a0c83fd57f8667c82310ca21b30a350888b5d F test/descidx3.test fe720e8b37d59f4cef808b0bf4e1b391c2e56b6f F test/diskfull.test 0cede7ef9d8f415d9d3944005c76be7589bb5ebb F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376 -F test/e_expr.test 1aef3ba4a140487cf5b452f04e261f26e99f9fe5 +F test/e_expr.test 164e87c1d7b40ceb47c57c3bffa384c81d009aa7 F test/e_fkey.test 6721a741c6499b3ab7e5385923233343c8f1ad05 F test/e_fts3.test 75bb0aee26384ef586165e21018a17f7cd843469 F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea @@ -853,7 +853,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P f483be441323e1cb91516964cd6ab0edecad4366 -R fea23b14c42fedda7d16ff1cb4b9cee7 -U shaneh -Z 0fd3f5ddcf6cc38ff6e323baec639592 +P f213e133f6e69b0edd73d96142014bdcab9dfe41 +R 4840eab4671662ef903de303cfd3b278 +U dan +Z e60132511cfbf6157149a68a152e2582 diff --git a/manifest.uuid b/manifest.uuid index 07db26c6be..a9b205861e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f213e133f6e69b0edd73d96142014bdcab9dfe41 \ No newline at end of file +189cba0072dd0b90e064f889457921aeaeefda01 \ No newline at end of file diff --git a/test/e_expr.test b/test/e_expr.test index 74024cd9bd..453e84a192 100644 --- a/test/e_expr.test +++ b/test/e_expr.test @@ -1768,6 +1768,9 @@ do_expr_test e_expr-35.1.6 { # EVIDENCE-OF: R-46899-53765 A SELECT used as a scalar quantity must # return a result set with a single column. # +# The following block tests that errors are returned in a bunch of cases +# where a subquery returns more than one column. +# set M {only a single result allowed for a SELECT that is part of an expression} foreach {tn sql} { 1 { SELECT (SELECT * FROM t2 UNION SELECT a+1, b+1 FROM t2) } @@ -1780,5 +1783,44 @@ foreach {tn sql} { do_catchsql_test e_expr-35.2.$tn $sql [list 1 $M] } +# EVIDENCE-OF: R-35764-28041 The result of the expression is the value +# of the only column in the first row returned by the SELECT statement. +# +# EVIDENCE-OF: R-41898-06686 If the SELECT yields more than one result +# row, all rows after the first are ignored. +# +do_execsql_test e_expr-36.3.1 { + CREATE TABLE t4(x, y); + INSERT INTO t4 VALUES(1, 'one'); + INSERT INTO t4 VALUES(2, 'two'); + INSERT INTO t4 VALUES(3, 'three'); +} {} + +foreach {tn expr restype resval} { + 2 { ( SELECT x FROM t4 ORDER BY x ) } integer 1 + 3 { ( SELECT x FROM t4 ORDER BY y ) } integer 1 + 4 { ( SELECT x FROM t4 ORDER BY x DESC ) } integer 3 + 5 { ( SELECT x FROM t4 ORDER BY y DESC ) } integer 2 + 6 { ( SELECT y FROM t4 ORDER BY y DESC ) } text two + + 7 { ( SELECT sum(x) FROM t4 ) } integer 6 + 8 { ( SELECT group_concat(y,'') FROM t4 ) } text onetwothree + 9 { ( SELECT max(x) FROM t4 WHERE y LIKE '___') } integer 2 + +} { + do_expr_test e_expr-36.3.$tn $expr $restype $resval +} + +# EVIDENCE-OF: R-25492-41572 If the SELECT yields no rows, then the +# value of the expression is NULL. +# +foreach {tn expr} { + 1 { ( SELECT x FROM t4 WHERE x>3 ORDER BY x ) } + 2 { ( SELECT x FROM t4 WHERE y<'one' ORDER BY y ) } +} { + do_expr_test e_expr-36.4.$tn $expr null {} +} + + finish_test