2003-01-16 01:04:50 +01:00
|
|
|
--disable_warnings
|
|
|
|
drop table if exists t1;
|
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
CREATE TABLE `t1` (
|
|
|
|
a int not null auto_increment,
|
|
|
|
`pseudo` varchar(35) character set latin2 NOT NULL default '',
|
|
|
|
`email` varchar(60) character set latin2 NOT NULL default '',
|
|
|
|
PRIMARY KEY (a),
|
|
|
|
UNIQUE KEY `email` USING BTREE (`email`)
|
2003-12-10 05:31:42 +01:00
|
|
|
) ENGINE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC;
|
2003-01-16 01:04:50 +01:00
|
|
|
set @@sql_mode="";
|
|
|
|
show variables like 'sql_mode';
|
|
|
|
show create table t1;
|
|
|
|
set @@sql_mode="ansi_quotes";
|
|
|
|
show variables like 'sql_mode';
|
|
|
|
show create table t1;
|
|
|
|
set @@sql_mode="no_table_options";
|
|
|
|
show variables like 'sql_mode';
|
|
|
|
show create table t1;
|
|
|
|
set @@sql_mode="no_key_options";
|
|
|
|
show variables like 'sql_mode';
|
|
|
|
show create table t1;
|
|
|
|
set @@sql_mode="no_field_options,mysql323,mysql40";
|
|
|
|
show variables like 'sql_mode';
|
|
|
|
show create table t1;
|
2003-10-15 11:50:36 +02:00
|
|
|
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
|
2003-06-04 17:28:51 +02:00
|
|
|
select @@sql_mode;
|
2003-01-16 01:04:50 +01:00
|
|
|
show create table t1;
|
|
|
|
drop table t1;
|
2004-07-07 14:26:43 +02:00
|
|
|
|
2004-11-04 05:50:07 +01:00
|
|
|
#
|
|
|
|
# Check that a binary collation adds 'binary'
|
|
|
|
# suffix into a char() column definition in
|
|
|
|
# mysql40 and mysql2323 modes. This allows
|
|
|
|
# not to lose the column's case sensitivity
|
|
|
|
# when loading the dump in pre-4.1 servers.
|
|
|
|
#
|
|
|
|
# Thus, in 4.0 and 3.23 modes we dump:
|
|
|
|
#
|
|
|
|
# 'char(10) collate xxx_bin' as 'char(10) binary'
|
|
|
|
# 'binary(10)' as 'binary(10)'
|
|
|
|
#
|
|
|
|
# In mysql-4.1 these types are different, and they will
|
|
|
|
# be recreated differently.
|
|
|
|
#
|
|
|
|
# In mysqld-4.0 the the above two types were the same,
|
|
|
|
# so it will create a 'char(10) binary' column for both definitions.
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
a char(10),
|
|
|
|
b char(10) collate latin1_bin,
|
|
|
|
c binary(10)
|
|
|
|
) character set latin1;
|
|
|
|
set @@sql_mode="";
|
|
|
|
show create table t1;
|
|
|
|
set @@sql_mode="mysql323";
|
|
|
|
show create table t1;
|
|
|
|
set @@sql_mode="mysql40";
|
|
|
|
show create table t1;
|
|
|
|
drop table t1;
|
|
|
|
|
2004-09-14 13:49:08 +02:00
|
|
|
#
|
|
|
|
# BUG#5318 - failure: 'IGNORE_SPACE' affects numeric values after DEFAULT
|
|
|
|
#
|
|
|
|
# Force the usage of the default
|
|
|
|
set session sql_mode = '';
|
|
|
|
# statement for comparison, value starts with '.'
|
|
|
|
create table t1 ( min_num dec(6,6) default .000001);
|
|
|
|
show create table t1;
|
|
|
|
drop table t1 ;
|
|
|
|
#
|
|
|
|
set session sql_mode = 'IGNORE_SPACE';
|
|
|
|
# statement for comparison, value starts with '0'
|
|
|
|
create table t1 ( min_num dec(6,6) default 0.000001);
|
|
|
|
show create table t1;
|
|
|
|
drop table t1 ;
|
|
|
|
# This statement fails, value starts with '.'
|
|
|
|
create table t1 ( min_num dec(6,6) default .000001);
|
|
|
|
show create table t1;
|
|
|
|
drop table t1 ;
|
|
|
|
|
2004-10-29 18:26:52 +02:00
|
|
|
|
2004-07-07 14:26:43 +02:00
|
|
|
#
|
|
|
|
# test for
|
|
|
|
# WL 1941 "NO_C_ESCAPES sql_mode"
|
|
|
|
#
|
|
|
|
# an sql_mode to disable \n, \r, \b, etc escapes in string literals. actually, to
|
|
|
|
# disable special meaning of backslash completely. It's not in the SQL standard
|
|
|
|
# and it causes some R/3 tests to fail.
|
|
|
|
#
|
|
|
|
|
|
|
|
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
|
|
|
|
show local variables like 'SQL_MODE';
|
|
|
|
|
|
|
|
CREATE TABLE t1 (p int not null auto_increment, a varchar(20), primary key(p));
|
|
|
|
INSERT t1 (a) VALUES
|
|
|
|
('\\'),
|
|
|
|
('\n'),
|
|
|
|
('\b'),
|
|
|
|
('\r'),
|
|
|
|
('\t'),
|
|
|
|
('\x'),
|
|
|
|
('\a'),
|
|
|
|
('\aa'),
|
|
|
|
('\\a'),
|
|
|
|
('\\aa'),
|
|
|
|
('_'),
|
|
|
|
('\_'),
|
|
|
|
('\\_'),
|
|
|
|
('\\\_'),
|
|
|
|
('\\\\_'),
|
|
|
|
('%'),
|
|
|
|
('\%'),
|
|
|
|
('\\%'),
|
|
|
|
('\\\%'),
|
|
|
|
('\\\\%')
|
|
|
|
;
|
|
|
|
|
|
|
|
SELECT p, hex(a) FROM t1;
|
|
|
|
|
|
|
|
delete from t1 where a in ('\n','\r','\t', '\b');
|
|
|
|
|
|
|
|
select
|
|
|
|
masks.p,
|
|
|
|
masks.a as mask,
|
|
|
|
examples.a as example
|
|
|
|
from
|
|
|
|
t1 as masks
|
|
|
|
left join t1 as examples on examples.a LIKE masks.a
|
|
|
|
order by masks.p, example;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
|
|
|
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
|
|
|
|
show local variables like 'SQL_MODE';
|
|
|
|
|
|
|
|
CREATE TABLE t1 (p int not null auto_increment, a varchar(20), primary key(p));
|
|
|
|
INSERT t1 (a) VALUES
|
|
|
|
('\\'),
|
|
|
|
('\n'),
|
|
|
|
('\b'),
|
|
|
|
('\r'),
|
|
|
|
('\t'),
|
|
|
|
('\x'),
|
|
|
|
('\a'),
|
|
|
|
('\aa'),
|
|
|
|
('\\a'),
|
|
|
|
('\\aa'),
|
|
|
|
('_'),
|
|
|
|
('\_'),
|
|
|
|
('\\_'),
|
|
|
|
('\\\_'),
|
|
|
|
('\\\\_'),
|
|
|
|
('%'),
|
|
|
|
('\%'),
|
|
|
|
('\\%'),
|
|
|
|
('\\\%'),
|
|
|
|
('\\\\%')
|
|
|
|
;
|
|
|
|
|
|
|
|
SELECT p, hex(a) FROM t1;
|
|
|
|
|
|
|
|
delete from t1 where a in ('\n','\r','\t', '\b');
|
|
|
|
|
|
|
|
select
|
|
|
|
masks.p,
|
|
|
|
masks.a as mask,
|
|
|
|
examples.a as example
|
|
|
|
from
|
|
|
|
t1 as masks
|
|
|
|
left join t1 as examples on examples.a LIKE masks.a
|
|
|
|
order by masks.p, example;
|
|
|
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
2005-02-04 01:14:02 +01:00
|
|
|
# Bug #6368: Make sure backslashes mixed with doubled quotes are handled
|
|
|
|
# correctly in NO_BACKSLASH_ESCAPES mode
|
|
|
|
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
|
|
|
|
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
|
|
|
|
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
|
|
|
|
|
|
|
|
SET @@SQL_MODE='';
|
|
|
|
SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
|
|
|
|
SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
|
|
|
|
|
2004-07-07 14:26:43 +02:00
|
|
|
SET @@SQL_MODE=@OLD_SQL_MODE;
|