Note: quick search through percona_statement_set.test didn't find similar test cases, so I'm not sure whether the behavior is intentional. It doesn't look logical, though.
Example 1 - ANSI_QUOTES
DROP TABLE IF EXISTS t1;
# Query OK, 0 rows affected (0.18 sec)
# Set sql_mode = 'ANSI_QUOTES' to allow the initial parsing of the whole SET STATEMENT .. FOR
SET sql_mode='ANSI_QUOTES';
# Query OK, 0 rows affected (0.00 sec)
# But for the *actual* CREATE statement we unset the sql_mode, so
# the execution should fail with the syntax error
SET STATEMENT sql_mode='' FOR CREATE TABLE "t1" (i INT);
# Query OK, 0 rows affected (0.50 sec)
CREATE TABLE "t1" (i INT);
# ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"t1" (i INT)' at line 1
Example 2 - IGNORE_SPACE
DROP TABLE IF EXISTS count;
# Query OK, 0 rows affected (0.21 sec)
# IGNORE_SPACE mode should prevent creation of the `count` table:
SET STATEMENT sql_mode='IGNORE_SPACE' FOR CREATE TABLE count (i INT);
# Query OK, 0 rows affected (0.81 sec)
# ... but it doesn't.
# Compare with the usual behavior:
SET sql_mode='IGNORE_SPACE';
# Query OK, 0 rows affected (0.00 sec)
CREATE TABLE count (i INT);
# ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'count (i INT)' at line 1
Note: quick search through percona_ statement_ set.test didn't find similar test cases, so I'm not sure whether the behavior is intentional. It doesn't look logical, though.
Example 1 - ANSI_QUOTES
DROP TABLE IF EXISTS t1;
# Query OK, 0 rows affected (0.18 sec)
# Set sql_mode = 'ANSI_QUOTES' to allow the initial parsing of the whole SET STATEMENT .. FOR
SET sql_mode= 'ANSI_QUOTES' ;
# Query OK, 0 rows affected (0.00 sec)
# But for the *actual* CREATE statement we unset the sql_mode, so
# the execution should fail with the syntax error
SET STATEMENT sql_mode='' FOR CREATE TABLE "t1" (i INT);
# Query OK, 0 rows affected (0.50 sec)
# ... but it doesn't.
# Compare with the usual behavior:
SET sql_mode = '';
# Query OK, 0 rows affected (0.00 sec)
CREATE TABLE "t1" (i INT);
# ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"t1" (i INT)' at line 1
Example 2 - IGNORE_SPACE
DROP TABLE IF EXISTS count;
# Query OK, 0 rows affected (0.21 sec)
# IGNORE_SPACE mode should prevent creation of the `count` table:
SET STATEMENT sql_mode= 'IGNORE_ SPACE' FOR CREATE TABLE count (i INT);
# Query OK, 0 rows affected (0.81 sec)
# ... but it doesn't.
# Compare with the usual behavior:
SET sql_mode= 'IGNORE_ SPACE';
# Query OK, 0 rows affected (0.00 sec)
CREATE TABLE count (i INT);
# ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'count (i INT)' at line 1
bzr version-info
revision-id: <email address hidden>
date: 2014-10-21 11:25:15 +0300
build-date: 2014-10-25 14:01:00 +0400
revno: 687
branch-nick: percona-5.6