Bug #73154 MySQL Doc doesn't specify "mysql -e" to disable --force and history file
Submitted: 1 Jul 2014 1:44 Modified: 8 Jul 2014 4:09
Reporter: Paul Namuag Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:all, 5.5, 5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: execute by query or by source, force error

[1 Jul 2014 1:44] Paul Namuag
Description:
From the manual, it says

 --execute=statement, -e statement

Execute the statement and quit. The default output format is like that produced with --batch. See Section 4.2.4, “Using Options on the Command Line”, for some examples. With this option, mysql does not use the history file.

but it doesn't mention that it disables --force and history file. When mysql -h, it says:

  -e, --execute=name  Execute command and quit. (Disables --force and history
                      file.)

How to repeat:
From http://dev.mysql.com/doc/refman/5.5/en/mysql-command-options.html#option_mysql_execute vs command line "mysql --help"

Suggested fix:
Specify this in the manual available at dev.mysql.com manual pages.
[1 Jul 2014 4:37] MySQL Verification Team
Hello Roben,

Thank you for the bug report.

Thanks,
Umesh
[1 Jul 2014 4:38] MySQL Verification Team
// 5.7 client

mysql-5.7.5]# bin/mysql --help|grep -i ' Execute command and quit'
  -e, --execute=name  Execute command and quit. (Disables --force and history
[1 Jul 2014 18:49] Pura Vida
I think there are 3 issues as described below:

[1] Even the help message that --execute disables --force option is not clear. Actual result is that the -e option disables -f option that specified before it, but NOT after that. This needs documented because the order of options do not matter for majority of Unix commands.

[2] With or without the -f option, interactive execution of mysql command will not abort upon a failure of a SQL statement. Neither the mysql man page nor the help message mentioned this, which implies the -f option or the lack of -f option applies to both interactive and non-interactive session, which is not the actually result. This is demonstrated in the code below.

{code}
$ mysql -v test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 52
Server version: 5.6.19-log Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Reading history-file /Users/m.wang/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source test.sql
--------------
set sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_ALL_TABLES'
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
drop table if exists bigint_int
--------------

Query OK, 0 rows affected (0.00 sec)

--------------
create table bigint_int (a bigint)
--------------

Query OK, 0 rows affected (0.01 sec)

--------------
insert into bigint_int values ( 2147483648 )
--------------

Query OK, 1 row affected (0.00 sec)

--------------
select * from bigint_int
--------------

+------------+
| a          |
+------------+
| 2147483648 |
+------------+
1 row in set (0.00 sec)

--------------
alter table bigint_int modify a int
--------------

ERROR 1264 (22003): Out of range value for column 'a' at row 1
--------------
select * from bigint_int
--------------

+------------+
| a          |
+------------+
| 2147483648 |
+------------+
1 row in set (0.00 sec)
{code}

[3] This is a request for enhancement. I not only need an option to continue or not to continue upon SQL error for both interactive, and non-interactive session, I need the capability to turn this option on or off inside SQL statement, in a similar manner as Oracle's "whenever sql error continue|exit". Example:

{code}
whenever sqlerror continue
some non critical SQL statements
...
whenever sqlerror exit 1
some critical SQL statements
...
{code}
[2 Jul 2014 0:22] Pura Vida
Umesh or whom it may concern,

Can you confirm that you have accepted my bug report which is documented in [2] of previous message that -force option has no impact on interactive sessions, the behavior is the same without --force option;
and the enhancement request as documented in [3] of previous message. Thanks.
[7 Jul 2014 14:09] Paul Dubois
This started as a docs bug, but later comments indicate that the issue also applies to the mysql --help message, and other comments raise questions about the actual intended behavior of the program.

I am reclassifying this as a client bug so that:
1) The --help message can be fixed as necessary
2) A developer can assess the intended effect, and either verify that it is as intended or correct it as necessary.

After those points are addressed, I will make any necessary adjustment to the documentation. Thanks.