1# 2016 July 29 2# 3# The author disclaims copyright to this source code. In place of 4# a legal notice, here is a blessing: 5# 6# May you do good and not evil. 7# May you find forgiveness for yourself and forgive others. 8# May you share freely, never taking more than you give. 9# 10#*********************************************************************** 11# This file implements regression tests for SQLite library. The 12# focus of this file is syntax errors involving row-value constructors 13# and sub-selects that return multiple arguments. 14# 15 16set testdir [file dirname $argv0] 17source $testdir/tester.tcl 18set ::testprefix rowvalue4 19 20do_execsql_test 0 { 21 CREATE TABLE t1(a, b, c); 22 CREATE INDEX t1bac ON t1(b, a, c); 23} 24 25foreach {tn e} { 26 1 "(1, 2, 3)" 27 2 "1 + (1, 2)" 28 3 "(1,2,3) == (1, 2)" 29} { 30 do_catchsql_test 1.$tn "SELECT $e" {1 {invalid use of row value}} 31} 32 33foreach {tn s error} { 34 1 "SELECT * FROM t1 WHERE a = (1, 2)" {invalid use of row value} 35 2 "SELECT * FROM t1 WHERE b = (1, 2)" {invalid use of row value} 36 3 "SELECT * FROM t1 WHERE NOT (b = (1, 2))" {invalid use of row value} 37 4 "SELECT * FROM t1 LIMIT (1, 2)" {invalid use of row value} 38 5 "SELECT (a, b) IN (SELECT * FROM t1) FROM t1" 39 {sub-select returns 3 columns - expected 2} 40 41 6 "SELECT * FROM t1 WHERE (a, b) IN (SELECT * FROM t1)" 42 {sub-select returns 3 columns - expected 2} 43} { 44 do_catchsql_test 2.$tn "$s" [list 1 $error] 45} 46 47finish_test 48 49