If you start mysqld
with the --ansi
or --sql-mode=ANSI
option, the following behaviours of MySQL Server change:
||
is a string concatenation operator rather than a synonym for
OR
.
USER()
function,
the name of the user
table in the mysql
database and the User
column in that table become reserved,
so you must quote them:
SELECT "User" FROM mysql."user";
REAL
is a synonym for FLOAT
instead of a synonym for
DOUBLE
.
SERIALIZABLE
.
See section 6.7.4 SET TRANSACTION
Syntax.
GROUP BY
that is not in the
field list.
Running the server in ANSI mode is the same as starting it with these options:
--sql-mode=REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY --transaction-isolation=SERIALIZABLE
In MySQL 4.1, you can achieve the same effect with these two statements:
SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET GLOBAL sql_mode = "REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY";
In MySQL 4.1.1, the sql_mode
options shown can be also be set with:
SET GLOBAL sql_mode="ansi";
In this case, the value of the sql_mode
variable will be set to all
options that are relevant for ANSI mode. You can check the result by doing:
mysql> SET GLOBAL sql_mode="ansi"; mysql> SELECT @@GLOBAL.sql_mode; -> "REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI"