• Nirbhay Choubey's avatar
    Bug #54899 : --one-database option cannot handle DROP/CREATE DATABASE commands · 8629024b
    Nirbhay Choubey authored
    After dropping and recreating the database specified along with --one-database
    option at command line, mysql client keeps filtering the statements even after
    the execution of a 'USE' command on the same database.
    
    --one-database option enables the filtering of statements when the current
    database is not the one specified at the command line. However, when the same
    database is dropped and recreated the variable (current_db) that holds the
    inital database name gets altered. This bug exploits the fact that current_db
    initially gets set to null value (0) when a 'use db_name' follows the recreation
    of same database db_name (speficied at the command line) and hence skip_updates
    gets set to 1, which inturn triggers the further filtering of statements.
    
    Fixed by making get_current_db() a no-op function when one_database is set,
    and hence, under that condition current_db will not get altered.
    Note, however the value of current_db can change when we execute 'connect'
    command with a differnet database to reconnect to the server, in which case,
    the behavior of --one-database will be formulated using this new database.
    8629024b
mysql.result 7.31 KB