Commit 1f81aa5f authored by Michael Widenius's avatar Michael Widenius

Added tests to cover more server code

Author: Stewart Smith

mysql-test/r/alter_table.result:
  Testing of ALTER TABLE .. DROP DEFAULT
mysql-test/r/limit.result:
  Testing of LIMIT ... OFFSET
mysql-test/t/alter_table.test:
  Testing of ALTER TABLE .. DROP DEFAULT
mysql-test/t/limit.test:
  Testing of LIMIT ... OFFSET
parent 774ceff0
...@@ -1268,4 +1268,21 @@ a b ...@@ -1268,4 +1268,21 @@ a b
4 b 4 b
5 a 5 a
DROP TABLE t1; DROP TABLE t1;
SET @save_sql_mode=@@sql_mode;
SET sql_mode=strict_all_tables;
CREATE TABLE t1 (a int NOT NULL default 42);
INSERT INTO t1 values ();
SELECT * FROM t1;
a
42
ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
INSERT INTO t1 values ();
ERROR HY000: Field 'a' doesn't have a default value
INSERT INTO t1 (a) VALUES (11);
SELECT * FROM t1 ORDER BY a;
a
11
42
DROP TABLE t1;
SET @@sql_mode=@save_sql_mode;
End of 5.1 tests End of 5.1 tests
...@@ -113,4 +113,36 @@ ERROR HY000: Incorrect arguments to EXECUTE ...@@ -113,4 +113,36 @@ ERROR HY000: Incorrect arguments to EXECUTE
End of 5.0 tests End of 5.0 tests
select 1 as a limit 4294967296,10; select 1 as a limit 4294967296,10;
a a
CREATE TABLE t1 (a int PRIMARY KEY auto_increment);
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
SELECT a FROM t1 ORDER BY a LIMIT 10 OFFSET 1;
a
2
3
4
5
6
7
8
9
10
11
SELECT a FROM t1 ORDER BY a LIMIT 10 OFFSET 10;
a
11
12
13
14
15
16
17
18
19
20
SELECT a FROM t1 ORDER BY a LIMIT 2 OFFSET 14;
a
15
16
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -1000,4 +1000,22 @@ ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL; ...@@ -1000,4 +1000,22 @@ ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Test for ALTER column DROP DEFAULT
#
SET @save_sql_mode=@@sql_mode;
SET sql_mode=strict_all_tables;
CREATE TABLE t1 (a int NOT NULL default 42);
INSERT INTO t1 values ();
SELECT * FROM t1;
ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
--error 1364
INSERT INTO t1 values ();
INSERT INTO t1 (a) VALUES (11);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
SET @@sql_mode=@save_sql_mode;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -102,4 +102,16 @@ execute s using @a, @a; ...@@ -102,4 +102,16 @@ execute s using @a, @a;
select 1 as a limit 4294967296,10; select 1 as a limit 4294967296,10;
#
# Test for LIMIT X OFFSET Y
#
CREATE TABLE t1 (a int PRIMARY KEY auto_increment);
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
SELECT a FROM t1 ORDER BY a LIMIT 10 OFFSET 1;
SELECT a FROM t1 ORDER BY a LIMIT 10 OFFSET 10;
SELECT a FROM t1 ORDER BY a LIMIT 2 OFFSET 14;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment