Skip to content

Commit a9a08b1

Browse files
author
Alexander Barkov
committed
MDEV-9371 select insert('a',2,1,'b') doesn't return expected 'a'
1 parent 3c5c04b commit a9a08b1

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

mysql-test/r/ctype_utf8.result

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is atest
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b
@@ -5092,9 +5092,10 @@ SET sql_mode=default;
50925092
SET NAMES utf8;
50935093
CREATE TABLE t1 (a INT);
50945094
INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
5095-
SELECT COUNT(*) FROM t1, t1 t2
5095+
SELECT COUNT(*) FROM t1, t1 t2
50965096
GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
5097-
ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key'
5097+
COUNT(*)
5098+
25
50985099
DROP TABLE t1;
50995100
#
51005101
# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters

mysql-test/r/ctype_utf8mb4.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is atest
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

mysql-test/r/ctype_utf8mb4_heap.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is atest
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

mysql-test/r/ctype_utf8mb4_innodb.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is atest
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

mysql-test/r/ctype_utf8mb4_myisam.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is atest
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

mysql-test/r/func_str.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('
203203
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
204204
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
205205
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
206-
this is atest
206+
this is test
207207
select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
208208
replace('aaaa','a','b') replace('aaaa','aa','b') replace('aaaa','a','bb') replace('aaaa','','b') replace('bbbb','a','c')
209209
bbbb bb bbbbbbbb aaaa bbbb
@@ -2335,7 +2335,7 @@ INSERT('abc', 3, 3, '1234')
23352335
ab1234
23362336
SELECT INSERT('abc', 4, 3, '1234');
23372337
INSERT('abc', 4, 3, '1234')
2338-
abc1234
2338+
abc
23392339
SELECT INSERT('abc', 5, 3, '1234');
23402340
INSERT('abc', 5, 3, '1234')
23412341
abc
@@ -2625,7 +2625,7 @@ CREATE TABLE t1 ( a TEXT );
26252625
SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug58165.txt';;
26262626
SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
26272627
insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' )
2628-
x
2628+
26292629
Warnings:
26302630
Warning 1292 Truncated incorrect INTEGER value: 'b'
26312631
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1;;

mysql-test/t/ctype_utf8.test

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,8 +1563,7 @@ SET NAMES utf8;
15631563
SET NAMES utf8;
15641564
CREATE TABLE t1 (a INT);
15651565
INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
1566-
--error ER_DUP_ENTRY
1567-
SELECT COUNT(*) FROM t1, t1 t2
1566+
SELECT COUNT(*) FROM t1, t1 t2
15681567
GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
15691568
DROP TABLE t1;
15701569

sql/item_strfunc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ String *Item_func_insert::val_str(String *str)
12121212
length= res->charpos((int) length, (uint32) start);
12131213

12141214
/* Re-testing with corrected params */
1215-
if (start > res->length())
1215+
if (start + 1 > res->length()) // remember, start = args[1].val_int() - 1
12161216
return res; /* purecov: inspected */ // Wrong param; skip insert
12171217
if (length > res->length() - start)
12181218
length= res->length() - start;

0 commit comments

Comments
 (0)