| Bug #1336 | mysql.cc assumes DATABASE() doesn't return NULL | ||
|---|---|---|---|
| Submitted: | 18 Sep 2003 10:32 | Modified: | 6 Oct 2003 3:49 |
| Reporter: | Paul DuBois | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
| Version: | all | OS: | Any (all) |
| Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[2 Oct 2003 18:54]
MySQL Verification Team
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.1.1-alpha-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> \s -------------- /home/miguel/dbs/mysql-4.1/bin/mysql Ver 14.1 Distrib 4.1.1-alpha, for pc-linux (i686) Connection id: 1 Current database: (null)
[6 Oct 2003 3:49]
Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html

Description: In MySQL 4.1.1, the DATABASE() function now returns NULL if no database is selected. This causes problems if a client assumes the value is always non-NULL. mysql.cc does this in one place. In com_status(), this line appears: tee_fprintf(stdout, "Current database:\t%s\n",cur[0]); Might be better to write: tee_fprintf(stdout, "Current database:\t%s\n",cur[0][0] ? cur[0] : ""); Note that although the change was in the 4.1.1 server, this problem will affect mysql.cc for all MySQL trees. How to repeat: % mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 17 to server version: 4.1.1-alpha-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> \s -------------- /var/mysql/40101/bin/mysql Ver 14.1 Distrib 4.1.1-alpha, for apple-darwin6.6 (powerpc) Connection id: 17 Current database: (null) ... Suggested fix: See above.