| Bug #79507 | String function insert is not working as doc says | ||
|---|---|---|---|
| Submitted: | 3 Dec 2015 12:55 | Modified: | 28 Nov 2019 22:34 |
| Reporter: | Su Dylan | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.6.22, 5.5.48 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[3 Dec 2015 13:59]
MySQL Verification Team
Hello Su Dylan, Thank you for the report and test case. This issue is repeatable only on 5.5 latest build and latest 5.6/5.7 builds are not affected. Thanks, Umesh
[3 Dec 2015 13:59]
MySQL Verification Team
// 5.6.29 - not affected
[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.6.29: bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.29-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select insert('abc',4,3,'xyz');
+-------------------------+
| insert('abc',4,3,'xyz') |
+-------------------------+
| abc |
+-------------------------+
1 row in set (0.00 sec)
mysql>
// 5.7.11 - not affected
[root@cluster-repo ~]# mysql -uroot -p test
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.7.9 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
root@localhost:test>select insert('abc',4,3,'xyz');
+-------------------------+
| insert('abc',4,3,'xyz') |
+-------------------------+
| abc |
+-------------------------+
1 row in set (0.00 sec)
// 5.5.48 - affected
[umshastr@hod03]/export/umesh/server/binaries/mysql-5.5.48: bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.48 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select insert('abc',4,3,'xyz');
+-------------------------+
| insert('abc',4,3,'xyz') |
+-------------------------+
| abcxyz |
+-------------------------+
1 row in set (0.00 sec)
mysql>
[3 Dec 2015 14:02]
MySQL Verification Team
// Typo in earlier 5.7 results, it was for 5.7.9
// 5.7.11
[umshastr@hod03]/export/umesh/server/binaries/mysql-advanced-5.7.11: bin/mysql -uroot -S /tmp/mysql_ushastry.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.11-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select insert('abc',4,3,'xyz');
+-------------------------+
| insert('abc',4,3,'xyz') |
+-------------------------+
| abc |
+-------------------------+
1 row in set (0.00 sec)
[28 Nov 2019 22:34]
Roy Lyseng
Posted by developer: Fixed/not reproducible in 5.6.29

Description: Output: ======= mysql> select insert('abc',4,3,'xyz'); +-------------------------+ | insert('abc',4,3,'xyz') | +-------------------------+ | abcxyz | +-------------------------+ 1 row in set (0.00 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.6.22 | +-----------+ 1 row in set (0.00 sec) Problem: ======== According to the documentation, it is expected to return 'abc'. Quote: Returns the original string if pos is not within the length of the string. http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_insert How to repeat: select insert('abc',4,3,'xyz'); Suggested fix: "abc" is returned.