Hi Sergey,
On Thursday 18 November 2010 06:19 PM, Sergey Vojtovich wrote:
> Hi Nirbhay, Joro!
>
> Use case #5:
> I have a dump provided by mysqldump tool:
> --
> USE `non_existent_db`;
> CREATE TABLE `table_in_non_existent_db`(a INT);
> USE `test`;
> CREATE TABLE `table_in_test`(a INT);
> --
> Note: I simplified dump for better readability.
>
> I have no `non_existent_db` database.
> I have empty `test` database.
> I want to load tables from `test` database.
> I read manual for one-database option:
> --
> Ignore statements except those that occur while the default database
> is the one named on the command line. This option is rudimentary and
> should be used with care. Statement filtering is based only on USE
> statements.
> --
> I think this option does what I need.
> I do "mysql --one-database test".
> I expect new table in `test`: `table_in_test`.
> Without this patch I get new table.
> With this patch `test` database is empty.
>
This is a matter of choice of how we want mysql client to respond
if it hits an erroneous statement while loading (with one-database option).
As 'post-patch' mysql client now throws an error while executing
'USE `non_existent_db`, it will skip the loading.
This will happen with or without one-database option.
However, with pre-patch client, 'USE `non_existent_db` will just
succeed, and hence, loading will continue.
If, we want the post-patch client to behave the same way, we can
just change the error message to a *soft* error message to the user,
and can let the loading proceed normally.
Thanks for pointing this out.
> Regards,
> Sergey
>
> On Wed, Nov 17, 2010 at 10:09:46AM +0000, Nirbhay Choubey wrote:
>
>> #At file:///home/nirbhay/Project/mysql/repo/wl/mysql-5.1-bugteam-54899/ based on
> revid:guilhem@stripped
>>
>> 3554 Nirbhay Choubey 2010-11-17
>> Bug#54899 : --one-database option cannot handle DROP/CREATE DATABASE
> commands
>>
> ...skip...
>
>
>> @@ -1449,8 +1450,9 @@ static struct my_option my_long_options[
>> &opt_sigint_ignore,&opt_sigint_ignore, 0, GET_BOOL,
>> NO_ARG, 0, 0, 0, 0, 0, 0},
>> {"one-database", 'o',
>> - "Only update the default database. This is useful for skipping updates "
>> - "to other database in the update log.",
>> + "Ignore statements except those that occur while the default "
>> + "database is the one named at the command line and USE command "
>> + "is not executed with some other database.",
>> 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
>> #ifdef USE_POPEN
>> {"pager", OPT_PAGER,
>>
> Are you sure your addendum is correct?
>
Yes, I tired to define it in the way client behaves as of now, but
if we come up with a more precise definition of one-database,
will modify it.
Best,
Nirbhay
> Regards,
> Sergey
>