Bug #99265 replace mysql_list_fields from client tools
Submitted: 15 Apr 2020 12:06 Modified: 15 Apr 2020 14:12
Reporter: Marcelo Altmann (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[15 Apr 2020 12:06] Marcelo Altmann
Description:
mysql_list_fields has been deprecated since 5.7.11 . - https://dev.mysql.com/doc/refman/5.7/en/mysql-list-fields.html
mysql command line still uses it when calculating  auto complete of object names. - https://github.com/mysql/mysql-server/blob/mysql-8.0.19/client/mysql.cc#L2838
mysqlshow still uses it when show colums of tables. - https://github.com/mysql/mysql-server/blob/mysql-8.0.19/client/mysqlshow.cc#L567 

How to repeat:
Check source code

Suggested fix:
Use SHOW FIELDS instead
[15 Apr 2020 13:27] MySQL Verification Team
Hello Mr. Altmann,

Thank you for your bug report.

I understand your intention, but I do not see a good reason why we should not use this function. This function uses a much faster way of getting fields than "SHOW FIELDS" command. Also, "SHOW ....." commands will be deprecated also one day. Then, our code will have to go through I_S.

Current command is skipping parser and some other layers and it is, hence, much faster and puts less load on the server. One day, when this shortcut is deprecated (which will happen), we shall replace mysql_list_fields, definitely.

But, so far, we have no good reason to do that, unless you have some other arguments.
[15 Apr 2020 14:05] Marcelo Altmann
Hi Sinisa, 
Online documentation says we should no longer use mysql_list_fields:

#5.7
As of MySQL 5.7.11, mysql_list_fields() is deprecated and will be removed in a future version of MySQL. Instead, use mysql_query() to execute a SHOW COLUMNS statement.

#8.0
mysql_list_fields() is deprecated and will be removed in a future version of MySQL. Instead, use mysql_query() to execute a SHOW COLUMNS statement.

I think mysql own client tools should comply with that.
[15 Apr 2020 14:12] MySQL Verification Team
Hi Mr. Altmann,

We have recommended this to all our users.

However, we are the ones that will decide when will it be truly deprecated. When it is deprecated we shall remove it.

Our users do not have the comfort of knowing exactly when will it be removed from our code. We, on the other side, when we make a final decision, we shalll know exactly when it will be removed, which is when we shall act on it and remove it in all of our client calls.

Not a bug.