Bug #86989 Missing warning after DROP DATABASE IF EXISTS for a non-existent database
Submitted: 7 Jul 2017 20:46 Modified: 11 Jul 2017 7:10
Reporter: monty solomon Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.7.18 OS:Any
Assigned to: CPU Architecture:Any

[7 Jul 2017 20:46] monty solomon
Description:
Warnings are not displayed after running DROP DATABASE IF EXISTS for a non-existent database.

How to repeat:
Run the mysql client without --show-warnings option.

Execute the DROP DATABASE IF EXISTS command and another command that generates warnings.

mysql> DROP DATABASE IF EXISTS employees; SHOW WARNINGS; STOP SLAVE; SHOW WARNINGS;
Query OK, 0 rows affected, 1 warning (0.00 sec)

Empty set (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

+-------+------+-----------------------------------------------------------+
| Level | Code | Message                                                   |
+-------+------+-----------------------------------------------------------+
| Note  | 3084 | Replication thread(s) for channel '' are already stopped. |
+-------+------+-----------------------------------------------------------+
1 row in set (0.00 sec)

Observe that the warnings are not displayed for the DROP DATABASE command even though the server reported that there was a warning. The warnings are displayed for the STOP SLAVE command.

Quit mysql

Run mysql with the --show-warnings option

Execute

mysql> DROP DATABASE IF EXISTS employees; SHOW WARNINGS; STOP SLAVE; SHOW WARNINGS;
Query OK, 0 rows affected, 1 warning (0.01 sec)

Note (Code 1008): Can't drop database 'employees'; database doesn't exist
+-------+------+---------------------------------------------------------+
| Level | Code | Message                                                 |
+-------+------+---------------------------------------------------------+
| Note  | 1008 | Can't drop database 'employees'; database doesn't exist |
+-------+------+---------------------------------------------------------+
1 row in set (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Note (Code 3084): Replication thread(s) for channel '' are already stopped.
+-------+------+-----------------------------------------------------------+
| Level | Code | Message                                                   |
+-------+------+-----------------------------------------------------------+
| Note  | 3084 | Replication thread(s) for channel '' are already stopped. |
+-------+------+-----------------------------------------------------------+
1 row in set (0.00 sec)

Observe that the warnings are displayed for both the DROP DATABASE command and the STOP SLAVE command.

Suggested fix:
Always display warnings when they exist.

Check other commands to see if they exhibit the same warning behavior as DROP DATABASE IF EXISTS.
[11 Jul 2017 7:10] MySQL Verification Team
Hello Monty,

Thank you for the report.
This is duplicate of Bug #79684, please see Bug #79684

Thanks,
Umesh