Bug #114496 SHOW WARNINGS for ALTER TABLE does not display a proper table name
Submitted: 27 Mar 15:13 Modified: 27 Mar 15:48
Reporter: John Jove Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:8.0.36 OS:Any
Assigned to: CPU Architecture:Any

[27 Mar 15:13] John Jove
Description:
When using the SHOW WARNINGS command to return the warning message after execute a ALTER TABLE, the message did not return the concrete name of the table.

In the following case, it is better to display the table name 't1' instead of '#sql-1_15'.

mysql> CREATE TABLE t1 (c1 INT);
Query OK, 0 rows affected (0.02 sec)

mysql> ALTER TABLE t1 PACK_KEYS 1, DISABLE KEYS, STATS_PERSISTENT 1;
Query OK, 0 rows affected, 1 warning (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 1

mysql> SHOW WARNINGS;
+-------+------+---------------------------------------------------------------+
| Level | Code | Message                                                       |
+-------+------+---------------------------------------------------------------+
| Note  | 1031 | Table storage engine for '#sql-1_15' doesn't have this option |
+-------+------+---------------------------------------------------------------+
1 row in set (0.00 sec)

How to repeat:
CREATE TABLE t1 (c1 INT);
ALTER TABLE t1 PACK_KEYS 1, DISABLE KEYS, STATS_PERSISTENT 1;
SHOW WARNINGS;
[27 Mar 15:48] MySQL Verification Team
Hi Mr. Jove,

Thank you for your bug report.

However, this is not a bug.

This is so by design.

That is because warnings are displayed immediately after the command is executed, hence everything is quite visible.

Next, warnings will not be changed, most of them are used throughout our code ......

Not a bug.