Bug #31765 BACKUP DATABASE broken syntax
Submitted: 22 Oct 2007 22:21 Modified: 17 Mar 2008 20:41
Reporter: Marc Alff Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:6.0-backup OS:Any
Assigned to: Marc Alff CPU Architecture:Any

[22 Oct 2007 22:21] Marc Alff
In 5.2, the BACKUP DATABASE statement accepts the following syntaxes:

BACKUP DATABASE * to 'all.bak';
BACKUP DATABASE test to 'test.bak';
BACKUP DATABASE db1, db2 to 'dbs.bak';

which is all expected.

However, the following syntax is also accepted:

BACKUP DATABASE *, test to 'broken.bak';

which is a bug.

How to repeat:
BACKUP DATABASE *, test to 'broken.bak';

Suggested fix:
In the grammar, fix the database_list: rules, to:
- either expand to '*'
- or expand to a list of idents,
but don't mix the two as it is today:

        | ident
        | database_list ',' ident

since this also accepts '*' followed by a list of idents ...
[4 Mar 2008 23:42] MySQL Verification Team
Thank you for the bug report.

[miguel@mira dbs]$ 6.0b/bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.5-alpha-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> BACKUP DATABASE *, test to 'broken.bak';
| backup_id |
| 1         | 
1 row in set (0.07 sec)

[5 Mar 2008 20:46] 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:


ChangeSet@1.2587, 2008-03-05 13:45:25-07:00, malff@lambda.hsd1.co.comcast.net. +3 -0
  Bug#31765 (BACKUP DATABASE broken syntax)
  Removed un necessary reduces in the middle of the 'backup' rule.
  Removed un necessary reduces in the middle of the 'restore' rule.
  Simplifying the grammar improves the code, and performances by making the
  parser state automaton smaller.
  Fixed the 'database_list' rule to:
  - either expand to a '*',
  - or expand to a list of database names.
  but not mix both, which caused the reported bug.
[13 Mar 2008 19:29] Bugs System
Pushed into 6.0.5-alpha
[17 Mar 2008 20:41] Paul Dubois
Noted in 6.0.5 changelogs.

BACKUP DATABASE syntax allows databases to be selected either as * or
a list of databases, but the parser was allowing a mix of the two
forms (for example, BACKUP DATABASE *, test TO 'filename').
[20 Mar 2008 17:20] Paul Dubois
Correction: No changelog entry needed; this bug did not appear in any released versions.