diff options
author | Patrick Crews <patrick.crews@sun.com> | 2008-09-30 15:32:35 -0400 |
---|---|---|
committer | Patrick Crews <patrick.crews@sun.com> | 2008-09-30 15:32:35 -0400 |
commit | 446fd5044c5fa3cdab7d9d057d1a983430662a51 (patch) | |
tree | a8fc373533c7115c1892a90aaa1d69c37f11e62a /mysql-test/t/distinct.test | |
parent | 0d24398697469deebd2b58cb16e355c09febbebc (diff) | |
parent | 8c33da076ef884a5a0c92b5e661df43ad5991631 (diff) | |
download | mariadb-git-446fd5044c5fa3cdab7d9d057d1a983430662a51.tar.gz |
Merge 5.0 -> 5.1
Diffstat (limited to 'mysql-test/t/distinct.test')
-rw-r--r-- | mysql-test/t/distinct.test | 128 |
1 files changed, 63 insertions, 65 deletions
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 559dde44b81..a569b765872 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -438,72 +438,70 @@ EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a; DROP TABLE t1; -# The test case for bug#20836 should be re-enabled when bug#16861 is resolved -# The results for the test should be the same as in 4.1. -# + #Bug #20836: Selecting into variables results in wrong results being returned -# -#--disable_warnings -#DROP TABLE IF EXISTS t1; -#--enable_warnings -# -#CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20) -#default NULL); -# -#INSERT INTO t1 VALUES (1,1,'ORANGE'); -#INSERT INTO t1 VALUES (2,2,'APPLE'); -#INSERT INTO t1 VALUES (3,2,'APPLE'); -#INSERT INTO t1 VALUES (4,3,'PEAR'); -# -#SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = -#'APPLE'; -#SELECT @v1, @v2; -# -#SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id, -#fruit_name HAVING fruit_name = 'APPLE'; -#SELECT @v3, @v4; -# -#SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE -#fruit_name = 'APPLE'; -#SELECT @v5, @v6, @v7, @v8; -# -#SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1 -#WHERE fruit_name = 'APPLE'; -#SELECT @v5, @v6, @v7, @v8, @v9, @v10; -# -#SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO -#@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE'; -#SELECT @v11, @v12, @v13, @v14; -# -#SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE'; -#SELECT @v15, @v16; -# -#SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name = -#'APPLE'; -#SELECT @v17, @v18; -# -#--disable_warnings -#DROP TABLE IF EXISTS t2; -#--enable_warnings -# -#CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) -#default NULL); -# -#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE -#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; -#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp -# -#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE -#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; -#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; -#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp -# -#SELECT @v19, @v20; -#SELECT * FROM t2; -# -#DROP TABLE t1; -#DROP TABLE t2; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); + +INSERT INTO t1 VALUES (1,1,'ORANGE'); +INSERT INTO t1 VALUES (2,2,'APPLE'); +INSERT INTO t1 VALUES (3,2,'APPLE'); +INSERT INTO t1 VALUES (4,3,'PEAR'); + +SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v1, @v2; + +SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id, +fruit_name HAVING fruit_name = 'APPLE'; +SELECT @v3, @v4; + +SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE +fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8; + +SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1 +WHERE fruit_name = 'APPLE'; +SELECT @v5, @v6, @v7, @v8, @v9, @v10; + +SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO +@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v11, @v12, @v13, @v14; + +SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE'; +SELECT @v15, @v16; + +SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name = +'APPLE'; +SELECT @v17, @v18; + +--disable_warnings +DROP TABLE IF EXISTS t2; +--enable_warnings + +CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20) +default NULL); + +SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE +'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2; +--remove_file $MYSQL_TEST_DIR/var/tmp/data1.tmp + +SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE +'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE'; +LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2; +--remove_file $MYSQL_TEST_DIR/var/tmp/data2.tmp + +SELECT @v19, @v20; +SELECT * FROM t2; + +DROP TABLE t1; +DROP TABLE t2; # # Bug #15881: cast problems |