Skip to content

Commit e1f807a

Browse files
author
konstantin@mysql.com
committed
Merge mysql.com:/home/kostja/mysql/mysql-5.0-root
into mysql.com:/home/kostja/mysql/mysql-5.1-merge
2 parents 51fda10 + 16edce1 commit e1f807a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+651
-163
lines changed

extra/perror.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,24 @@ int main(int argc,char *argv[])
239239
if ((ndb_error_string(code, ndb_string, sizeof(ndb_string)) < 0) &&
240240
(ndbd_exit_string(code, ndb_string, sizeof(ndb_string)) < 0))
241241
{
242-
msg= 0;
242+
msg= 0;
243243
}
244244
else
245245
msg= ndb_string;
246+
if (msg)
247+
{
248+
if (verbose)
249+
printf("NDB error code %3d: %s\n",code,msg);
250+
else
251+
puts(msg);
252+
}
253+
else
254+
{
255+
fprintf(stderr,"Illegal ndb error code: %d\n",code);
256+
error= 1;
257+
}
258+
found= 1;
259+
msg= 0;
246260
}
247261
else
248262
#endif

mysql-test/r/fulltext.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,3 +449,14 @@ t1 CREATE TABLE `t1` (
449449
FULLTEXT KEY `a` (`a`)
450450
) ENGINE=MyISAM DEFAULT CHARSET=latin1
451451
DROP TABLE t1;
452+
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
453+
INSERT INTO t1 VALUES('test'),('test1'),('test');
454+
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
455+
EXECUTE stmt;
456+
a MATCH(a) AGAINST('test1 test')
457+
test1 0.68526661396027
458+
EXECUTE stmt;
459+
a MATCH(a) AGAINST('test1 test')
460+
test1 0.68526661396027
461+
DEALLOCATE PREPARE stmt;
462+
DROP TABLE t1;

mysql-test/r/func_math.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,18 @@ NULL
203203
Warnings:
204204
Error 1365 Division by 0
205205
set sql_mode='';
206+
select round(111,-10);
207+
round(111,-10)
208+
0
209+
select round(-5000111000111000155,-1);
210+
round(-5000111000111000155,-1)
211+
-5000111000111000160
212+
select round(15000111000111000155,-1);
213+
round(15000111000111000155,-1)
214+
15000111000111000160
215+
select truncate(-5000111000111000155,-1);
216+
truncate(-5000111000111000155,-1)
217+
-5000111000111000150
218+
select truncate(15000111000111000155,-1);
219+
truncate(15000111000111000155,-1)
220+
15000111000111000150

mysql-test/r/group_min_max.result

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,3 +2043,30 @@ c1 c2
20432043
30 8
20442044
30 9
20452045
drop table t1;
2046+
CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
2047+
INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
2048+
OPTIMIZE TABLE t1;
2049+
Table Op Msg_type Msg_text
2050+
test.t1 optimize status OK
2051+
SELECT a FROM t1 WHERE a='AA' GROUP BY a;
2052+
a
2053+
AA
2054+
SELECT a FROM t1 WHERE a='BB' GROUP BY a;
2055+
a
2056+
BB
2057+
EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
2058+
id select_type table type possible_keys key key_len ref rows Extra
2059+
1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 3 Using where; Using index
2060+
EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
2061+
id select_type table type possible_keys key key_len ref rows Extra
2062+
1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 1 Using where; Using index
2063+
SELECT DISTINCT a FROM t1 WHERE a='BB';
2064+
a
2065+
BB
2066+
SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
2067+
a
2068+
BB
2069+
SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
2070+
a
2071+
BB
2072+
DROP TABLE t1;

mysql-test/r/having.result

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,23 @@ SUM(a)
141141
6
142142
4
143143
DROP TABLE t1;
144+
CREATE TABLE t1 (a int);
145+
INSERT INTO t1 VALUES (1), (2), (1), (3), (2), (1);
146+
SELECT a FROM t1 GROUP BY a HAVING a > 1;
147+
a
148+
2
149+
3
150+
SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
151+
a
152+
SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
153+
x a
154+
EXPLAIN SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
155+
id select_type table type possible_keys key key_len ref rows Extra
156+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
157+
EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
158+
id select_type table type possible_keys key key_len ref rows Extra
159+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
160+
DROP table t1;
144161
create table t1 (col1 int, col2 varchar(5), col_t1 int);
145162
create table t2 (col1 int, col2 varchar(5), col_t2 int);
146163
create table t3 (col1 int, col2 varchar(5), col_t3 int);

mysql-test/r/ndb_blob.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,13 @@ delete from t1;
428428
select * from t1;
429429
a b
430430
commit;
431+
replace t1 set a=2, b='y';
432+
select * from t1;
433+
a b
434+
2 y
435+
delete from t1;
436+
select * from t1;
437+
a b
431438
drop table t1;
432439
set autocommit=0;
433440
create table t1 (

mysql-test/r/ndb_index_unique.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,3 +626,12 @@ select * from t1 where code = '12' and month = 4 and year = 2004 ;
626626
id month year code
627627
1 4 2004 12
628628
drop table t1;
629+
create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
630+
engine=ndb charset=utf8;
631+
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
632+
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
633+
ERROR 23000: Duplicate entry '2' for key 1
634+
select a, sha1(b) from t1;
635+
a sha1(b)
636+
1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d
637+
drop table t1;

mysql-test/r/sp-code.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Pos Instruction
172172
17 set v_col@8 NULL
173173
18 stmt 0 "select row,col into v_row,v_col from ..."
174174
19 stmt 0 "select dig into v_dig from sudoku_wor..."
175-
20 set_case_expr 0 v_dig@4
175+
20 set_case_expr (34) 0 v_dig@4
176176
21 jump_if_not 25(34) (case_expr@0 = 0)
177177
22 set v_dig@4 1
178178
23 stmt 4 "update sudoku_work set dig = 1 where ..."

mysql-test/r/sp-destruct.result

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ drop trigger t1_ai;
7272
create trigger t1_ai after insert on t1 for each row call bug14233_3();
7373
insert into t1 values (0);
7474
ERROR HY000: Failed to load routine test.bug14233_3. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)
75-
delete from mysql.proc where name like 'bug14233%';
7675
drop trigger t1_ai;
7776
drop table t1;
77+
drop function bug14233_1;
78+
drop function bug14233_2;
79+
drop procedure bug14233_3;
80+
show procedure status;
81+
Db Name Type Definer Modified Created Security_type Comment
82+
show function status;
83+
Db Name Type Definer Modified Created Security_type Comment

mysql-test/r/sp.result

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4011,8 +4011,6 @@ NULL 1
40114011
call bug14643_2()|
40124012
Handler
40134013
boo
4014-
2
4015-
2
40164014
Handler
40174015
boo
40184016
drop procedure bug14643_1|
@@ -4360,6 +4358,11 @@ Handler
43604358
error
43614359
End
43624360
done
4361+
call bug14498_4()|
4362+
Handler
4363+
error
4364+
End
4365+
done
43634366
call bug14498_5()|
43644367
Handler
43654368
error

mysql-test/r/view.result

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,3 +2495,37 @@ id select_type table type possible_keys key key_len ref rows Extra
24952495
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
24962496
DROP VIEW v1;
24972497
DROP TABLE t1;
2498+
CREATE TABLE t1 (x varchar(10));
2499+
INSERT INTO t1 VALUES (null), ('foo'), ('bar'), (null);
2500+
CREATE VIEW v1 AS SELECT * FROM t1;
2501+
SELECT IF(x IS NULL, 'blank', 'not blank') FROM v1 GROUP BY x;
2502+
IF(x IS NULL, 'blank', 'not blank')
2503+
blank
2504+
not blank
2505+
not blank
2506+
SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM t1 GROUP BY x;
2507+
x
2508+
blank
2509+
not blank
2510+
not blank
2511+
Warnings:
2512+
Warning 1052 Column 'x' in group statement is ambiguous
2513+
SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1;
2514+
x
2515+
blank
2516+
not blank
2517+
not blank
2518+
blank
2519+
SELECT IF(x IS NULL, 'blank', 'not blank') AS y FROM v1 GROUP BY y;
2520+
y
2521+
blank
2522+
not blank
2523+
SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
2524+
x
2525+
blank
2526+
not blank
2527+
not blank
2528+
Warnings:
2529+
Warning 1052 Column 'x' in group statement is ambiguous
2530+
DROP VIEW v1;
2531+
DROP TABLE t1;

mysql-test/t/disabled.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ rpl_ndb_auto_inc : MySQL Bugs:17086
3333
rpl_ndb_relay_space : Bug 16993
3434
ndb_binlog_ddl_multi : Bug #17038
3535
rpl_ndb_log : MySQL Bugs: #17158
36+
subselect : Bug#15706
37+
ndb_load : Bug #17233

mysql-test/t/fulltext.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,4 +371,16 @@ CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a));
371371
SHOW CREATE TABLE t1;
372372
DROP TABLE t1;
373373

374+
#
375+
# BUG#14496: Crash or strange results with prepared statement,
376+
# MATCH and FULLTEXT
377+
#
378+
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
379+
INSERT INTO t1 VALUES('test'),('test1'),('test');
380+
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
381+
EXECUTE stmt;
382+
EXECUTE stmt;
383+
DEALLOCATE PREPARE stmt;
384+
DROP TABLE t1;
385+
374386
# End of 4.1 tests

mysql-test/t/func_math.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,17 @@ select log(2,-1);
141141
select log(-2,1);
142142
set sql_mode='';
143143

144+
#
145+
# Bug #8461 truncate() and round() return false results 2nd argument negative.
146+
#
147+
# round(a,-b) log_10(b) > a
148+
select round(111,-10);
149+
# round on bigint
150+
select round(-5000111000111000155,-1);
151+
# round on unsigned bigint
152+
select round(15000111000111000155,-1);
153+
# truncate on bigint
154+
select truncate(-5000111000111000155,-1);
155+
# truncate on unsigned bigint
156+
select truncate(15000111000111000155,-1);
157+

mysql-test/t/group_min_max.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,3 +715,24 @@ select distinct c1, c2 from t1 order by c2;
715715
select c1,min(c2) as c2 from t1 group by c1 order by c2;
716716
select c1,c2 from t1 group by c1,c2 order by c2;
717717
drop table t1;
718+
719+
#
720+
# Bug #16203: Analysis for possible min/max optimization erroneously
721+
# returns impossible range
722+
#
723+
724+
CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
725+
INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
726+
OPTIMIZE TABLE t1;
727+
728+
SELECT a FROM t1 WHERE a='AA' GROUP BY a;
729+
SELECT a FROM t1 WHERE a='BB' GROUP BY a;
730+
731+
EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
732+
EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
733+
734+
SELECT DISTINCT a FROM t1 WHERE a='BB';
735+
SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
736+
SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
737+
738+
DROP TABLE t1;

mysql-test/t/having.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,22 @@ SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a);
135135

136136
DROP TABLE t1;
137137

138+
#
139+
# Bug #14927: HAVING clause containing constant false conjunct
140+
#
141+
142+
CREATE TABLE t1 (a int);
143+
INSERT INTO t1 VALUES (1), (2), (1), (3), (2), (1);
144+
145+
SELECT a FROM t1 GROUP BY a HAVING a > 1;
146+
SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
147+
SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
148+
149+
EXPLAIN SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
150+
EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
151+
152+
DROP table t1;
153+
138154
# End of 4.1 tests
139155

140156
#

mysql-test/t/ndb_blob.test

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ select * from t1 order by a;
338338
drop table t1;
339339
drop database test2;
340340

341-
# -- bug-5252 tinytext crashes plus no-commit result --
341+
# -- bug-5252 tinytext crashes + no-commit result + replace --
342342

343343
set autocommit=0;
344344
create table t1 (
@@ -352,6 +352,10 @@ select * from t1;
352352
delete from t1;
353353
select * from t1;
354354
commit;
355+
replace t1 set a=2, b='y';
356+
select * from t1;
357+
delete from t1;
358+
select * from t1;
355359
drop table t1;
356360

357361
# -- bug-5013 insert empty string to text --

mysql-test/t/ndb_index_unique.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,18 @@ select * from t1 where code = '12' and month = 4 and year = 2004 ;
309309

310310
drop table t1;
311311

312+
# bug#15918 Unique Key Limit in NDB Engine
313+
314+
create table t1 (a int primary key, b varchar(1000) not null, unique key (b))
315+
engine=ndb charset=utf8;
316+
317+
insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200));
318+
--error 1062
319+
insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200));
320+
select a, sha1(b) from t1;
321+
322+
# perl -e 'print pack("H2000","e288ab6474"x200)' | sha1sum
323+
324+
drop table t1;
325+
312326
# End of 4.1 tests

mysql-test/t/sp-destruct.test

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ create trigger t1_ai after insert on t1 for each row call bug14233_3();
127127
insert into t1 values (0);
128128

129129
# Clean-up
130-
delete from mysql.proc where name like 'bug14233%';
131130
drop trigger t1_ai;
132131
drop table t1;
132+
133+
#
134+
# BUG#16303: erroneus stored procedures and functions should be droppable
135+
#
136+
drop function bug14233_1;
137+
drop function bug14233_2;
138+
drop procedure bug14233_3;
139+
# Assert: These should show nothing.
140+
show procedure status;
141+
show function status;

mysql-test/t/sp.test

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5125,10 +5125,7 @@ end|
51255125
call bug14498_1()|
51265126
call bug14498_2()|
51275127
call bug14498_3()|
5128-
# We couldn't call this before, due to a known bug (BUG#14643)
5129-
# QQ We still can't since the new set_case_expr instruction breaks
5130-
# the semantics of case; it won't crash, but will get the wrong result.
5131-
#call bug14498_4()|
5128+
call bug14498_4()|
51325129
call bug14498_5()|
51335130

51345131
drop procedure bug14498_1|

0 commit comments

Comments
 (0)