summaryrefslogtreecommitdiff
path: root/mysql-test/t/mysqltest.test
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.blaudden>2007-05-18 12:56:52 +0200
committerunknown <msvensson@pilot.blaudden>2007-05-18 12:56:52 +0200
commitf35dd614973ecb2f92a2411b6dac319278fe2ec3 (patch)
treef9ed853f67dcda3879c163682943f3ed9d8fe2db /mysql-test/t/mysqltest.test
parentbcae429e91860551a6acbcbd5bc6811b3c5a7372 (diff)
parent421d8ca9728ff882780599ce36cfa20936c7863e (diff)
downloadmariadb-git-f35dd614973ecb2f92a2411b6dac319278fe2ec3.tar.gz
Merge pilot.blaudden:/home/msvensson/mysql/mysql-4.1-maint
into pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint client/mysqltest.c: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/t/mysqltest.test: SCCS merged
Diffstat (limited to 'mysql-test/t/mysqltest.test')
-rw-r--r--mysql-test/t/mysqltest.test123
1 files changed, 115 insertions, 8 deletions
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 328206626df..057432d37fd 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1740,23 +1740,130 @@ EOF
--exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
-# test for query_sorted
+# test for sorted_result
# ----------------------------------------------------------------------------
create table t1( a int, b char(255), c timestamp);
insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 2", '2007-04-05');
insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 3", '2007-04-05');
select * from t1;
-query_sorted select * from t1;
+--sorted_result
+select * from t1;
+# Should not be sorted
+select * from t1;
disable_result_log;
-query_sorted select * from t1;
+sorted_result;
+select * from t1;
enable_result_log;
-query_sorted select '';
-query_sorted select "h";
-query_sorted select "he";
-query_sorted select "hep";
-query_sorted select "hepp";
+--sorted_result
+select '';
+sorted_result;
+select "h";
+--sorted_result
+select "he";
+--sorted_result
+select "hep";
+--sorted_result
+select "hepp";
+
+drop table t1;
+# 1. Assignment of result set sorting
+sorted_result;
+ SELECT 2 as "my_col"
+UNION
+SELECT 1;
+#
+--sorted_result
+SELECT 2 as "my_col" UNION SELECT 1;
+--sorted_result
+SELECT 2 as "my_col"
+UNION
+SELECT 1;
+
+# 2. Ensure that the table header will be not sorted into the result
+--sorted_result
+SELECT '2' as "3"
+UNION
+SELECT '1';
+
+# 3. Ensure that an empty result set does not cause problems
+CREATE TABLE t1( a CHAR);
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# 4. Ensure that NULL values within the result set do not cause problems
+SELECT NULL as "my_col1",2 AS "my_col2"
+UNION
+SELECT NULL,1;
+--sorted_result
+SELECT NULL as "my_col1",2 AS "my_col2"
+UNION
+SELECT NULL,1;
+#
+SELECT 2 as "my_col1",NULL AS "my_col2"
+UNION
+SELECT 1,NULL;
+--sorted_result
+SELECT 2 as "my_col1",NULL AS "my_col2"
+UNION
+SELECT 1,NULL;
+
+# 5. "sorted_result" changes nothing when applied to a non query statement.
+sorted_result;
+ SET @a = 17;
+#
+# 6. Show that "sorted_result;" before the "SET @a = 17;" above does not affect
+# the now following query.
+SELECT 2 as "my_col"
+UNION
+SELECT 1;
+
+# 7. Ensure that "sorted_result" in combination with $variables works
+let $my_stmt=SELECT 2 as "my_col"
+UNION
+SELECT 1;
+--sorted_result
+eval $my_stmt;
+
+# 8. Ensure that "sorted_result " does not change the semantics of
+# "--error ...." or the protocol output after such an expected failure
+--sorted_result
+--error 1146
+SELECT '2' as "my_col1",2 as "my_col2"
+UNION
+SELECT '1',1 from t2;
+
+# 9. Ensure that several result formatting options including "sorted_result"
+# - have all an effect
+# - "--sorted_result" does not need to be direct before the statement
+# - Row sorting is applied after modification of the column content
+--sorted_result
+--replace_column 1 #
+SELECT '1' as "my_col1",2 as "my_col2"
+UNION
+SELECT '2',1;
+
+# 10. Ensure that at least 1024 rows within a result set do not cause problems
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 SET f1 = 1024;
+INSERT INTO t1 SELECT f1 - 1 FROM t1;
+INSERT INTO t1 SELECT f1 - 2 FROM t1;
+INSERT INTO t1 SELECT f1 - 4 FROM t1;
+INSERT INTO t1 SELECT f1 - 8 FROM t1;
+INSERT INTO t1 SELECT f1 - 16 FROM t1;
+INSERT INTO t1 SELECT f1 - 32 FROM t1;
+INSERT INTO t1 SELECT f1 - 64 FROM t1;
+INSERT INTO t1 SELECT f1 - 128 FROM t1;
+INSERT INTO t1 SELECT f1 - 256 FROM t1;
+INSERT INTO t1 SELECT f1 - 512 FROM t1;
+--disable_result_log
+--sorted_result
+SELECT * FROM t1;
+--enable_result_log
+DROP TABLE t1;
# ----------------------------------------------------------------------------
# Some coverage tests
# ----------------------------------------------------------------------------