mariadb/mysql-test/r/sql_mode.result
unknown 191fa29932 WL#638 - Fix precedence for parsing NOT ... LIKE expression s
Rework parser expression rules
  Rework handling for "||" concat/or
  Eliminate some shift/reduce conflicts
  Add support for "xxx IS [ NOT ] truth_value"


mysql-test/r/ansi.result:
  Fix test for new BROKEN_NOT mode bit
mysql-test/r/bool.result:
  WL#638
    New test for BROKEN_NOT mode
    New test for "expr IS [NOT] truth_value" syntax
mysql-test/r/sql_mode.result:
  Fix test for new BROKEN_NOT mode bit
mysql-test/t/bool.test:
  WL#638
    New test for BROKEN_NOT mode
    New test for "expr IS [NOT] truth_value" syntax
sql/lex.h:
  WL#638
    "&&" and "AND" return different tokens,
    NOT token changed to NOT_SYM
    OR_OR_CONCAT token changed to OR_OR_SYM
    New token "UNKNOWN"
sql/mysql_priv.h:
  WL#638
    New mode: BROKEN_NOT
sql/mysqld.cc:
  WL#638
    New mode: BROKEN_NOT
sql/set_var.cc:
  WL#638
    New mode: BROKEN_NOT
    BROKEN_NOT is set in MYSQL323 and MYSQL40 modes
sql/sql_lex.cc:
  Bug#638
    Alter tokens returned by lexer depending upon sql_mode:
    Return NOT2_SYM token instead of NOT_SYM when in BROKEN_NOT mode
    Return OR2_SYM token instead of OR_OR_SYM when not in PIPES_AS_CONCAT mode
sql/sql_yacc.yy:
  WL#638
    Change grammar to respect proper SQL syntax for NOT
    Clean up grammar, eliminate >100 shift/reduce conflicts
    New support for "expr IS [NOT] truth_value" SQL syntax
    Remove or_or_concat() support func. New support func is_truth_value()
2004-11-17 15:49:10 +00:00

389 lines
7.2 KiB
Text

drop table if exists t1;
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`)
) ENGINE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC;
set @@sql_mode="";
show variables like 'sql_mode';
Variable_name Value
sql_mode
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) 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` TYPE BTREE (`email`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="ansi_quotes";
show variables like 'sql_mode';
Variable_name Value
sql_mode ANSI_QUOTES
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" int(11) 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" TYPE BTREE ("email")
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="no_table_options";
show variables like 'sql_mode';
Variable_name Value
sql_mode NO_TABLE_OPTIONS
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) 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` TYPE BTREE (`email`)
)
set @@sql_mode="no_key_options";
show variables like 'sql_mode';
Variable_name Value
sql_mode NO_KEY_OPTIONS
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) 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` (`email`)
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
set @@sql_mode="no_field_options,mysql323,mysql40";
show variables like 'sql_mode';
Variable_name Value
sql_mode NO_FIELD_OPTIONS,MYSQL323,MYSQL40,BROKEN_NOT
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`pseudo` varchar(35) NOT NULL default '',
`email` varchar(60) NOT NULL default '',
PRIMARY KEY (`a`),
UNIQUE KEY `email` (`email`)
) TYPE=HEAP ROW_FORMAT=DYNAMIC
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@sql_mode;
@@sql_mode
PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" int(11) NOT NULL,
"pseudo" varchar(35) NOT NULL default '',
"email" varchar(60) NOT NULL default '',
PRIMARY KEY ("a"),
UNIQUE KEY "email" ("email")
)
drop table t1;
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;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) default NULL,
`b` char(10) character set latin1 collate latin1_bin default NULL,
`c` binary(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
set @@sql_mode="mysql323";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) default NULL,
`b` char(10) binary default NULL,
`c` binary(10) default NULL
) TYPE=MyISAM
set @@sql_mode="mysql40";
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) default NULL,
`b` char(10) binary default NULL,
`c` binary(10) default NULL
) TYPE=MyISAM
drop table t1;
set session sql_mode = '';
create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`min_num` decimal(7,6) default '0.000001'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
set session sql_mode = 'IGNORE_SPACE';
create table t1 ( min_num dec(6,6) default 0.000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`min_num` decimal(7,6) default '0.000001'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`min_num` decimal(7,6) default '0.000001'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
show local variables like 'SQL_MODE';
Variable_name Value
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;
p hex(a)
1 5C
2 0A
3 08
4 0D
5 09
6 78
7 61
8 6161
9 5C61
10 5C6161
11 5F
12 5C5F
13 5C5F
14 5C5C5F
15 5C5C5F
16 25
17 5C25
18 5C25
19 5C5C25
20 5C5C25
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;
p mask example
1 \ \
6 x x
7 a a
8 aa aa
9 \a a
10 \aa aa
11 _ %
11 _ a
11 _ x
11 _ \
11 _ _
12 \_ _
13 \_ _
14 \\_ \%
14 \\_ \%
14 \\_ \a
14 \\_ \_
14 \\_ \_
15 \\_ \%
15 \\_ \%
15 \\_ \a
15 \\_ \_
15 \\_ \_
16 % %
16 % a
16 % aa
16 % x
16 % \
16 % \%
16 % \%
16 % \a
16 % \aa
16 % \\%
16 % \\%
16 % \\_
16 % \\_
16 % \_
16 % \_
16 % _
17 \% %
18 \% %
19 \\% \
19 \\% \%
19 \\% \%
19 \\% \a
19 \\% \aa
19 \\% \\%
19 \\% \\%
19 \\% \\_
19 \\% \\_
19 \\% \_
19 \\% \_
20 \\% \
20 \\% \%
20 \\% \%
20 \\% \a
20 \\% \aa
20 \\% \\%
20 \\% \\%
20 \\% \\_
20 \\% \\_
20 \\% \_
20 \\% \_
DROP TABLE t1;
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
show local variables like 'SQL_MODE';
Variable_name Value
sql_mode NO_BACKSLASH_ESCAPES
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;
p hex(a)
1 5C5C
2 5C6E
3 5C62
4 5C72
5 5C74
6 5C78
7 5C61
8 5C6161
9 5C5C61
10 5C5C6161
11 5F
12 5C5F
13 5C5C5F
14 5C5C5C5F
15 5C5C5C5C5F
16 25
17 5C25
18 5C5C25
19 5C5C5C25
20 5C5C5C5C25
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;
p mask example
1 \\ \\
6 \x \x
7 \a \a
8 \aa \aa
9 \\a \\a
10 \\aa \\aa
11 _ %
11 _ _
12 \_ \%
12 \_ \a
12 \_ \x
12 \_ \\
12 \_ \_
13 \\_ \\%
13 \\_ \\a
13 \\_ \\_
14 \\\_ \\\%
14 \\\_ \\\_
15 \\\\_ \\\\%
15 \\\\_ \\\\_
16 % %
16 % \%
16 % \a
16 % \aa
16 % \x
16 % \\
16 % \\%
16 % \\a
16 % \\aa
16 % \\\%
16 % \\\\%
16 % \\\\_
16 % \\\_
16 % \\_
16 % \_
16 % _
17 \% \%
17 \% \a
17 \% \aa
17 \% \x
17 \% \\
17 \% \\%
17 \% \\a
17 \% \\aa
17 \% \\\%
17 \% \\\\%
17 \% \\\\_
17 \% \\\_
17 \% \\_
17 \% \_
18 \\% \\
18 \\% \\%
18 \\% \\a
18 \\% \\aa
18 \\% \\\%
18 \\% \\\\%
18 \\% \\\\_
18 \\% \\\_
18 \\% \\_
19 \\\% \\\%
19 \\\% \\\\%
19 \\\% \\\\_
19 \\\% \\\_
20 \\\\% \\\\%
20 \\\\% \\\\_
DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE;