[MDEV-7208] mysqldump incorrectly reads the variable "database" as "databases" Created: 2014-11-26 Updated: 2015-08-17 Resolved: 2015-08-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 5.5.40, 10.0.15 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Jean Weisbuch | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | mysqldump, upstream | ||
| Environment: |
Linux |
||
| Description |
|
Putting a "database=some_db" (where some_db is a valid database) under the [client] section of ~/.my.cnf (or any other config files parsed by mysqldump) will result on this warning on the execution of mysqldump, even if a database (or several) are specified for the dump :
The same happens when running "mysqldump --databases some_db" The error message is confusing as the specified database name is valid. The upstream bug (http://bugs.mysql.com/bug.php?id=18209) has been reported almost a decade ago and a patch that added the specific option "database" to mysqldump has been provided on the bug report but never made it to the main tree : http://lists.mysql.com/commits/6311 Another solution would be to make simply that mysqldump doesnt read the database parameter from the config file which would be safe as it should have never worked before. |
| Comments |
| Comment by Jean Weisbuch [ 2014-12-05 ] | ||
|
As a side note, mysqladmin also doesnt like the database variable on the [client] section :
| ||
| Comment by Michael Widenius [ 2015-06-26 ] | ||
|
This is not a bug, but wrong usage of the --database[s] option. --databases means that all arguments, that are not options, should be treated as databases instead of tables. Having databases=1 in an option file makes perfect sense as it changes how mysqldump works by default (working on databases instead of tables). Adding a --database=name option would not be a good idea as database is a prefix of databases and could cause errors for anyone using 'database' in the config files. One can only have options that is valid for all clients in the [client] section. That said, it would be nice to have a way to add in the configuration file an option to only dump one database (by default) | ||
| Comment by Sergei Golubchik [ 2015-06-26 ] | ||
|
jb-boin, what is the complain here? A spurious warning? Or inability to specify a database in the config file? | ||
| Comment by Jean Weisbuch [ 2015-06-27 ] | ||
|
On the other way around, if the "database=" value is set to a boolean on the [client] section, "mysqldump" will work just fine but the CLI and "mysqladmin" wont work anymore :
The "database=" option could be mistakebly put on the [client] section instead of the [mysql] one by a user wanting to set the default database to connect to. As a possible solution, it would be better to throw a warning telling that the option might have been put on the wrong section or that abbreviation should be avoided if :
The fact that the warning has expanded the option to a different one (setting "database" but ending up on an error on the "databases" invalue value is a bit confusing if you dont know there is an auto completion of abbreviations). | ||
| Comment by Sergei Golubchik [ 2015-06-27 ] | ||
|
The server in 10.1 supports the option --disable-getopt-prefix-matching. It would be a bit difficult to add that to clients too, but possible. Then one could put it in [client] or even [client-server] section and and database will never mean databases anymore. Would that be a solution? | ||
| Comment by Sergei Golubchik [ 2015-08-17 ] | ||
|
This is not a bug, but a consequences of the intentional and documented behavior. While I agree that this behavior of confusing, I'm not sure what exactly the best fix could be. Please, feel free to reopen it or add a comment if you still want us to fix it. |