Skip to content

Conversation

daniyaalk
Copy link

Though as per the documentation COM_FIELD_LIST is deprecated, mysql client version 8.0.41 still uses it. Upon connecting to the server without the -A flag, the client issues a COM_FIELD_LIST command as soon as a database is selected, or upon successful connection to the server if the database was mentioned during the connection phase.

As per the documentation of COM_FIELD_LIST, the response contains several ColumnDefinition packets. These packets contain the default values as part of the packet body, however, this behaviour is not mentioned on the ColumnDefinition documentation for Protocol::ColumnDefinition41 (it is mentioned for Protocol::ColumnDefinition320). This behaviour is exclusive to COM_FIELD_LIST as it is the only invocation of THD::send_result_metadata with the Protocol::SEND_DEFAULTS flag(sql/sql_show.cc:1417).

Modifications

Minor modifications:

  • mysys/pack.cc:113: Fix gramatical error.
  • sql/protocol_classic.cc:134: Mention NULL condition for Protocol::LengthEncodedString, previously undocumented.

Steps to replicate:

Commands mentioned in the next section.

Console Logs and Packet Capture follows:

Console Logs:

--get-server-public-key=true --ssl-mode=DISABLED flags added to allow plaintext capture of packets.

➜  ~ mysql -V                                                                                     
mysql  Ver 8.0.41-0ubuntu0.24.10.1 for Linux on x86_64 ((Ubuntu))
➜  ~ mysql -uroot -pasd -P6033 -h127.0.0.1 mysql --get-server-public-key=true --ssl-mode=DISABLED;
mysql: [Warning] Using a password on the command line interface can be insecure.
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 15
Server version: 8.0.32 MySQL Community Server - GPL

Copyright (c) 2000, 2025, 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> select version()
    -> ;
+-----------+
| version() |
+-----------+
| 8.0.32    |
+-----------+
1 row in set (0.00 sec)

mysql> 

Packet Capture

ColumnDefinition packet for Drop_role_priv column of mysql.user table. (Default value is N).

0000   41 00 00 2f 03 64 65 66 05 6d 79 73 71 6c 04 75   A../.def.mysql.u
0010   73 65 72 04 75 73 65 72 0e 44 72 6f 70 5f 72 6f   ser.user.Drop_ro
0020   6c 65 5f 70 72 69 76 0e 44 72 6f 70 5f 72 6f 6c   le_priv.Drop_rol
0030   65 5f 70 72 69 76 0c ff 00 04 00 00 00 fe 01 01   e_priv..........
0040   00 00 00 01 4e                                    ....N

ColumnDefinition packet for User_attributes column of mysql.user table. (Default value is NULL).

0000   42 00 00 33 03 64 65 66 05 6d 79 73 71 6c 04 75   B..3.def.mysql.u
0010   73 65 72 04 75 73 65 72 0f 55 73 65 72 5f 61 74   ser.user.User_at
0020   74 72 69 62 75 74 65 73 0f 55 73 65 72 5f 61 74   tributes.User_at
0030   74 72 69 62 75 74 65 73 0c 3f 00 ff ff ff ff f5   tributes.?......
0040   90 00 00 00 00 fb                                 ......

regarding the sending of default values in
ColumnDefinition for CLIENT_PROTOCOL_41,
along with a quick grammatical fix in
mysys/pack.cc.
@daniyaalk
Copy link
Author

Full PCAP (converted to .txt from .pcapng since github does not support it)
Uploading MySQL SHOW FIELDS.txt…

@dveeden
Copy link

dveeden commented Feb 26, 2025

Full PCAP (converted to .txt from .pcapng since github does not support it) Uploading MySQL SHOW FIELDS.txt…

Zipping it might work

@daniyaalk
Copy link
Author

daniyaalk commented Feb 26, 2025

Full PCAP (converted to .txt from .pcapng since github does not support it) Uploading MySQL SHOW FIELDS.txt…

Zipping it might work

MySQL SHOW FIELDS.zip

Yup, that did the trick!

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@daniyaalk
Copy link
Author

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=117596 for updates.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants