Bug #27157 Option to halt execution on error in client when interactive, just like batch
Submitted: 15 Mar 2007 0:16
Reporter: Stephen Gornick Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:5.1 OS:
Assigned to: CPU Architecture:Any
Tags: --force, -f, batch, batch mode, client, error, errors, force, halt, halted, halts, IGNORE, ingored, ingores, interactive, interactively, script, SOURCE, SQL, sql error, statement, stop, stopped, stops
Triage: D5 (Feature request)

[15 Mar 2007 0:16] Stephen Gornick
Description:
When executing a script in the MySQL client interactively (using the "source" command), I still would like the option to have it halt on any SQL error -- just like it would if the script were run in "batch" mode.

How to repeat:
$ cat test.sql 

select 'testing ...'; 
select CauseAnError(); 
select 'this still executes'; 

$ mysql 
mysql> source test.sql 

+-------------+ 
| testing ... | 
+-------------+ 
| testing ... | 
+-------------+ 
1 row in set (0.00 sec) 

ERROR 1305 (42000): FUNCTION .CauseAnError does not exist 
+---------------------+ 
| this still executes | 
+---------------------+ 
| this still executes | 
+---------------------+ 
1 row in set (0.00 sec)

Suggested fix:
A command-line option (or session variable?), something like the opposite of the "--force" option that would "halt on error" when executing scripts interactively (using the source command).