Bug #107634 `information_schema.routines.routine_definition` truncated on null character
Submitted: 22 Jun 2022 14:22 Modified: 23 Jun 2022 10:26
Reporter: Liam Meck Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Information schema Severity:S3 (Non-critical)
Version:8.0.27, 8.0.29 OS:Any
Assigned to: CPU Architecture:Any

[22 Jun 2022 14:22] Liam Meck
Description:
If a stored procedure contains a null character ('\0') its definition value will be truncated at this character.

How to repeat:
```
create procedure foo()

begin

select 'a', '\0', 'b';

end

select routine_definition from information_schema.routines where specific_name = 'foo';
```

output:
```
begin

select 'a', '
```
[23 Jun 2022 10:26] MySQL Verification Team
Hello Liam Meck,

Thank you for the report and test case.

regards,
Umesh
[23 Jun 2022 10:27] MySQL Verification Team
-- 8.0.29
 bin/mysql -uroot -S /tmp/mysql.sock
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.29 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

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> create database test;
Query OK, 1 row affected (0.01 sec)

mysql> use test
Database changed
mysql> delimiter //
mysql> create procedure foo()
    ->
    -> begin
    ->
    -> select 'a', '\0', 'b';
    ->
    -> end//
Query OK, 0 rows affected (0.01 sec)

mysql> delimiter ;
mysql>
mysql> select routine_definition from information_schema.routines where specific_name = 'foo';
+----------------------+
| ROUTINE_DEFINITION   |
+----------------------+
| begin

select 'a', ' |
+----------------------+
1 row in set (0.00 sec)