diff options
author | unknown <monty@mysql.com> | 2005-07-28 16:10:14 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-07-28 16:10:14 +0300 |
commit | 79f75d8fad96e7b1da588eb850a25f9e9697ac2e (patch) | |
tree | af22629d2c36ae4196e6f23584c4cecc393b874e /mysql-test/t | |
parent | 520ebda4f22a4471ddedddf1a63561787f31c409 (diff) | |
download | mariadb-git-79f75d8fad96e7b1da588eb850a25f9e9697ac2e.tar.gz |
Cleanups during review of new code
Ensure mysql_close() is called if mysql_set_character_set() fails
libmysql/libmysql.c:
Indentation cleanup
mysql-test/r/select.result:
Fix bad merge & align code with 4.1
mysql-test/r/type_newdecimal.result:
Added test of extreme case
mysql-test/t/select.test:
Fix bad merge & align code with 4.1
mysql-test/t/type_newdecimal.test:
Added test of extreme case
mysys/charset.c:
Removed not used variable
mysys/default.c:
Simplify code
sql-common/client.c:
Ensure mysql_close() is called if mysql_set_character_set() fails
sql/log.cc:
strmov(strmov()) -> strxmov()
sql/sp.cc:
Indentation fixes
sql/sql_acl.cc:
Indentation fixes
sql/sql_base.cc:
Added commments
Moved variable to inner block
sql/sql_show.cc:
Simple optimization (removed loop variable)
sql/sql_trigger.cc:
strmov(strmov()) -> strxmov()
strings/decimal.c:
Indentation fixes
Diffstat (limited to 'mysql-test/t')
-rw-r--r-- | mysql-test/t/select.test | 206 | ||||
-rw-r--r-- | mysql-test/t/type_newdecimal.test | 4 |
2 files changed, 92 insertions, 118 deletions
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index ef26712af06..8004d308dfa 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2080,6 +2080,94 @@ select * from t3 left join t1 on t3.id = t1.uid, t2 where t2.ident in (0, t1.gid drop table t1,t2,t3; +# Test for BUG#11700 +CREATE TABLE t1 ( + acct_id int(11) NOT NULL default '0', + profile_id smallint(6) default NULL, + UNIQUE KEY t1$acct_id (acct_id), + KEY t1$profile_id (profile_id) +); +INSERT INTO t1 VALUES (132,17),(133,18); + +CREATE TABLE t2 ( + profile_id smallint(6) default NULL, + queue_id int(11) default NULL, + seq int(11) default NULL, + KEY t2$queue_id (queue_id) +); +INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1); + +CREATE TABLE t3 ( + id int(11) NOT NULL default '0', + qtype int(11) default NULL, + seq int(11) default NULL, + warn_lvl int(11) default NULL, + crit_lvl int(11) default NULL, + rr1 tinyint(4) NOT NULL default '0', + rr2 int(11) default NULL, + default_queue tinyint(4) NOT NULL default '0', + KEY t3$qtype (qtype), + KEY t3$id (id) +); + +INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0), + (36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0); + +SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q +WHERE + (pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND + (pq.queue_id = q.id) AND (q.rr1 <> 1); + +drop table t1,t2,t3; + +# +# Bug #11482 Wrongly applied optimization was erroneously rejecting valid +# rows +create table t1 (f1 int); +insert into t1 values (1),(NULL); +create table t2 (f2 int, f3 int, f4 int); +create index idx1 on t2 (f4); +insert into t2 values (1,2,3),(2,4,6); +select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3) +from t2 C where A.f4 = C.f4) or A.f3 IS NULL; +drop table t1,t2; + +# +# Bug #11521 Negative integer keys incorrectly substituted for 0 during +# range analysis. + +create table t2 (a tinyint unsigned); +create index t2i on t2(a); +insert into t2 values (0), (254), (255); +explain select * from t2 where a > -1; +select * from t2 where a > -1; +drop table t2; + +# +# Bug #11745: SELECT ... FROM DUAL with WHERE condition +# + +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 + SELECT 50, 3, 3 FROM DUAL + WHERE NOT EXISTS + (SELECT * FROM t1 WHERE a = 50 AND b = 3); +SELECT * FROM t1; +INSERT INTO t1 + SELECT 50, 3, 3 FROM DUAL + WHERE NOT EXISTS + (SELECT * FROM t1 WHERE a = 50 AND b = 3); +select found_rows(); +SELECT * FROM t1; +select count(*) from t1; +select found_rows(); +select count(*) from t1 limit 2,3; +select found_rows(); +select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3; +select found_rows(); + +DROP TABLE t1; + # # Test case for bug 7098: substitution of a constant for a string field # @@ -2154,15 +2242,6 @@ SELECT K2C4, K4N4, F2I4 FROM t1 (F2I4 = 2 AND K2C4 = 'WART' OR (F2I4 = 2 OR K4N4 = '0200')); SELECT K2C4, K4N4, F2I4 FROM t1 WHERE K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200'); - -select found_rows(); -select count(*) from t1; -select found_rows(); -select count(*) from t1 limit 2,3; -select found_rows(); -select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3; -select found_rows(); - DROP TABLE t1; # @@ -2180,36 +2259,6 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; DROP TABLE t1, t2; - -# -# Test case for bug 7098: substitution of a constant for a string field -# - -CREATE TABLE t1 ( city char(30) ); -INSERT INTO t1 VALUES ('London'); -INSERT INTO t1 VALUES ('Paris'); - -SELECT * FROM t1 WHERE city='London'; -SELECT * FROM t1 WHERE city='london'; -EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; -SELECT * FROM t1 WHERE city='London' AND city='london'; -EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; -SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; - -DROP TABLE t1; - -# -# Bug#7425 inconsistent sort order on unsigned columns result of substraction -# - -create table t1 (a int(11) unsigned, b int(11) unsigned); -insert into t1 values (1,0), (1,1), (1,2); -select a-b from t1 order by 1; -select a-b , (a-b < 0) from t1 order by 1; -select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0; -select cast((a - b) as unsigned) from t1 order by 1; -drop table t1; - # # Bug#8670 # @@ -2297,82 +2346,3 @@ DROP TABLE t1,t2; # select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0; -# Test for BUG#11700 -CREATE TABLE t1 ( - acct_id int(11) NOT NULL default '0', - profile_id smallint(6) default NULL, - UNIQUE KEY t1$acct_id (acct_id), - KEY t1$profile_id (profile_id) -); -INSERT INTO t1 VALUES (132,17),(133,18); - -CREATE TABLE t2 ( - profile_id smallint(6) default NULL, - queue_id int(11) default NULL, - seq int(11) default NULL, - KEY t2$queue_id (queue_id) -); -INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1); - -CREATE TABLE t3 ( - id int(11) NOT NULL default '0', - qtype int(11) default NULL, - seq int(11) default NULL, - warn_lvl int(11) default NULL, - crit_lvl int(11) default NULL, - rr1 tinyint(4) NOT NULL default '0', - rr2 int(11) default NULL, - default_queue tinyint(4) NOT NULL default '0', - KEY t3$qtype (qtype), - KEY t3$id (id) -); - -INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0), - (36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0); - -SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q -WHERE - (pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND - (pq.queue_id = q.id) AND (q.rr1 <> 1); - -drop table t1,t2,t3; - -# -# Bug #11482 Wrongly applied optimization was erroneously rejecting valid -# rows -create table t1 (f1 int); -insert into t1 values (1),(NULL); -create table t2 (f2 int, f3 int, f4 int); -create index idx1 on t2 (f4); -insert into t2 values (1,2,3),(2,4,6); -select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3) -from t2 C where A.f4 = C.f4) or A.f3 IS NULL; -drop table t1,t2; -# -# Bug #11521 Negative integer keys incorrectly substituted for 0 during -# range analysis. - -create table t2 (a tinyint unsigned); -create index t2i on t2(a); -insert into t2 values (0), (254), (255); -explain select * from t2 where a > -1; -select * from t2 where a > -1; -drop table t2; - -# -# Bug #11745: SELECT ... FROM DUAL with WHERE condition -# - -CREATE TABLE t1 (a int, b int, c int); -INSERT INTO t1 - SELECT 50, 3, 3 FROM DUAL - WHERE NOT EXISTS - (SELECT * FROM t1 WHERE a = 50 AND b = 3); -SELECT * FROM t1; -INSERT INTO t1 - SELECT 50, 3, 3 FROM DUAL - WHERE NOT EXISTS - (SELECT * FROM t1 WHERE a = 50 AND b = 3); -SELECT * FROM t1; - -DROP TABLE t1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index f295311fe4e..e2f247edcd3 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -986,6 +986,10 @@ create table t1 (sl decimal(0,30)); create table t1 (sl decimal(5, 5)); show create table t1; drop table t1; +# Test limits +create table t1 (sl decimal(65, 30)); +show create table t1; +drop table t1; # # Bug 11557 (DEFAULT values rounded improperly |