Bug #107997 Help command bug
Submitted: 27 Jul 2022 7:05 Modified: 27 Jul 2022 7:50
Reporter: Quan Gan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.29, 5.7.39, 8.0.30 OS:CentOS
Assigned to: CPU Architecture:x86
Tags: Help, help_category, MBR

[27 Jul 2022 7:05] Quan Gan
Description:
When I execute "help MBR" via mysql-client command line, the output below confuses me.
***** my shell *****

mysql> help MBR;
Name: 'MBR'
Description:
MBR DEFINITIONExamples:
N

***** end *****

The reason for this is that in the com_server_help (in client/mysql.cc) function, no distinction is made between the following two MYSQL_RES case when there is only one row in MYSQL_RES:
case1:
---------------------------------
   name |  description | example
---------------------------------
case2:
-----------------------------------------
 source_category |  name | is_it_category
-----------------------------------------

When I excuting "help MBR", the MYSQL_RES is just like case2, But the client outputs it in the format of case2.

How to repeat:
Just execute "help MBR" via mysql-client command line to repeat it.
In addition, You can also repeat the bug by the following sql statement.

mysql> INSERT INTO mysql.help_category (help_category_id,name,parent_category_id,url) VALUES (12345,'category1',0,'');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO mysql.help_topic (help_topic_id,help_category_id,name,description,example,url) VALUES (11111,12345,'topic1','\n','','');
Query OK, 1 row affected (0.01 sec)

mysql> help category1;

Suggested fix:
Modify the com_server_help function to distincte case1 and case2, or distincte it in mysqld_help(in sql/sql_help.cc) function
[27 Jul 2022 7:49] MySQL Verification Team
Hello Quan Gan,

Thank you for the report and feedback.

regards,
Umesh