Bug #25859 ALTER DATABASE works w/o parameters
Submitted: 26 Jan 2007 9:20 Modified: 18 Jul 2007 19:15
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0, 5.1 OS:Any
Assigned to: Konstantin Osipov CPU Architecture:Any

[26 Jan 2007 9:20] Alexander Nozdrin
Description:
According to The Manual
(http://dev.mysql.com/doc/refman/5.0/en/alter-database.html),
ALTER TABLE requires at least one "alter_specification",
that can be either 'CHARACTER SET' or 'COLLATE'.

The current behaviour is that ALTER TABLE can be issued
without any arguments. In this case, database character set
is reset to the server character set.

This behaviour should be either documented, or prohibited.

How to repeat:
mysql> create database db1 character set utf8;
Query OK, 1 row affected (0.00 sec)

mysql> show create database db1;
+----------+--------------------------------------------------------------+
| Database | Create Database                                              |
+----------+--------------------------------------------------------------+
| db1      | CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+--------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> alter database db1;
Query OK, 1 row affected (0.01 sec)

mysql> show create database db1;
+----------+----------------------------------------------------------------+
| Database | Create Database                                                |
+----------+----------------------------------------------------------------+
| db1      | CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+----------------------------------------------------------------+
1 row in set (0.00 sec)
[11 Jul 2007 21:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/30741

ChangeSet@1.2517, 2007-07-12 01:10:29+04:00, kostja@bodhi.(none) +3 -0
  A fix and a test case for Bug#25859 ALTER DATABASE works w/o parameters.
  Fix the parser to make the database options not optional.
[12 Jul 2007 18:31] Konstantin Osipov
A tiny patch, queued into 5.0-runtime
[17 Jul 2007 15:29] Bugs System
Pushed into 5.0.48
[17 Jul 2007 15:30] Bugs System
Pushed into 5.1.21-beta
[18 Jul 2007 19:15] Paul DuBois
Noted in 5.0.48, 5.1.21 changelogs.

ALTER DATABASE did not require at least one option.