call mtr.add_suppression("table or database name 't-1'");
#
# Check some special create statements.
#

--disable_warnings
drop table if exists t1,t2,t3,t4,t5;
drop database if exists mysqltest;
drop view if exists v1;
--enable_warnings

create table t1 (b char(0));
insert into t1 values (""),(null);
select * from t1;
drop table if exists t1;

create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null);
insert into t1 values (""),(null);
select * from t1;
drop table t1;

create table t1 (a int not null auto_increment,primary key (a)) engine=heap;
drop table t1;

#
# Test of some CREATE TABLE'S that should fail
#

--error 1146
create table t2 engine=heap select * from t1;
--error 1146
create table t2 select auto+1 from t1;
drop table if exists t1,t2;
--error 1167
create table t1 (b char(0) not null, index(b));
--error 1163
create table t1 (a int not null,b text) engine=heap;
drop table if exists t1;

--error 1075
create table t1 (ordid int(8) not null auto_increment, ord  varchar(50) not null, primary key (ord,ordid)) engine=heap;

-- error 1049
create table not_existing_database.test (a int);
create table `a/a` (a int);
show create table `a/a`;
create table t1 like `a/a`;
drop table `a/a`;
drop table `t1`;
--error 1103
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
--error 1059
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);

#
# Some wrong defaults, so these creates should fail too (Bug #5902)
#
create table t1 (a datetime default now());
drop table t1;
create table t1 (a datetime on update now());
drop table t1;
--error 1067
create table t1 (a int default 100 auto_increment);
--error 1067
create table t1 (a tinyint default 1000);
--error 1067
create table t1 (a varchar(5) default 'abcdef');

create table t1 (a varchar(5) default 'abcde');
insert into t1 values();
select * from t1;
--error 1067
alter table t1 alter column a set default 'abcdef';
drop table t1;

#
# test of dummy table names
#

create table 1ea10 (1a20 int,1e int);
insert into 1ea10 values(1,1);
select 1ea10.1a20,1e+ 1e+10 from 1ea10;
drop table 1ea10;
create table t1 (t1.index int);
drop table t1;
# Test that we get warning for this
drop database if exists mysqltest;
create database mysqltest;
create table mysqltest.$test1 (a$1 int, $b int, c$ int);
insert into mysqltest.$test1 values (1,2,3);
select a$1, $b, c$ from mysqltest.$test1;
create table mysqltest.test2$ (a int);
drop table mysqltest.test2$;
drop database mysqltest;

--error 1103
create table `` (a int);
--error 1103
drop table if exists ``;
--error 1166
create table t1 (`` int);
--error 1280
create table t1 (i int, index `` (i)); 

#
# CREATE TABLE under LOCK TABLES
#
# We don't allow creation of non-temporary tables under LOCK TABLES
# as following meta-data locking protocol in this case can lead to
# deadlock.
create table t1 (i int);
lock tables t1 read;
--error ER_TABLE_NOT_LOCKED
create table t2 (j int);
# OTOH creating of temporary table should be OK
create temporary table t2 (j int);
drop temporary table t2;
unlock tables;
drop table t1;

#
# Test of CREATE ... SELECT with indexes
#

create table t1 (a int auto_increment not null primary key, B CHAR(20));
insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
select * from t2 where b="world";
drop table t1,t2;

#
# Test types after CREATE ... SELECT
#

create table t1(x varchar(50) );
create table t2 select x from t1 where 1=2;
describe t1;
describe t2;
drop table t2;
create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
describe t2;
drop table t2;
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29  20:45:11" AS DATETIME) as dt;
describe t2;
drop table t1,t2;

#
# Test of CREATE ... SELECT with duplicate fields
#

create table t1 (a tinyint);
create table t2 (a int) select * from t1;                        
describe t1;
describe t2;
drop table if exists t2;
--error 1060
create table t2 (a int, a float) select * from t1;               
drop table if exists t2;
--error 1060
create table t2 (a int) select a as b, a+1 as b from t1;         
drop table if exists t2;
--error 1060
create table t2 (b int) select a as b, a+1 as b from t1;         
drop table if exists t1,t2;

#
# Test CREATE ... SELECT when insert fails
#

CREATE TABLE t1 (a int not null);
INSERT INTO t1 values (1),(2),(1);
--error ER_DUP_ENTRY
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
--error 1146
SELECT * from t2;
DROP TABLE t1;
DROP TABLE IF EXISTS t2;

#
# Test of primary key with 32 index
#

create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
show create table t1;
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
drop table if exists t1;

#
# Test default table type
#
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
--error 1286
SET SESSION storage_engine="gemini";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
SET SESSION storage_engine=default;
drop table t1;


#
# ISO requires that primary keys are implicitly NOT NULL
#
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
insert into t1 values ("a", 1), ("b", 2);
--error 1048
insert into t1 values ("c", NULL);
--error 1048
insert into t1 values (NULL, 3);
--error 1048
insert into t1 values (NULL, NULL);
drop table t1;

#
# Bug # 801
#

create table t1 select x'4132';
drop table t1;

#
# bug #1434
#

create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
create table if not exists t1 select 1,2,3,4;
create table if not exists t1 select 1;
select * from t1;
drop table t1;

#
# Test create table if not exists with duplicate key error
#

flush status;
create table t1 (a int not null, b int, primary key (a));
insert into t1 values (1,1);
create table if not exists t1 select 2;
select * from t1;
create table if not exists t1 select 3 as 'a',4 as 'b';
show warnings;
show status like "Opened_tables";
select * from t1;
drop table t1;

#
# Test for Bug #2985 
#   "Table truncated when creating another table name with Spaces"
#

--error 1103
create table `t1 `(a int);
--error 1102
create database `db1 `;
--error 1166
create table t1(`a ` int);

#
# Test for Bug #3481 
#   "Parser permits multiple commas without syntax error"
#

--error 1064
create table t1 (a int,);
--error 1064
create table t1 (a int,,b int);
--error 1064
create table t1 (,b int);

#
# Test create with foreign keys
#

create table t1 (a int, key(a));
create table t2 (b int, foreign key(b) references t1(a), key(b));
drop table if exists t2,t1;

#
# Test for CREATE TABLE .. LIKE ..
#

create table t1(id int not null, name char(20));
insert into t1 values(10,'mysql'),(20,'monty- the creator');
create table t2(id int not null);
insert into t2 values(10),(20);
create table t3 like t1;
show create table t3;
select * from t3;
# Disable PS becasue of @@warning_count
create table if not exists t3 like t1;
--disable_ps_protocol
select @@warning_count;
--enable_ps_protocol
create temporary table t3 like t2;
show create table t3;
select * from t3;
drop table t3;
show create table t3;
select * from t3;
drop table t2, t3;
create database mysqltest;
create table mysqltest.t3 like t1;
create temporary table t3 like mysqltest.t3;
show create table t3;
create table t2 like t3;
show create table t2;
select * from t2;
create table t3 like t1;
--error 1050
create table t3 like mysqltest.t3;
--error 1049
create table non_existing_database.t1 like t1;
--error ER_NO_SUCH_TABLE
create table t3 like non_existing_table;
--error 1050
create temporary table t3 like t1;
drop table t1, t2, t3;
drop table t3;
drop database mysqltest;

#
# CREATE TABLE LIKE under LOCK TABLES
#
# Similarly to ordinary CREATE TABLE we don't allow creation of
# non-temporary tables under LOCK TABLES. Also we require source
# table to be locked.
create table t1 (i int);
create table t2 (j int);
lock tables t1 read;
--error ER_TABLE_NOT_LOCKED
create table t3 like t1;
# OTOH creating of temporary table should be OK
create temporary table t3 like t1;
drop temporary table t3;
# Source table should be locked
--error ER_TABLE_NOT_LOCKED
create temporary table t3 like t2;
unlock tables;
drop tables t1, t2;

#
# Test default table type
#
SET SESSION storage_engine="heap";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
drop table t1;
--error 1286
SET SESSION storage_engine="gemini";
SELECT @@storage_engine;
CREATE TABLE t1 (a int not null);
show create table t1;
SET SESSION storage_engine=default;
drop table t1;

#
# Test types of data for create select with functions
#

create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
insert into t1(a)values(1);
insert into t1(a,b,c,d,e,f,g,h)
values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data');
select * from t1;
select a, 
    ifnull(b,cast(-7 as signed)) as b, 
    ifnull(c,cast(7 as unsigned)) as c, 
    ifnull(d,cast('2000-01-01' as date)) as d, 
    ifnull(e,cast('b' as char)) as e,
    ifnull(f,cast('2000-01-01' as datetime)) as f, 
    ifnull(g,cast('5:4:3' as time)) as g,
    ifnull(h,cast('yet another binary data' as binary)) as h,
    addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd 
from t1;

create table t2
select
    a, 
    ifnull(b,cast(-7                        as signed))   as b,
    ifnull(c,cast(7                         as unsigned)) as c,
    ifnull(d,cast('2000-01-01'              as date))     as d,
    ifnull(e,cast('b'                       as char))     as e,
    ifnull(f,cast('2000-01-01'              as datetime)) as f,
    ifnull(g,cast('5:4:3'                   as time))     as g,
    ifnull(h,cast('yet another binary data' as binary))   as h,
    addtime(cast('1:0:0' as time),cast('1:0:0' as time))  as dd
from t1;
explain t2;
select * from t2;
drop table t1, t2;

create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10));
create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1;
show create table t2;
drop table t1,t2;

#
# Test of default()
#
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
insert into t1 values ('','',0,0.0);
describe t1;
create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
describe t2;
drop table t1, t2;

#
# Bug #2075
#

create table t1(name varchar(10), age smallint default -1);
describe t1;
create table t2(name varchar(10), age smallint default - 1);
describe t2;
drop table t1, t2;

#
# test for bug #1427 "enum allows duplicate values in the list"
#

create table t1(cenum enum('a'), cset set('b'));
create table t2(cenum enum('a','a'), cset set('b','b'));
create table t3(cenum enum('a','A','a','c','c'), cset set('b','B','b','d','d'));
drop table t1, t2, t3;

#
# Bug #1209
#

create database mysqltest;
use mysqltest;
select database();
drop database mysqltest;
select database();

# Connect without a database as user mysqltest_1
create user mysqltest_1;
connect (user1,localhost,mysqltest_1,,*NO-ONE*);
connection user1;
select database(), user();
connection default;
disconnect user1;
drop user mysqltest_1;
use test;

#
# Test for Bug 856 'Naming a key "Primary" causes trouble'
#

--error 1280
create table t1 (a int, index `primary` (a));
--error 1280
create table t1 (a int, index `PRIMARY` (a));

create table t1 (`primary` int, index(`primary`));
show create table t1;
create table t2 (`PRIMARY` int, index(`PRIMARY`));
show create table t2;

create table t3 (a int);
--error 1280
alter table t3 add index `primary` (a);
--error 1280
alter table t3 add index `PRIMARY` (a);

create table t4 (`primary` int);
alter table t4 add index(`primary`);
show create table t4;
create table t5 (`PRIMARY` int);
alter table t5 add index(`PRIMARY`);
show create table t5;

drop table t1, t2, t3, t4, t5;

#
# bug #3266 TEXT in CREATE TABLE SELECT
#

CREATE TABLE t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext);
INSERT INTO t1 VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL);
CREATE TABLE t2(id varchar(15) NOT NULL, proc varchar(100) NOT NULL, runID varchar(16) NOT NULL, start datetime NOT NULL, PRIMARY KEY  (id,proc,runID,start));

INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:38:40'),('5000000001', 'proc02', '20031029090650', '2003-10-29 13:38:51'),('5000000001', 'proc03', '20031029090650', '2003-10-29 13:38:11'),('5000000002', 'proc09', '20031024013310', '2003-10-24 01:33:11'),('5000000002', 'proc09', '20031024153537', '2003-10-24 15:36:04'),('5000000004', 'proc01', '20031024013641', '2003-10-24 01:37:29'),('5000000004', 'proc02', '20031024013641', '2003-10-24 01:37:39');

CREATE TABLE t3  SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns  FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id;
SELECT * FROM t3;
drop table t1, t2, t3;

#
# Bug#9666: Can't use 'DEFAULT FALSE' for column of type bool
#
create table t1 (b bool not null default false);
create table t2 (b bool not null default true);
insert into t1 values ();
insert into t2 values ();
select * from t1;
select * from t2;
drop table t1,t2;

#
# Bug#10224 - ANALYZE TABLE crashing with simultaneous
# CREATE ... SELECT statement.
# This tests two additional possible errors and a hang if 
# an improper fix is present.
#
create table t1 (a int);
--error ER_TABLE_EXISTS_ERROR
create table t1 select * from t1;
--error ER_WRONG_OBJECT
create table t2 union = (t1) select * from t1;
flush tables with read lock;
unlock tables;
drop table t1;

#
# Bug#10413: Invalid column name is not rejected
#
--error 1103
create table t1(column.name int);
--error 1103
create table t1(test.column.name int);
--error 1102
create table t1(xyz.t1.name int);
create table t1(t1.name int);
create table t2(test.t2.name int);
drop table t1,t2;

#
# Bug #12537: UNION produces longtext instead of varchar
#
CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8);
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
DESC t2;
DROP TABLE t1,t2;

#
# Bug#12913 Simple SQL can crash server or connection
#
CREATE TABLE t12913 (f1 ENUM ('a','b')) AS SELECT 'a' AS f1;
SELECT * FROM t12913;
DROP TABLE t12913;

#
# Bug#11028: Crash on create table like
#
create database mysqltest;
use mysqltest;
drop database mysqltest;
--error ER_NO_DB_ERROR 
create table test.t1 like x;
--disable_warnings
drop table if exists test.t1;
--enable_warnings

#
# Bug #6859: Bogus error message on attempt to CREATE TABLE t LIKE view
#
create database mysqltest;
use mysqltest;
# MXS: create view v1 as select 'foo' from dual;
# MXS: qc_get_table_names       : ERR: v1 != v1, dual
# MXS: qc_mysqlembedded does not consider "dual" as a table name.
--error 1347
create table t1 like v1;
drop view v1;
drop database mysqltest;
# Bug #6008 MySQL does not create warnings when
# creating database and using IF NOT EXISTS
#
create database mysqltest;
create database if not exists mysqltest character set latin2;
show create database mysqltest;
drop database mysqltest;
use test;
create table t1 (a int);
create table if not exists t1 (a int);
drop table t1;

# BUG#14139
create table t1 (
  a varchar(112) charset utf8 collate utf8_bin not null,
  primary key (a)
) select 'test' as a ;
#--warning 1364
show create table t1;
drop table t1;

#
# BUG#14480: assert failure in CREATE ... SELECT because of wrong
#            calculation of number of NULLs.
#
CREATE TABLE t2 (
  a int(11) default NULL
);
insert into t2 values(111);

#--warning 1364
create table t1 ( 
  a varchar(12) charset utf8 collate utf8_bin not null, 
  b int not null, primary key (a)
) select a, 1 as b from t2 ;
show create table t1;
drop table t1;

#--warning 1364
create table t1 ( 
  a varchar(12) charset utf8 collate utf8_bin not null, 
  b int not null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
drop table t1;

#--warning 1364
create table t1 ( 
  a varchar(12) charset utf8 collate utf8_bin not null, 
  b int null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
drop table t1;

#--warning 1364
create table t1 ( 
  a varchar(12) charset utf8 collate utf8_bin not null,
  b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
show create table t1;
drop table t1;

#--warning 1364
create table t1 ( 
  a varchar(12) charset utf8 collate utf8_bin,
  b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
show create table t1;
drop table t1, t2;

create table t1 ( 
  a1 int not null,
  a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
);
insert into t1 values (1,1,1, 1,1,1, 1,1,1);

#--warning 1364
create table t2 ( 
  a1 varchar(12) charset utf8 collate utf8_bin not null,
  a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
  primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
drop table t2;

#--warning 1364
create table t2 ( 
  a1 varchar(12) charset utf8 collate utf8_bin,
  a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1;

drop table t1, t2;
#--warning 1364
create table t1 ( 
  a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
);
insert into t1 values (1,1,1, 1,1,1, 1,1,1);

#--warning 1364
create table t2 ( 
  a1 varchar(12) charset utf8 collate utf8_bin not null,
  a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
  primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;

# Test the default value
drop table t2;

create table t2 ( a int default 3, b int default 3)
  select a1,a2 from t1;
show create table t2;

drop table t1, t2;

#
# Bug #15316 SET value having comma not correctly handled
#
--error 1367
create table t1(a set("a,b","c,d") not null);

# End of 4.1 tests


#
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
# platforms
#
create table t1 (i int) engine=myisam max_rows=100000000000;
show create table t1;
alter table t1 max_rows=100;
show create table t1;
alter table t1 max_rows=100000000000;
show create table t1;
drop table t1;


#
# Tests for errors happening at various stages of CREATE TABLES ... SELECT
#
# (Also checks that it behaves atomically in the sense that in case
#  of error it is automatically dropped if it has not existed before.)
#
# Error during open_and_lock_tables() of tables
--error ER_NO_SUCH_TABLE
create table t1 select * from t2;
# A special case which is also caught during open tables pahse
--error ER_NO_SUCH_TABLE
create table t1 select * from t1;
# Error which happens before select_create::prepare()
--error ER_CANT_AGGREGATE_2COLLATIONS
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
# Error during table creation
--error ER_KEY_COLUMN_DOES_NOT_EXITS
create table t1 (primary key(a)) select "b" as b;
# Error in select_create::prepare() which is not related to table creation
create table t1 (a int);
create table if not exists t1 select 1 as a, 2 as b;
drop table t1;
# Finally error which happens during insert
--error ER_DUP_ENTRY
create table t1 (primary key (a)) (select 1 as a) union all (select 1 as a);
# What happens if table already exists ?
create table t1 (i int);
--error ER_TABLE_EXISTS_ERROR
create table t1 select 1 as i;
create table if not exists t1 select 1 as i;
select * from t1;
# After WL#5370, it just generates a warning that the table already exists.
create table if not exists t1 select * from t1;
select * from t1;
drop table t1;
# Error before select_create::prepare()
--error ER_CANT_AGGREGATE_2COLLATIONS
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);


# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
# results of CREATE TABLE ... SELECT when temporary table exists").
# In this situation we either have to create non-temporary table and
# insert data in it or insert data in temporary table without creation of
# permanent table. After patch for Bug#47418, we create the base table and
# instert data into it, even though a temporary table exists with the same
# name.
create temporary table t1 (j int);
create table if not exists t1 select 1;
select * from t1;
drop temporary table t1;
select * from t1;
drop table t1;


#
# CREATE TABLE ... SELECT and LOCK TABLES
#
# There is little sense in using CREATE TABLE ... SELECT under
# LOCK TABLES as it mostly does not work. At least we check that
# the server doesn't crash, hang and produces sensible errors.
# Includes test for bug #20662 "Infinite loop in CREATE TABLE
# IF NOT EXISTS ... SELECT with locked tables".
create table t1 (i int);
insert into t1 values (1), (2);
lock tables t1 read;
--error ER_TABLE_NOT_LOCKED
create table t2 select * from t1;
--error ER_TABLE_NOT_LOCKED
create table if not exists t2 select * from t1;
unlock tables;
create table t2 (j int);
lock tables t1 read;
--error ER_TABLE_NOT_LOCKED
create table t2 select * from t1;
# This should not be ever allowed as it will undermine
# lock-all-at-once approach
--error ER_TABLE_NOT_LOCKED
create table if not exists t2 select * from t1;
unlock tables;
lock table t1 read, t2 read;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create table t2 select * from t1;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create table if not exists t2 select * from t1;
unlock tables;
lock table t1 read, t2 write;
--error ER_TABLE_EXISTS_ERROR
create table t2 select * from t1;
# This is the only case which really works.
create table if not exists t2 select * from t1;
select * from t1;
unlock tables;
drop table t2;

# OTOH CREATE TEMPORARY TABLE ... SELECT should work
# well under LOCK TABLES.
lock tables t1 read;
create temporary table t2 select * from t1;
create temporary table if not exists t2 select * from t1;
select * from t2;
unlock tables;
drop table t1, t2;


#
# Bug#21772: can not name a column 'upgrade' when create a table
#
create table t1 (upgrade int);
drop table t1;


--echo
--echo Bug #26104 Bug on foreign key class constructor
--echo
--echo Check that ref_columns is initalized correctly in the constructor
--echo and semantic checks in mysql_prepare_table work.
--echo
--echo We do not need a storage engine that supports foreign keys
--echo for this test, as the checks are purely syntax-based, and the
--echo syntax is supported for all engines.
--echo
--disable_warnings
drop table if exists t1,t2;
--enable_warnings

create table t1(a int not null, b int not null, primary key (a, b));
--error ER_WRONG_FK_DEF
create table t2(a int not null, b int not null, c int not null, primary key (a),
foreign key fk_bug26104 (b,c) references t1(a));
drop table t1;

#
# Bug#15130:CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
#
create table t1(f1 int,f2 int);
insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
flush status;
create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
show status like 'handler_read%';
drop table t1,t2;

#
# Bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs on table creates
#

# Show that the old syntax for index type is supported
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
DROP TABLE t1;

# Show that the new syntax for index type is supported
CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
DROP TABLE t1;

# Show that in case of multiple index type definitions, the last one takes 
# precedence

CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
SHOW INDEX FROM t1;
DROP TABLE t1;

CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
SHOW INDEX FROM t1;
DROP TABLE t1;

#
# Bug#35924 DEFINER should be stored 'quoted' in I_S
#
--error ER_UNKNOWN_ERROR
create user mysqltest_1@'test@test';

#
# Bug#38821: Assert table->auto_increment_field_not_null failed in open_table()
#
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
INSERT IGNORE INTO t1 (b) VALUES (5);

CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
  SELECT a FROM t1;
--error 1062
INSERT INTO t2 SELECT a FROM t1;
--error 1062
INSERT INTO t2 SELECT a FROM t1;

DROP TABLE t1, t2;

--echo #
--echo # BUG#46384 - mysqld segfault when trying to create table with same 
--echo #             name as existing view
--echo #

CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);

INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (1),(2),(3);

CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE v1 AS SELECT * FROM t1;

DROP VIEW v1;
DROP TABLE t1,t2;

--echo End of 5.0 tests

#
# Test of behaviour with CREATE ... SELECT
#

CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2);
--error ER_DUP_ENTRY
CREATE TABLE t2 (primary key (a)) select * from t1;
# This should give warning
drop table if exists t2;
--error ER_DUP_ENTRY
CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
# This should give warning
drop table if exists t2;
CREATE TABLE t2 (a int, b int, primary key (a));
--error ER_DUP_ENTRY
INSERT INTO t2 select * from t1;
SELECT * from t2;
TRUNCATE table t2;
--error ER_DUP_ENTRY
INSERT INTO t2 select * from t1;
SELECT * from t2;
drop table t2;

CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
--error ER_DUP_ENTRY
INSERT INTO t2 SELECT * FROM t1;
SELECT * from t2;
drop table t1,t2;


#
# Test incorrect database names
#

--error 1102
CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
--error 1102
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

# TODO: enable these tests when RENAME DATABASE is implemented.
# --error 1049
# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
# --error 1102
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
# create database mysqltest;
# --error 1102
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
# drop database mysqltest;

--error 1102
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
--error 1102
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

#
# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
#
set names utf8;

# MXS: create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
# MXS: qc_get_type              : ERR: QUERY_TYPE_WRITE != QUERY_TYPE_WRITE|QUERY_TYPE_COMMIT
# MXS: qc_get_operation         : ERR: QUERY_OP_UNDEFINED != QUERY_OP_CREATE
# MXS: qc_mysqlembedded sees the type as SQLCOM_END when figuring out the type.
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
select database();
use test;

select SCHEMA_NAME from information_schema.schemata
where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45';

drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
# MXS: create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
# MXS: (
# MXS:   имя_поля_в_кодировке_утф8_длиной_больше_чем_45 int,
# MXS:   index имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 (имя_поля_в_кодировке_утф8_длиной_больше_чем_45)
# MXS: );
# MXS: qc_get_created_table_name: ERR: Ð != имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
# MXS: qc_get_table_names       : ERR: Ð != имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48


# MXS: create view имя_вью_кодировке_утф8_длиной_больше_чем_42 as
# MXS: select имя_поля_в_кодировке_утф8_длиной_больше_чем_45
# MXS: from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
# MXS: qc_get_table_names       : ERR: Ð != имя_вью_кодировке_утф8_длиной_больше_чем_42, имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
# MXS: qc_get_affected_fields   : ERR:  != имя_поля_в_кодировке_утф8_длиной_больше_чем_45


# database, table, field, key, view
# MXS: select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
# MXS: qc_get_type              : ERR: QUERY_TYPE_WRITE != QUERY_TYPE_READ
# MXS: qc_get_operation         : ERR: QUERY_OP_UNDEFINED != QUERY_OP_SELECT
# MXS: qc_is_real_query         : ERR: 0 != 1
# MXS: qc_get_table_names       : ERR: NULL != имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48

select TABLE_NAME from information_schema.tables where
table_schema='test';

select COLUMN_NAME from information_schema.columns where
table_schema='test';

select INDEX_NAME from information_schema.statistics where
table_schema='test';

select TABLE_NAME from information_schema.views where
table_schema='test';

# MXS: show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
# MXS: qc_get_table_names       : ERR: Ð != имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
# MXS: show create view имя_вью_кодировке_утф8_длиной_больше_чем_42;
# MXS: qc_get_table_names       : ERR: Ð != имя_вью_кодировке_утф8_длиной_больше_чем_42

# MXS: create trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49
# MXS: before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
# MXS: qc_get_type              : ERR: QUERY_TYPE_WRITE != QUERY_TYPE_WRITE|QUERY_TYPE_COMMIT
# MXS: qc_get_operation         : ERR: QUERY_OP_UNDEFINED != QUERY_OP_CREATE
# MXS: qc_get_table_names       : ERR: NULL != имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48

select TRIGGER_NAME from information_schema.triggers where
trigger_schema='test';
drop trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49;
--error 1059
create trigger
очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
--error 1059
drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66;

# MXS: create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
# MXS: begin
# MXS: end;
# MXS: qc_get_type              : ERR: QUERY_TYPE_WRITE != QUERY_TYPE_WRITE|QUERY_TYPE_COMMIT
# MXS: qc_get_operation         : ERR: QUERY_OP_UNDEFINED != QUERY_OP_CREATE

select ROUTINE_NAME from information_schema.routines where
routine_schema='test';
drop procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
--error 1059
create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
begin
end;

# MXS: create function имя_функции_в_кодировке_утф8_длиной_больше_чем_49()
# MXS:   returns int
# MXS: return 0;
# MXS: qc_get_type              : ERR: QUERY_TYPE_WRITE != QUERY_TYPE_WRITE|QUERY_TYPE_COMMIT
# MXS: qc_get_operation         : ERR: QUERY_OP_UNDEFINED != QUERY_OP_CREATE

select ROUTINE_NAME from information_schema.routines where
routine_schema='test';
drop function имя_функции_в_кодировке_утф8_длиной_больше_чем_49;
--error 1059
create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
   returns int
return 0;

# MXS: drop view имя_вью_кодировке_утф8_длиной_больше_чем_42;
# MXS: qc_get_table_names       : ERR: Ð != имя_вью_кодировке_утф8_длиной_больше_чем_42
# MXS: drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
# MXS: qc_get_table_names       : ERR: Ð != имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
set names default;

#
# Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crash
#

--disable_warnings
drop table if exists t1,t2,t3;
drop function if exists f1;
--enable_warnings

--delimiter |
create function f1() returns int
begin
  declare res int;
  create temporary table t3 select 1 i;
  set res:= (select count(*) from t1);
  drop temporary table t3;
  return res;
end|
--delimiter ;
create table t1 as select 1;
create table t2 as select f1() from t1;
drop table t1,t2;
drop function f1;

#
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
#
create table t1 like information_schema.processlist;
--replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
show create table t1;
drop table t1;
create temporary table t1 like information_schema.processlist;
--replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
show create table t1;
drop table t1;
create table t1 like information_schema.character_sets;
show create table t1;
drop table t1;

###########################################################################

--echo
--echo # --
--echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
--echo # --
--echo

--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings

--echo

CREATE TABLE t1(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00');

--echo

SET sql_mode = NO_ZERO_DATE;

--echo
--error ER_INVALID_DEFAULT
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0);

--echo
--error ER_INVALID_DEFAULT
CREATE TABLE t2(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL);

--echo
--echo # -- Check that NULL column still can be created.
CREATE TABLE t2(c1 TIMESTAMP NULL);

--echo
--echo # -- Check ALTER TABLE.
--error ER_INVALID_DEFAULT
ALTER TABLE t1 ADD INDEX(c1);

--echo
--echo # -- Check DATETIME.
SET sql_mode = '';

--echo

CREATE TABLE t3(c1 DATETIME NOT NULL);
INSERT INTO t3 VALUES (0);

--echo
SET sql_mode = TRADITIONAL;

--echo
--error ER_TRUNCATED_WRONG_VALUE
ALTER TABLE t3 ADD INDEX(c1);

--echo
--echo # -- Cleanup.

SET sql_mode = '';
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;

--echo
--echo # -- End of Bug#18834.

###########################################################################

--echo
--echo # --
--echo # -- Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type.
--echo # --
--echo

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

--echo
CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0);

--echo
SHOW CREATE TABLE t1;

--echo
INSERT INTO t1 VALUES();

--echo
SELECT * FROM t1;

--echo
ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0;

--echo
SHOW CREATE TABLE t1;

--echo
INSERT INTO t1 VALUES();

--echo
SELECT * FROM t1;

--echo
DROP TABLE t1;

--echo
--echo # -- End of Bug#34274

###########################################################################

#
# Bug#40104 regression with table names?
#
create table `me:i`(id int);
drop table `me:i`;

###########################################################################

#
# Bug#45829 CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
#

--echo
--echo # --
--echo # -- Bug#45829: CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
--echo # --
--echo

--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
--echo # Fix modified for MariaDB: we support this syntax
create table t1 (a int) transactional=0;
create table t2 (a int) page_checksum=1;
create table t3 (a int) row_format=page;
drop table t1,t2,t3;
--echo
--echo # -- End of Bug#45829

#
# new table creation/renaming is NOT blocked if old encoded table present
#
let $MYSQLD_DATADIR= `select @@datadir`;
create table `#mysql50#t-1` (a int) engine=myisam;
insert into `#mysql50#t-1` values (1);
show tables;
create table `t-1` (a int);
show tables;
# selects can distinguish between the two tables
select * from `t-1`;
select * from `#mysql50#t-1`;
drop table `t-1`;
create table t1 (a int);
alter table t1 rename `t-1`;
show tables;
drop table `t-1`;
create table t1 (a int);
rename table t1 to `t-1`;
show tables;
drop table `#mysql50#t-1`, `t-1`;

--echo
--echo End of 5.1 tests


###########################################################################

--echo
--echo # --
--echo # -- Bug #43054 	Assertion `!table->auto_increment_field_not_null' 
--echo # --       failed when redefining trigger
--echo

#--disable_abort_on_error

CREATE TABLE B (
  pk INTEGER AUTO_INCREMENT,
  int_key INTEGER NOT NULL,
  PRIMARY KEY (pk),
  KEY (int_key)
);

INSERT IGNORE INTO B VALUES ('9', '9');

CREATE TABLE IF NOT EXISTS t1 ( 
  `pk` INTEGER NOT NULL AUTO_INCREMENT , 
  `int` INTEGER ,
   PRIMARY KEY ( `pk` ) 
) SELECT `pk` , `int_key` FROM B ;

--delimiter |

CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW 
BEGIN 
  INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ; 
END ; |

--delimiter ;
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
INSERT INTO t1 (pk, int_key) SELECT `pk` , `int_key` FROM B ;

--delimiter |
--error ER_TRG_ALREADY_EXISTS
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW 
BEGIN 
  UPDATE A SET `pk`=1 WHERE `pk`=0 ; 
END ;|

--error ER_NOT_SUPPORTED_YET
CREATE TRIGGER f1 BEFORE INSERT ON t1 FOR EACH ROW 
BEGIN 
  UPDATE A SET `pk`=1 WHERE `pk`=0 ; 
END ;|

--delimiter ;

DROP TABLE t1;
DROP TABLE B;

--echo #
--echo # Bug #47107 assert in notify_shared_lock on incorrect 
--echo #            CREATE TABLE , HANDLER
--echo #

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1(f1 integer);

--echo # The following CREATE TABLEs before gave an assert.

HANDLER t1 OPEN AS A;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 SELECT 1 AS f2;

HANDLER t1 OPEN AS A;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1(f1 integer);

CREATE TABLE t2(f1 integer);
HANDLER t1 OPEN AS A;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 LIKE t2;

DROP TABLE t2;
DROP TABLE t1;

--echo #
--echo # Bug #48800 CREATE TABLE t...SELECT fails if t is a 
--echo #            temporary table
--echo #

CREATE TEMPORARY TABLE t1 (a INT);
CREATE TABLE t1 (a INT);

CREATE TEMPORARY TABLE t2 (a INT);
CREATE VIEW t2 AS SELECT 1;

CREATE TABLE t3 (a INT);
CREATE TEMPORARY TABLE t3 SELECT 1; 

CREATE TEMPORARY TABLE t4 (a INT);
CREATE TABLE t4 AS SELECT 1;

DROP TEMPORARY TABLE t1, t2, t3, t4;
DROP TABLE t1, t3, t4;
DROP VIEW t2;

--echo #
--echo # Bug #49193 CREATE TABLE reacts differently depending 
--echo #            on whether data is selected or not
--echo #

CREATE TEMPORARY TABLE t2 (ID INT);
INSERT INTO t2 VALUES (1),(2),(3);

# Case 1 -- did not fail
CREATE TEMPORARY TABLE t1 (ID INT);
CREATE TABLE IF NOT EXISTS t1 (ID INT);
INSERT INTO t1 SELECT * FROM t2;
SELECT * FROM t1;
DROP TEMPORARY TABLE t1;
SELECT * FROM t1;

DROP TABLE t1;

# Case 2 -- The DROP TABLE t1 failed with 
#  Table 'test.t1' doesn't exist in the SELECT *
# as the (permanent) table was not created
CREATE TEMPORARY TABLE t1 (ID INT);
CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
SELECT * FROM t1;
DROP TEMPORARY TABLE t1;
SELECT * FROM t1;

DROP TABLE t1;

# Case 3 -- The CREATE TABLE failed with
#  Table 't1' already exists
CREATE TEMPORARY TABLE t1 (ID INT);
CREATE TABLE t1 SELECT * FROM t2;
SELECT * FROM t1;
DROP TEMPORARY TABLE t1;
SELECT * FROM t1;
 
DROP TABLE t1;
 
DROP TEMPORARY TABLE t2;


--echo # 
--echo # Bug #22909 "Using CREATE ... LIKE is possible to create field
--echo #             with invalid default value"
--echo #
--echo # Altough original bug report suggests to use older version of MySQL
--echo # for producing .FRM with invalid defaults we use sql_mode to achieve
--echo # the same effect.
--disable_warnings
drop tables if exists t1, t2;
--enable_warnings
--echo # Attempt to create table with invalid default should fail in normal mode
--error ER_INVALID_DEFAULT
create table t1 (dt datetime default '2008-02-31 00:00:00');
set @old_mode= @@sql_mode;
set @@sql_mode='ALLOW_INVALID_DATES';
--echo # The same should be possible in relaxed mode
create table t1 (dt datetime default '2008-02-31 00:00:00');
set @@sql_mode= @old_mode;
--echo # In normal mode attempt to create copy of table with invalid
--echo # default should fail
--error ER_INVALID_DEFAULT
create table t2 like t1;
set @@sql_mode='ALLOW_INVALID_DATES';
--echo # But should work in relaxed mode
create table t2 like t1;
--echo # Check that table definitions match
show create table t1;
show create table t2;
set @@sql_mode= @old_mode;
drop tables t1, t2;
#
# Bug#47132 CREATE TABLE.. SELECT.. data not inserted if table
# is view over multiple tables
#

CREATE TABLE t1 (id int);
CREATE TABLE t2 (id int);
INSERT INTO t1 VALUES (1), (1);
INSERT INTO t2 VALUES (2), (2);

CREATE VIEW v1 AS SELECT id FROM t2;
CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id as di FROM t1;
SHOW CREATE TABLE v1;
SELECT * FROM t2;
SELECT * FROM v1;
DROP VIEW v1;

CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
SELECT * FROM t2;
SELECT * FROM tt1;
DROP TEMPORARY TABLE tt1;

DROP TABLE t1, t2;


--echo #
--echo # WL#5370 "Changing 'CREATE TABLE IF NOT EXISTS ... SELECT'
--echo # behaviour.
--echo # 

--echo #
--echo # 1. Basic case: a base table.
--echo # 

create table if not exists t1 (a int) select 1 as a;
select * from t1;
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int) select 2 as a;
select * from t1;
--echo # Produces an essential warning ER_TABLE_EXISTS.
create table if not exists t1 (a int) select 2 as a;
--echo # No new data in t1.
select * from t1;
drop table t1;

--echo # 
--echo # 2. A temporary table.
--echo #

create temporary table if not exists t1 (a int) select 1 as a;
select * from t1;
--error ER_TABLE_EXISTS_ERROR
create temporary table t1 (a int) select 2 as a;
select * from t1;
--echo # An essential warning.
create temporary table if not exists t1 (a int) select 2 as a;
--echo # No new data in t1.
select * from t1;
drop temporary table t1;

--echo # 
--echo # 3. Creating a base table in presence of a temporary table.
--echo #

create table t1 (a int);
--echo # Create a view for convenience of querying t1 shadowed by a temp.
create view v1 as select a from t1;
drop table t1;
create temporary table t1 (a int) select 1 as a;
create table if not exists t1 (a int) select 2 as a;
select * from t1;
select * from v1;
--echo # Note: an essential warning.
create table if not exists t1 (a int) select 3 as a;
select * from t1;
select * from v1;
drop temporary table t1;
select * from t1;
drop view v1;
drop table t1;

--echo # 
--echo # 4. Creating a temporary table in presence of a base table.
--echo #

create table t1 (a int) select 1 as a;
create temporary table if not exists t1 select 2 as a;
select * from t1;
--echo # Note: an essential warning.
create temporary table if not exists t1 select 3 as a;
select * from t1;
drop temporary table t1;
select * from t1;
drop table t1;

--echo #
--echo # 5. Creating a base table in presence of an updatable view.
--echo # 
create table t2 (a int unique);
create view t1 as select a from t2;
insert into t1 (a) values (1);
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int);
--echo # Note: an essential warning.
create table if not exists t1 (a int);
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int) select 2 as a;
select * from t1;
--echo # Note: an essential warning.
create table if not exists t1 (a int) select 2 as a;
select * from t1;
select * from t2;
create temporary table if not exists t1 (a int) select 3 as a;
select * from t1;
select * from t2;
--echo # Note: an essential warning.
create temporary table if not exists t1 (a int) select 4 as a;
select * from t1;
select * from t2;
drop temporary table t1;

--echo #
--echo # Repeating the test with a non-updatable view.
--echo #
drop view t1;
create view t1 as select a + 5 as a from t2;
--error ER_NON_INSERTABLE_TABLE
insert into t1 (a) values (1);
--error ER_NONUPDATEABLE_COLUMN
update t1 set a=3 where a=2;

--error ER_TABLE_EXISTS_ERROR
create table t1 (a int);
--echo # Note: an essential warning.
create table if not exists t1 (a int);
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int) select 2 as a;
select * from t1;
--echo # Note: an essential warning.
create table if not exists t1 (a int) select 2 as a;
select * from t1;
select * from t2;
create temporary table if not exists t1 (a int) select 3 as a;
select * from t1;
select * from t2;
--echo # Note: an essential warning.
create temporary table if not exists t1 (a int) select 4 as a;
select * from t1;
select * from t2;
drop temporary table t1;
drop view t1;
drop table t2;

--echo #
--echo # Repeating the test with a view select a constant number
--echo #
create view t1 as select 1 as a;
--error ER_NON_INSERTABLE_TABLE
insert into t1 (a) values (1);
--error ER_NON_UPDATABLE_TABLE
update t1 set a=3 where a=2;

--error ER_TABLE_EXISTS_ERROR
create table t1 (a int);
--echo # Note: an essential warning.
create table if not exists t1 (a int);
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int) select 2 as a;
select * from t1;
--echo # Note: an essential warning.
create table if not exists t1 (a int) select 2 as a;
select * from t1;
create temporary table if not exists t1 (a int) select 3 as a;
select * from t1;
--echo # Note: an essential warning.
create temporary table if not exists t1 (a int) select 4 as a;
select * from t1;
drop temporary table t1;
drop view t1;


--echo #
--echo # 6. Test of unique_table().
--echo #

create table t1 (a int) select 1 as a;
create temporary table if not exists t1 (a int) select * from t1;
--error ER_CANT_REOPEN_TABLE
create temporary table if not exists t1 (a int) select * from t1;
select * from t1;
drop temporary table t1;
select * from t1;
drop table t1;
create temporary table t1 (a int) select 1 as a;
create table if not exists t1 (a int) select * from t1;
create table if not exists t1 (a int) select * from t1;
select * from t1;
drop temporary table t1;
select * from t1;
drop table t1;
--error ER_NO_SUCH_TABLE
create table if not exists t1 (a int) select * from t1;

--echo #
--echo # 7. Test of non-matching columns, REPLACE and IGNORE.
--echo #

create table t1 (a int) select 1 as b, 2 as c;
select * from t1;
drop table t1;
create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
select * from t1;
drop table t1;
set @@session.sql_mode='STRICT_ALL_TABLES';
--error ER_TRUNCATED_WRONG_VALUE
create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
--error ER_NO_SUCH_TABLE
select * from t1;
--error ER_TRUNCATED_WRONG_VALUE
create table if not exists t1 (a int, b date, c date) 
  replace select 1 as b, 2 as c;
--error ER_NO_SUCH_TABLE
select * from t1;

create table if not exists t1 (a int, b date, c date) 
  ignore select 1 as b, 2 as c;
select * from t1;
set @@session.sql_mode=default;
drop table t1;

create table if not exists t1 (a int unique, b int)
  replace select 1 as a, 1 as b union select 1 as a, 2 as b;
select * from t1;
drop table t1;
create table if not exists t1 (a int unique, b int)
  ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
select * from t1;
drop table t1;

--echo #
--echo # Checking that CREATE IF NOT EXISTS is not blocked by running SELECT
--echo #

create table t1 (a int, b int) engine=myisam;
create table t2 (a int, b int) engine=myisam;
insert into t1 values (1,1);
lock tables t1 read;
connect (user1,localhost,root,,test);
set @@lock_wait_timeout=5;
create table if not exists t1 (a int, b int);
create table if not exists t1 (a int, b int) select 2,2;
create table if not exists t1 like t2;
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int, b int);
--error ER_TABLE_EXISTS_ERROR
create table t1 (a int, b int) select 2,2;
--error ER_TABLE_EXISTS_ERROR
create table t1 like t2;
--error ER_LOCK_WAIT_TIMEOUT
create or replace table t1 (a int, b int) select 2,2;
disconnect user1;
connection default;
select * from t1;
unlock tables;
drop table t1,t2;

--echo #
--echo # MDEV-6179: dynamic columns functions/cast()/convert() doesn't
--echo # play nice with CREATE/ALTER TABLE
--echo #
create table t1 (
  color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent,
  cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent,
  item_name varchar(32) primary key,
  i int,
  dynamic_cols  blob
);
INSERT INTO t1(item_name, dynamic_cols, i) VALUES 
  ('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1);
INSERT INTO t1(item_name, dynamic_cols, i) VALUES
  ('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2);

select item_name, color, cl from t1;
show create table t1;

drop table t1;

create table t1 (
  n int,
  c char(32) as (convert(cast(n as char), char)) persistent
);
insert into t1(n) values (1),(2),(3);

select * from t1;
show create table t1;

drop table t1;

#
# MDEV-7050: MySQL#74603 - Assertion `comma_length > 0' failed in mysql_prepare_create_table
#
set @@session.collation_server=filename;
create table t1(a enum('',''));
drop table t1;
set @@session.collation_server=default;

--echo #
--echo # MDEV-7765: Crash (Assertion `!table || (!table->write_set ||
--echo # bitmap_is_set(table->write_set, field_index) ||
--echo # bitmap_is_set(table->vcol_set, field_index))' fails)
--echo # on using function over not created table
--echo #

DELIMITER |;
CREATE function f1() returns int
BEGIN
  declare n int;
  set n:= (select count(*) from t1);
  return n;
end|
DELIMITER ;|
-- error ER_NO_SUCH_TABLE
create table t1 as select f1();
drop function f1;

--echo End of 5.5 tests

#
# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
#
--error ER_TABLE_MUST_HAVE_COLUMNS
create table t1;
#
# Check for problems with delete
#

--disable_warnings
drop table if exists t1,t2,t3,t11,t12;
--enable_warnings
CREATE TABLE t1 (a tinyint(3), b tinyint(5));
INSERT INTO t1 VALUES (1,1);
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
INSERT INTO t1 VALUES (1,3);
DELETE from t1 where a=1 limit 1;
DELETE LOW_PRIORITY from t1 where a=1;

INSERT INTO t1 VALUES (1,1);
DELETE from t1;
LOCK TABLE t1 write;
INSERT INTO t1 VALUES (1,2);
DELETE from t1;
UNLOCK TABLES;
INSERT INTO t1 VALUES (1,2);
SET AUTOCOMMIT=0;
DELETE from t1;
SET AUTOCOMMIT=1;
drop table t1;

#
# Test of delete when the delete will cause a node to disappear and reappear
# (This assumes a block size of 1024)
#

create table t1 (
	a bigint not null,
	b bigint not null default 0,
	c bigint not null default 0,
	d bigint not null default 0,
	e bigint not null default 0,
	f bigint not null default 0,
	g bigint not null default 0,
	h bigint not null default 0,
	i bigint not null default 0,
	j bigint not null default 0,
	primary key (a,b,c,d,e,f,g,h,i,j));
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26;
drop table t1;
create table t1 (
	a bigint not null,
	b bigint not null default 0,
	c bigint not null default 0,
	d bigint not null default 0,
	e bigint not null default 0,
	f bigint not null default 0,
	g bigint not null default 0,
	h bigint not null default 0,
	i bigint not null default 0,
	j bigint not null default 0,
	primary key (a,b,c,d,e,f,g,h,i,j));
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;

CREATE TABLE `t1` (
  `i` int(10) NOT NULL default '0',
  `i2` int(10) NOT NULL default '0',
  PRIMARY KEY  (`i`)
);
-- error 1054
DELETE FROM t1 USING t1 WHERE post='1';
drop table t1;

#
# CHAR(0) bug - not actually DELETE bug, but anyway...
#

CREATE TABLE t1 (
  bool     char(0) default NULL,
  not_null varchar(20) binary NOT NULL default '',
  misc     integer not null,
  PRIMARY KEY  (not_null)
) ENGINE=MyISAM;

INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);

select * from t1 where misc > 5 and bool is null;
delete   from t1 where misc > 5 and bool is null;
select * from t1 where misc > 5 and bool is null;

select count(*) from t1;
delete from t1 where 1 > 2;
select count(*) from t1;
delete from t1 where 3 > 2;
select count(*) from t1;

drop table t1;
#
# Bug #5733: Table handler error with self-join multi-table DELETE
#

create table t1 (a int not null auto_increment primary key, b char(32));
insert into t1 (b) values ('apple'), ('apple');
select * from t1;
delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
select * from t1;
drop table t1;

#
# IGNORE option
#
create table t11 (a int NOT NULL, b int, primary key (a));
create table t12 (a int NOT NULL, b int, primary key (a));
create table t2 (a int NOT NULL, b int, primary key (a));
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(0, 11),(2, 12);
insert into t2 values (1, 21),(2, 12),(3, 23);
select * from t11;
select * from t12;
select * from t2;
-- error 1242
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
select * from t12;
delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
select * from t12;
insert into t11 values (2, 12);
-- error 1242
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
drop table t11, t12, t2;

#
# Bug #4198: deletion and KEYREAD
#

create table t1 (a int, b int, unique key (a), key (b));
insert into t1 values (3, 3), (7, 7);
delete t1 from t1 where a = 3;
check table t1;
select * from t1;
drop table t1;

#
# Bug #8392: delete with ORDER BY containing a direct reference to the table 
#
 
CREATE TABLE t1 ( a int PRIMARY KEY );
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
INSERT INTO t1 VALUES (0),(1),(2);
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
SELECT * FROM t1;
DROP TABLE t1;

#
# Bug #21392: multi-table delete with alias table name fails with 
# 1003: Incorrect table name
#

create table t1 (a int);
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
drop table t1;

#
# Bug#17711: DELETE doesn't use index when ORDER BY, LIMIT and
#            non-restricting WHERE is present.
#
create table t1(f1 int primary key);
insert into t1 values (4),(3),(1),(2);
delete from t1 where (@a:= f1) order by f1 limit 1;
select @a;
drop table t1;

# BUG#30385 "Server crash when deleting with order by and limit"
CREATE TABLE t1 (
  `date` date ,
  `time` time ,
  `seq` int(10) unsigned NOT NULL auto_increment,
  PRIMARY KEY  (`seq`),
  KEY `seq` (`seq`),
  KEY `time` (`time`),
  KEY `date` (`date`)
);
DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
drop table t1;

--echo End of 4.1 tests

#
# Test of multi-delete where we are not scanning the first table
#

CREATE TABLE t1 (a int not null,b int not null);
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
insert into t1 values (1,1),(2,1),(1,3);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(2,1),(1,3);
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
# This should be empty
select * from t3;
drop table t1,t2,t3;

#
# Bug #8143: deleting '0000-00-00' values using IS NULL
#

create table t1(a date not null);
insert into t1 values (0);
select * from t1 where a is null;
delete from t1 where a is null;
select count(*) from t1;
drop table t1;

#
# Bug #26186: delete order by, sometimes accept unknown column
#
# MXSTODO: CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1);
# MXSTODO: qc_get_table_names       : ERR: t1 != NULL
# MXSTODO: qc_sqlite does not handle multiple statements.

--error ER_BAD_FIELD_ERROR
DELETE FROM t1 ORDER BY x;

# even columns from a table not used in query (and not even existing)
--error ER_BAD_FIELD_ERROR
DELETE FROM t1 ORDER BY t2.x;

# subquery (as long as the subquery from is valid or DUAL)
--error ER_BAD_FIELD_ERROR
DELETE FROM t1 ORDER BY (SELECT x);

DROP TABLE t1;

#
# Bug #30234: Unexpected behavior using DELETE with AS and USING
# '
CREATE TABLE t1 (
  a INT
);

CREATE TABLE t2 (
  a INT
);

CREATE DATABASE db1;
CREATE TABLE db1.t1 (
  a INT
);
INSERT INTO db1.t1 (a) SELECT * FROM t1;

CREATE DATABASE db2;
CREATE TABLE db2.t1 (
  a INT
);
INSERT INTO db2.t1 (a) SELECT * FROM t2;

--error ER_PARSE_ERROR
DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
--error ER_UNKNOWN_TABLE
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
--error ER_PARSE_ERROR
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
--error ER_UNKNOWN_TABLE
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
DELETE FROM t1 USING t1 WHERE a = 1;
SELECT * FROM t1;
--error ER_PARSE_ERROR
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
SELECT * FROM t1;

DROP TABLE t1, t2;
DROP DATABASE db1;
DROP DATABASE db2;

#
# Bug 31742: delete from ... order by function call that causes an error, 
#            asserts server
#

CREATE FUNCTION f1() RETURNS INT RETURN 1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (0);
--error 1318
DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1;
DROP TABLE t1;
DROP FUNCTION f1;


--echo #
--echo # Bug #49552 : sql_buffer_result cause crash + not found records 
--echo #   in multitable delete/subquery
--echo #

CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SET SESSION SQL_BUFFER_RESULT=1;
DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1;



SET SESSION SQL_BUFFER_RESULT=DEFAULT;
SELECT * FROM t1;
DROP TABLE t1;

--echo End of 5.0 tests

#
# Bug#27525: table not found when using multi-table-deletes with aliases over
#            several databas
# Bug#21148: MULTI-DELETE fails to resolve a table by alias if it's from a
#            different database
#

--disable_warnings
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
DROP DATABASE IF EXISTS db3;
DROP DATABASE IF EXISTS db4;
DROP TABLE IF EXISTS t1, t2;
DROP PROCEDURE IF EXISTS count;
--enable_warnings
USE test;
CREATE DATABASE db1;
CREATE DATABASE db2;

CREATE TABLE db1.t1 (a INT, b INT);
INSERT INTO db1.t1 VALUES (1,1),(2,2),(3,3);
CREATE TABLE db1.t2 AS SELECT * FROM db1.t1;
CREATE TABLE db2.t1 AS SELECT * FROM db1.t2;
CREATE TABLE db2.t2 AS SELECT * FROM db2.t1;
CREATE TABLE t1 AS SELECT * FROM db2.t2;
CREATE TABLE t2 AS SELECT * FROM t1;

delimiter |;
CREATE PROCEDURE count_rows()
BEGIN
  SELECT COUNT(*) AS "COUNT(db1.t1)" FROM db1.t1;
  SELECT COUNT(*) AS "COUNT(db1.t2)" FROM db1.t2;
  SELECT COUNT(*) AS "COUNT(db2.t1)" FROM db2.t1;
  SELECT COUNT(*) AS "COUNT(db2.t2)" FROM db2.t2;
  SELECT COUNT(*) AS "COUNT(test.t1)" FROM test.t1;
  SELECT COUNT(*) AS "COUNT(test.t2)" FROM test.t2;
END|
delimiter ;|

#
# Testing without a selected database
#

CREATE DATABASE db3;
USE db3;
DROP DATABASE db3;
--error ER_NO_DB_ERROR
SELECT * FROM t1;

# Detect missing table references

--error ER_NO_DB_ERROR
DELETE a1,a2 FROM db1.t1, db2.t2;
--error ER_NO_DB_ERROR
DELETE a1,a2 FROM db1.t1, db2.t2;
--error ER_NO_DB_ERROR
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
--error ER_NO_DB_ERROR
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
--error ER_NO_DB_ERROR
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
--error ER_NO_DB_ERROR
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;

--error ER_NO_DB_ERROR
DELETE FROM a1,a2 USING db1.t1, db2.t2;
--error ER_NO_DB_ERROR
DELETE FROM a1,a2 USING db1.t1, db2.t2;
--error ER_NO_DB_ERROR
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
--error ER_NO_DB_ERROR
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
--error ER_NO_DB_ERROR
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
--error ER_NO_DB_ERROR
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;

# Ambiguous table references

--error ER_NO_DB_ERROR
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
--error ER_NO_DB_ERROR
DELETE a1 FROM db1.a1, db2.t2 AS a1;
--error ER_NO_DB_ERROR
DELETE a1 FROM a1, db1.t1 AS a1;
--error ER_NO_DB_ERROR
DELETE t1 FROM db1.t1, db2.t1 AS a1;
--error ER_NO_DB_ERROR
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
--error ER_NO_DB_ERROR
DELETE t1 FROM db1.t1, db2.t1;

# Test all again, now with a selected database

USE test;

# Detect missing table references

--error ER_UNKNOWN_TABLE
DELETE a1,a2 FROM db1.t1, db2.t2;
--error ER_UNKNOWN_TABLE
DELETE a1,a2 FROM db1.t1, db2.t2;
--error ER_UNKNOWN_TABLE
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
--error ER_UNKNOWN_TABLE
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
--error ER_NO_SUCH_TABLE
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
--error ER_NO_SUCH_TABLE
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;

--error ER_UNKNOWN_TABLE
DELETE FROM a1,a2 USING db1.t1, db2.t2;
--error ER_UNKNOWN_TABLE
DELETE FROM a1,a2 USING db1.t1, db2.t2;
--error ER_UNKNOWN_TABLE
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
--error ER_UNKNOWN_TABLE
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
--error ER_NO_SUCH_TABLE
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
--error ER_NO_SUCH_TABLE
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;

# Ambiguous table references

--error ER_NONUNIQ_TABLE
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
--error ER_NO_SUCH_TABLE
DELETE a1 FROM db1.a1, db2.t2 AS a1;
--error ER_NONUNIQ_TABLE
DELETE a1 FROM a1, db1.t1 AS a1;
--error ER_UNKNOWN_TABLE
DELETE t1 FROM db1.t1, db2.t1 AS a1;
--error ER_UNKNOWN_TABLE
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
--error ER_UNKNOWN_TABLE
DELETE t1 FROM db1.t1, db2.t1;

# Test multiple-table cross database deletes

DELETE t1 FROM db1.t2 AS t1, db2.t2 AS t2 WHERE t2.a = 1 AND t1.a = t2.a;
SELECT ROW_COUNT();
CALL count_rows();
DELETE a1, a2 FROM db2.t1 AS a1, t2 AS a2 WHERE a1.a = 2 AND a2.a = 2;
SELECT ROW_COUNT();
CALL count_rows();

DROP DATABASE db1;
DROP DATABASE db2;
DROP PROCEDURE count_rows;
DROP TABLE t1, t2;

--echo #
--echo # Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger, 
--echo # merge table
--echo #
CREATE TABLE t1 ( a INT );
CREATE TABLE t2 ( a INT );
CREATE TABLE t3 ( a INT );

INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1), (2);
INSERT INTO t3 VALUES (1), (2);

CREATE TRIGGER tr1 BEFORE DELETE ON t2
FOR EACH ROW INSERT INTO no_such_table VALUES (1);

--error ER_NO_SUCH_TABLE
DELETE t1, t2, t3 FROM t1, t2, t3;

SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;

DROP TABLE t1, t2, t3;

CREATE TABLE t1 ( a INT );
CREATE TABLE t2 ( a INT );
CREATE TABLE t3 ( a INT );

INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1), (2);
INSERT INTO t3 VALUES (1), (2);

CREATE TRIGGER tr1 AFTER DELETE ON t2
FOR EACH ROW INSERT INTO no_such_table VALUES (1);

--error ER_NO_SUCH_TABLE
DELETE t1, t2, t3 FROM t1, t2, t3;

SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;

DROP TABLE t1, t2, t3;

--echo #
--echo # Bug #46425 crash in Diagnostics_area::set_ok_status, 
--echo #            empty statement, DELETE IGNORE
--echo #

CREATE table t1 (i INTEGER);

INSERT INTO t1 VALUES (1);

--delimiter |

CREATE TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW 
BEGIN 
  INSERT INTO t1 SELECT * FROM t1 AS A;
END |

--delimiter ;
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
DELETE IGNORE FROM t1;

DROP TABLE t1;

--echo #
--echo # Bug #53450: Crash/assertion
--echo #    "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
--echo #

CREATE TABLE t1 (a INT,    b INT,    c INT,
                 INDEX(a), INDEX(b), INDEX(c));
INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);

DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;

DROP TABLE t1;

--echo #
--echo # Bug #53034: Multiple-table DELETE statements not accepting
--echo #             "Access compatibility" syntax
--echo #

CREATE TABLE t1 (id INT);
CREATE TABLE t2 LIKE t1;
CREATE TABLE t3 LIKE t1;

DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;

DROP TABLE t1, t2, t3;

--echo End of 5.1 tests


--echo #
--echo # Bug#51099 Assertion in mysql_multi_delete_prepare()
--echo #

--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP VIEW IF EXISTS v1, v2;
--enable_warnings

CREATE TABLE t1(a INT);
CREATE TABLE t2(b INT);
CREATE VIEW v1 AS SELECT a, b FROM t1, t2;
CREATE VIEW v2 AS SELECT a FROM v1;

# This is a normal delete
--error ER_VIEW_DELETE_MERGE_VIEW
DELETE FROM v2;
# This is a multi table delete, check that we get the same error
# This caused the assertion.
--error ER_VIEW_DELETE_MERGE_VIEW
DELETE v2 FROM v2;

DROP VIEW v2, v1;
DROP TABLE t1, t2;
#
# Test of refering to old values
#

--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings

create table t1 (a int not null);
insert into t1 values (1);
insert into t1 values (a+2);
insert into t1 values (a+3),(a+4);
insert into t1 values (5),(a+6);
select * from t1;
drop table t1;

#
# Test of duplicate key values with packed keys
#

create table t1 (id int not null auto_increment primary key, username varchar(32) not null, unique (username));
insert into t1 values (0,"mysql");
insert into t1 values (0,"mysql ab");
insert into t1 values (0,"mysql a");
insert into t1 values (0,"r1manic");
insert into t1 values (0,"r1man");
drop table t1;

#
# Test insert syntax
#

create table t1 (a int not null auto_increment, primary key (a), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c char(10) default "hello", i int);
insert into t1 values (default,default,default,default), (default,default,default,default), (4,0,"a",5),(default,default,default,default);
select a,t>0,c,i from t1;
truncate table t1;
insert into t1 set a=default,t=default,c=default;
insert into t1 set a=default,t=default,c=default,i=default;
insert into t1 set a=4,t=0,c="a",i=5;
insert into t1 set a=5,t=0,c="a",i=null;
insert into t1 set a=default,t=default,c=default,i=default;
select a,t>0,c,i from t1;
drop table t1;

#
# Test problem with bulk insert and auto_increment on second part keys
#

create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id));
insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL);
select * from t1;
insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL);
select * from t1;
drop table t1;

#
#Test of behaviour with INSERT VALUES (NULL)
#

create table t1 (id int NOT NULL DEFAULT 8);
-- error 1048
insert into t1 values(NULL);
insert into t1 values (1), (NULL), (2);
select * from t1;
drop table t1;

#
# Test if insert ... select distinct
#

create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
insert delayed into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
drop table t1,t2;

#
# Test of mysqld crash with fully qualified column names
#

--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
use mysqltest;
create table t1 (c int);
insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database mysqltest;
use test;

#
# Test of wrong values for float data (bug #2082)
#

# PS gives sligthly different numbers for max-float/max-double
--disable_ps_protocol
create table t1(number int auto_increment primary key, original_value varchar(50), f_double double, f_float float, f_double_7_2 double(7,2), f_float_4_3 float (4,3), f_double_u double unsigned, f_float_u float unsigned, f_double_15_1_u double(15,1) unsigned, f_float_3_1_u float (3,1) unsigned);

set @value= "aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

set @value= "1aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

set @value= "aa1";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

--error 1367
set @value= 1e+1111111111;
--error 1367
set @value= -1e+1111111111;


set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

set @value= -1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

set @value= 1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

set @value= -1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()

drop table t1;
--enable_ps_protocol

# End of 4.1 tests

#
# Test automatic result buffering with INSERT INTO t1 ... SELECT ... FROM t1
#

create table t1(id1 int not null auto_increment primary key, t char(12));
create table t2(id2 int not null, t char(12));
create table t3(id3 int not null, t char(12), index(id3));
--disable_query_log
begin;
let $1 = 100;
while ($1)
 {
  let $2 = 5;
  eval insert into t1(t) values ('$1'); 
  while ($2)
   {
     eval insert into t2(id2,t) values ($1,'$2'); 
     let $3 = 10;
     while ($3)
     {
       eval insert into t3(id3,t) values ($1,'$2'); 
       dec $3;
     }
     dec $2; 
   }
  dec $1;
 }
commit;
--enable_query_log

select count(*) from t2;
insert into  t2 select t1.* from t1, t2 t, t3 where  t1.id1 = t.id2 and t.id2 = t3.id3;
select count(*) from t2;
drop table t1,t2,t3;

#
# Test different cases of duplicate fields
#

create table t1 (a int, b int);
insert into t1 (a,b) values (a,b);
insert into t1 SET a=1, b=a+1;
insert into t1 (a,b) select 1,2;
INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
prepare stmt1 from ' replace into t1 (a,a) select 100, ''hundred'' ';
--error 1110
execute stmt1;
--error 1110
insert into t1 (a,b,b) values (1,1,1);
--error 1136
insert into t1 (a,a) values (1,1,1);
--error 1110
insert into t1 (a,a) values (1,1);
--error 1110
insert into t1 SET a=1,b=2,a=1;
--error 1110
insert into t1 (b,b) select 1,2;
--error 1110
INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
drop table t1;

#
# Test for values returned by ROW_COUNT() function
# (and thus for values returned by mysql_affected_rows())
# for various forms of INSERT
#
create table t1 (id int primary key, data int);
insert into t1 values (1, 1), (2, 2), (3, 3);
select row_count();
insert ignore into t1 values (1, 1);
select row_count();
# Reports that 2 rows are affected (1 deleted + 1 inserted)
replace into t1 values (1, 11);
select row_count();
replace into t1 values (4, 4);
select row_count();
# Reports that 2 rows are affected. This conforms to documentation.
# (Useful for differentiating inserts from updates).
# MXSTODO: insert into t1 values (2, 2) on duplicate key update data= data + 10;
# qc_sqlite: Cannot parse "on duplicate"
select row_count();
# MXSTODO: insert into t1 values (5, 5) on duplicate key update data= data + 10;
# qc_sqlite: Cannot parse "on duplicate"
select row_count();
drop table t1;

#
# Bug#25123: ON DUPLICATE KEY clause allows fields not from the insert table
#
create table t1 (f1 int unique, f2 int);
create table t2 (f3 int, f4 int);
create view v1 as select * from t1, t2 where f1= f3;
insert into t1 values (1,11), (2,22);
insert into t2 values (1,12), (2,24);
--error 1393
insert into v1 (f1) values (3) on duplicate key update f3= f3 + 10;
--error 1393
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
select * from t1;
--error 1393
insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
select * from t1;
drop view v1;
drop table t1,t2;

# Test of INSERT IGNORE and re-using auto_increment values
create table t1 (id int primary key auto_increment, data int, unique(data));
insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
select * from t1 order by id;

drop table t1;

#
# BUG#21483: Server abort or deadlock on INSERT DELAYED with another
# implicit insert 
#
# The solution is to downgrade INSERT DELAYED to normal INSERT if the
# statement uses functions and access tables or triggers, or is called
# from a function or a trigger.
#
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
DROP FUNCTION IF EXISTS f2;
--enable_warnings

CREATE TABLE t1 (i INT);
delimiter |;
CREATE FUNCTION f1() RETURNS INT
BEGIN
  INSERT INTO t1 VALUES (1);
  RETURN 1;
END |
CREATE FUNCTION f2() RETURNS INT
BEGIN
  INSERT DELAYED INTO t1 VALUES (2);
  RETURN 1;
END |
delimiter ;|

SELECT f1();
SELECT f2();
INSERT INTO t1 VALUES (3);
INSERT DELAYED INTO t1 VALUES (4);

--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
INSERT INTO t1 VALUES (f1());

--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
INSERT DELAYED INTO t1 VALUES (f1());

--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
INSERT INTO t1 VALUES (f2());

--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
INSERT DELAYED INTO t1 VALUES (f2());

CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
  INSERT INTO t1 VALUES (NEW.i);

--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
INSERT INTO t1 VALUES (1);

--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
INSERT DELAYED INTO t1 VALUES (1);

SELECT * FROM t1;

DROP FUNCTION f2;
DROP FUNCTION f1;
DROP TABLE t1;

#
# BUG#20497: Trigger with INSERT DELAYED causes Error 1165
#
# Fixed by the patch for Bug#21483
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings

CREATE TABLE t1 (i INT);
CREATE TABLE t2 (i INT);

CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
  INSERT DELAYED INTO t2 VALUES (NEW.i);

CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
  INSERT DELAYED INTO t2 VALUES (NEW.i);

CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW
  INSERT DELAYED INTO t2 VALUES (OLD.i);

INSERT INTO t1 VALUES (1);
INSERT DELAYED INTO t1 VALUES (2);
SELECT * FROM t1;
UPDATE t1 SET i = 3 WHERE i = 1;
SELECT * FROM t1;
DELETE FROM t1 WHERE i = 3;
SELECT * FROM t1;
SELECT * FROM t2;

DROP TABLE t1, t2;

#
# BUG#21714: Wrong NEW.value and server abort on INSERT DELAYED to a
# table with a trigger 
#
# Fixed by the patch for Bug#21483
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings

CREATE TABLE t1 (i INT);
CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
  SET @a= NEW.i;

SET @a= 0;
INSERT DELAYED INTO t1 VALUES (1);
SELECT @a;
INSERT DELAYED INTO t1 VALUES (2);
SELECT @a;

DROP TABLE t1;

CREATE TABLE t1 (i INT);
CREATE TABLE t2 (i INT);

CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
  INSERT INTO t2 VALUES (NEW.i);

CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW
  INSERT DELAYED INTO t2 VALUES (NEW.i);

CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW
  INSERT DELAYED INTO t2 VALUES (OLD.i);

INSERT DELAYED INTO t1 VALUES (1);
SELECT * FROM t1;
UPDATE t1 SET i = 2 WHERE i = 1;
SELECT * FROM t1;
DELETE FROM t1 WHERE i = 2;
SELECT * FROM t1;
SELECT * FROM t2;

DROP TABLE t1, t2;

#
# Bug #26788: mysqld (debug) aborts when inserting specific numbers into char
#             fields
#

CREATE TABLE t1 (
  a char(20) NOT NULL,
  b char(7) DEFAULT NULL,
  c char(4) DEFAULT NULL
);

INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
SELECT * FROM t1;

DROP TABLE t1;

CREATE TABLE t1 (
  a char(20) NOT NULL,
  b char(7) DEFAULT NULL,
  c char(5)
);


INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);

SELECT * FROM t1;

DROP TABLE t1;

#
# Bug #31152: assertion in Field_str::store(double)
#

CREATE TABLE t (a CHAR(10),b INT);
INSERT INTO t VALUES (),(),();
INSERT INTO t(a) SELECT rand() FROM t;
DROP TABLE t;

#
# Bug #30453: String not cast to int correctly
#

CREATE TABLE t1 (c1 INT NOT NULL);
INSERT INTO t1 VALUES(4188.32999999999992724042385816574096679687500),
('4188.32999999999992724042385816574096679687500'), (4188);
SELECT * FROM t1;

CREATE TABLE t2 (c1 BIGINT);
INSERT INTO t2 VALUES('15449237462.0000000000');
SELECT * FROM t2;

DROP TABLE t1, t2;

#
# Bug#43833 Simple INSERT crashes the server
#
CREATE TABLE t1(f1 FLOAT);
INSERT INTO t1 VALUES (1.23);
CREATE TABLE t2(f1 CHAR(1));
INSERT INTO t2 SELECT f1 FROM t1;
DROP TABLE t1, t2;

--echo End of 5.0 tests.

--echo #
--echo # Bug#34898 "mysql_info() reports 0 warnings while
--echo # mysql_warning_count() reports 1"
--echo # Check that the number of warnings reported by
--echo # mysql_info() is correct.
--echo #

--disable_warnings
drop table if exists t1;
--enable_warnings

create table t1 (data varchar(4) not null);

set sql_mode='error_for_division_by_zero';
--echo #
--echo # Demonstrate that the number of warnings matches
--echo # the information in mysql_info().
--echo #
--enable_info
insert t1 (data) values ('letter'), (1/0);
--disable_ps_protocol
update t1 set data='envelope' where 1/0 or 1;
--enable_ps_protocol
insert t1 (data) values (default), (1/0), ('dead beef');
--disable_info

set sql_mode=default;
drop table t1;

--echo #
--echo # End of 5.4 tests
--echo #

--echo #
--echo # Bug#54106 assert in Protocol::end_statement,
--echo #           INSERT IGNORE ... SELECT ... UNION SELECT ...
--echo #

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (a INT);

--error ER_FIELD_SPECIFIED_TWICE
INSERT INTO t1 (a, a) VALUES (1, 1);
# Verify that ER_FIELD_SPECIFIED_TWICE is not ignorable
--error ER_FIELD_SPECIFIED_TWICE
INSERT IGNORE t1 (a, a) VALUES (1, 1);

--error ER_FIELD_SPECIFIED_TWICE
INSERT IGNORE t1 (a, a) SELECT 1,1;
# Used to cause an assert
--error ER_FIELD_SPECIFIED_TWICE
INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2;

DROP TABLE t1;

--echo #
--echo # MDEV-5168: Ensure that we can disable duplicate key warnings
--echo # from INSERT IGNORE
--echo #

create table t1 (f1 int unique, f2 int unique);
insert into t1 values (1,12);
insert into t1 values (2,13);
--error ER_DUP_ENTRY
insert into t1 values (1,12);
insert ignore into t1 values (1,12);
set @@old_mode="NO_DUP_KEY_WARNINGS_WITH_IGNORE";
insert ignore into t1 values (1,12);
insert ignore into t1 values (1,12) on duplicate key update f2=13;
set @@old_mode="";
insert ignore into t1 values (1,12);
DROP TABLE t1;
#
# Initialization
--disable_warnings
drop table if exists t1,t2,t3;
drop view if exists v1,v2;
--enable_warnings

SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';

#
# Test different join syntaxes
#

CREATE TABLE t1 (S1 INT);
CREATE TABLE t2 (S1 INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t1 JOIN t2;
SELECT * FROM t1 INNER JOIN t2;
SELECT * from t1 JOIN t2 USING (S1);
SELECT * FROM t1 INNER JOIN t2 USING (S1);
SELECT * from t1 CROSS JOIN t2;
SELECT * from t1 LEFT JOIN t2 USING(S1);
SELECT * from t1 LEFT JOIN t2 ON(t2.S1=2);
SELECT * from t1 RIGHT JOIN t2 USING(S1);
SELECT * from t1 RIGHT JOIN t2 ON(t1.S1=1);
drop table t1,t2;

#
# This failed for lia Perminov
#

create table t1 (id int primary key);
create table t2 (id int);
insert into t1 values (75);
insert into t1 values (79);
insert into t1 values (78);
insert into t1 values (77);
replace into t1 values (76);
replace into t1 values (76);
insert into t1 values (104);
insert into t1 values (103);
insert into t1 values (102);
insert into t1 values (101);
insert into t1 values (105);
insert into t1 values (106);
insert into t1 values (107);

insert into t2 values (107),(75),(1000);

select t1.id, t2.id from t1, t2 where t2.id = t1.id;
select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t1.id;
select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t2.id;

#
# Test problems with impossible ON or WHERE
#
select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0;
drop table t1,t2;

#
# problem with join
#

CREATE TABLE t1 (
  id int(11) NOT NULL auto_increment,
  token varchar(100) DEFAULT '' NOT NULL,
  count int(11) DEFAULT '0' NOT NULL,
  qty int(11),
  phone char(1) DEFAULT '' NOT NULL,
  timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  PRIMARY KEY (id),
  KEY token (token(15)),
  KEY timestamp (timestamp),
  UNIQUE token_2 (token(75),count,phone)
);

INSERT INTO t1 VALUES (21,'e45703b64de71482360de8fec94c3ade',3,7800,'n','1999-12-23 17:22:21');
INSERT INTO t1 VALUES (22,'e45703b64de71482360de8fec94c3ade',4,5000,'y','1999-12-23 17:22:21');
INSERT INTO t1 VALUES (18,'346d1cb63c89285b2351f0ca4de40eda',3,13200,'b','1999-12-23 11:58:04');
INSERT INTO t1 VALUES (17,'ca6ddeb689e1b48a04146b1b5b6f936a',4,15000,'b','1999-12-23 11:36:53');
INSERT INTO t1 VALUES (16,'ca6ddeb689e1b48a04146b1b5b6f936a',3,13200,'b','1999-12-23 11:36:53');
INSERT INTO t1 VALUES (26,'a71250b7ed780f6ef3185bfffe027983',5,1500,'b','1999-12-27 09:44:24');
INSERT INTO t1 VALUES (24,'4d75906f3c37ecff478a1eb56637aa09',3,5400,'y','1999-12-23 17:29:12');
INSERT INTO t1 VALUES (25,'4d75906f3c37ecff478a1eb56637aa09',4,6500,'y','1999-12-23 17:29:12');
INSERT INTO t1 VALUES (27,'a71250b7ed780f6ef3185bfffe027983',3,6200,'b','1999-12-27 09:44:24');
INSERT INTO t1 VALUES (28,'a71250b7ed780f6ef3185bfffe027983',3,5400,'y','1999-12-27 09:44:36');
INSERT INTO t1 VALUES (29,'a71250b7ed780f6ef3185bfffe027983',4,17700,'b','1999-12-27 09:45:05');

CREATE TABLE t2 (
  id int(11) NOT NULL auto_increment,
  category int(11) DEFAULT '0' NOT NULL,
  county int(11) DEFAULT '0' NOT NULL,
  state int(11) DEFAULT '0' NOT NULL,
  phones int(11) DEFAULT '0' NOT NULL,
  nophones int(11) DEFAULT '0' NOT NULL,
  PRIMARY KEY (id),
  KEY category (category,county,state)
);
INSERT INTO t2 VALUES (3,2,11,12,5400,7800);
INSERT INTO t2 VALUES (4,2,25,12,6500,11200);
INSERT INTO t2 VALUES (5,1,37,6,10000,12000);
select a.id, b.category as catid, b.state as stateid, b.county as countyid from t1 a, t2 b ignore index (primary) where (a.token ='a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id);
select a.id, b.category as catid, b.state as stateid, b.county as
countyid from t1 a, t2 b where (a.token =
'a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id) order by a.id;

drop table t1, t2;

#
# Test of join of many tables.

create table t1 (a int primary key);
insert into t1 values(1),(2);
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
--replace_result "31 tables" "XX tables" "61 tables" "XX tables"
--error 1116
select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
--replace_result "31 tables" "XX tables" "61 tables" "XX tables"
--error 1116
select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
drop table t1;

#
# Simple join test. This failed in 3.23.42, there should have been
# no matches, still three matches were found.
#
 
CREATE TABLE t1 (
  a int(11) NOT NULL,
  b int(11) NOT NULL,
  PRIMARY KEY  (a,b)
) ENGINE=MyISAM;
 
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3);
 
CREATE TABLE t2 (
  a int(11) default NULL
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2),(3);
SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3;
DROP TABLE t1, t2;

#
# TEST LEFT JOIN with DATE columns
#

CREATE TABLE t1 (d DATE NOT NULL);
CREATE TABLE t2 (d DATE NOT NULL);
INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE d IS NULL;
SELECT * from t1 WHERE t1.d IS NULL;
SELECT * FROM t1 WHERE 1/0 IS NULL;
DROP TABLE t1,t2;

#
# Problem with reference from const tables
#
CREATE TABLE t1 (
  Document_ID varchar(50) NOT NULL default '',
  Contractor_ID varchar(6) NOT NULL default '',
  Language_ID char(3) NOT NULL default '',
  Expiration_Date datetime default NULL,
  Publishing_Date datetime default NULL,
  Title text,
  Column_ID varchar(50) NOT NULL default '',
  PRIMARY KEY  (Language_ID,Document_ID,Contractor_ID)
);

INSERT INTO t1 VALUES ('xep80','1','ger','2001-12-31 20:00:00','2001-11-12 10:58:00','Kartenbestellung - jetzt auch online','anle'),('','999998','',NULL,NULL,NULL,'');

CREATE TABLE t2 (
  Contractor_ID char(6) NOT NULL default '',
  Language_ID char(3) NOT NULL default '',
  Document_ID char(50) NOT NULL default '',
  CanRead char(1) default NULL,
  Customer_ID int(11) NOT NULL default '0',
  PRIMARY KEY  (Contractor_ID,Language_ID,Document_ID,Customer_ID)
);

INSERT INTO t2 VALUES ('5','ger','xep80','1',999999),('1','ger','xep80','1',999999);
CREATE TABLE t3 (
  Language_ID char(3) NOT NULL default '',
  Column_ID char(50) NOT NULL default '',
  Contractor_ID char(6) NOT NULL default '',
  CanRead char(1) default NULL,
  Active char(1) default NULL,
  PRIMARY KEY  (Language_ID,Column_ID,Contractor_ID)
);
INSERT INTO t3 VALUES ('ger','home','1','1','1'),('ger','Test','1','0','0'),('ger','derclu','1','0','0'),('ger','clubne','1','0','0'),('ger','philos','1','0','0'),('ger','clubko','1','0','0'),('ger','clubim','1','1','1'),('ger','progra','1','0','0'),('ger','progvo','1','0','0'),('ger','progsp','1','0','0'),('ger','progau','1','0','0'),('ger','progku','1','0','0'),('ger','progss','1','0','0'),('ger','nachl','1','0','0'),('ger','mitgli','1','0','0'),('ger','mitsu','1','0','0'),('ger','mitbus','1','0','0'),('ger','ergmar','1','1','1'),('ger','home','4','1','1'),('ger','derclu','4','1','1'),('ger','clubne','4','0','0'),('ger','philos','4','1','1'),('ger','clubko','4','1','1'),('ger','clubim','4','1','1'),('ger','progra','4','1','1'),('ger','progvo','4','1','1'),('ger','progsp','4','1','1'),('ger','progau','4','0','0'),('ger','progku','4','1','1'),('ger','progss','4','1','1'),('ger','nachl','4','1','1'),('ger','mitgli','4','0','0'),('ger','mitsu','4','0','0'),('ger','mitbus','4','0','0'),('ger','ergmar','4','1','1'),('ger','progra2','1','0','0'),('ger','archiv','4','1','1'),('ger','anmeld','4','1','1'),('ger','thema','4','1','1'),('ger','edito','4','1','1'),('ger','madis','4','1','1'),('ger','enma','4','1','1'),('ger','madis','1','1','1'),('ger','enma','1','1','1'),('ger','vorsch','4','0','0'),('ger','veranst','4','0','0'),('ger','anle','4','1','1'),('ger','redak','4','1','1'),('ger','nele','4','1','1'),('ger','aukt','4','1','1'),('ger','callcenter','4','1','1'),('ger','anle','1','0','0');
delete from t1 where Contractor_ID='999998';
insert into t1 (Contractor_ID) Values ('999998');
SELECT DISTINCT COUNT(t1.Title) FROM t1,
t2, t3 WHERE 
t1.Document_ID='xep80' AND t1.Contractor_ID='1' AND 
t1.Language_ID='ger' AND '2001-12-21 23:14:24' >= 
Publishing_Date AND '2001-12-21 23:14:24' <= Expiration_Date AND 
t1.Document_ID = t2.Document_ID AND 
t1.Language_ID = t2.Language_ID AND 
t1.Contractor_ID = t2.Contractor_ID AND ( 
t2.Customer_ID = '4'  OR 
t2.Customer_ID = '999999'  OR 
t2.Customer_ID = '1' )AND t2.CanRead 
= '1'  AND t1.Column_ID=t3.Column_ID AND 
t1.Language_ID=t3.Language_ID AND ( 
t3.Contractor_ID = '4'  OR 
t3.Contractor_ID = '999999'  OR 
t3.Contractor_ID = '1') AND 
t3.CanRead='1' AND t3.Active='1';
SELECT DISTINCT COUNT(t1.Title) FROM t1,
t2, t3 WHERE 
t1.Document_ID='xep80' AND t1.Contractor_ID='1' AND 
t1.Language_ID='ger' AND '2001-12-21 23:14:24' >= 
Publishing_Date AND '2001-12-21 23:14:24' <= Expiration_Date AND 
t1.Document_ID = t2.Document_ID AND 
t1.Language_ID = t2.Language_ID AND 
t1.Contractor_ID = t2.Contractor_ID AND ( 
t2.Customer_ID = '4'  OR 
t2.Customer_ID = '999999'  OR 
t2.Customer_ID = '1' )AND t2.CanRead 
= '1'  AND t1.Column_ID=t3.Column_ID AND 
t1.Language_ID=t3.Language_ID AND ( 
t3.Contractor_ID = '4'  OR 
t3.Contractor_ID = '999999'  OR 
t3.Contractor_ID = '1') AND 
t3.CanRead='1' AND t3.Active='1';
drop table t1,t2,t3;

#
# Bug when doing full join and NULL fields.
#

CREATE TABLE t1 (
  t1_id int(11) default NULL,
  t2_id int(11) default NULL,
  type enum('Cost','Percent') default NULL,
  cost_unit enum('Cost','Unit') default NULL,
  min_value double default NULL,
  max_value double default NULL,
  t3_id int(11) default NULL,
  item_id int(11) default NULL
) ENGINE=MyISAM;
INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1);
CREATE TABLE t2 (
  id int(10) unsigned NOT NULL auto_increment,
  name varchar(255) default NULL,
  PRIMARY KEY  (id)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5');
select t1.*, t2.*  from t1, t2 where t2.id=t1.t2_id limit 2;
drop table t1,t2;

#
# Bug in range optimiser with MAYBE_KEY
#

CREATE TABLE t1 (
  siteid varchar(25) NOT NULL default '',
  emp_id varchar(30) NOT NULL default '',
  rate_code varchar(10) default NULL,
  UNIQUE KEY site_emp (siteid,emp_id),
  KEY siteid (siteid)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust');
CREATE TABLE t2 (
  siteid varchar(25) NOT NULL default '',
  rate_code varchar(10) NOT NULL default '',
  base_rate float NOT NULL default '0',
  PRIMARY KEY  (siteid,rate_code),
  FULLTEXT KEY rate_code (rate_code)
) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('rivercats','cust',20);
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
SELECT rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND siteid = 'rivercats';
SELECT rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE siteid = 'rivercats' AND emp.emp_id = 'psmith';
drop table t1,t2;

#
# Problem with internal list handling when reducing WHERE
#

CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, Value1 VARCHAR(255));
CREATE TABLE t2 (ID INTEGER NOT NULL PRIMARY KEY, Value2 VARCHAR(255));
INSERT INTO t1 VALUES (1, 'A');
INSERT INTO t2 VALUES (1, 'B');

SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND (Value1 = 'A' AND Value2 <> 'B');
SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND Value1 = 'A' AND Value2 <> 'B';
SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
drop table t1,t2;

#
# dummy natural join (no common columns) Bug #4807
#

CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
CREATE TABLE t3 (c int);
SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
DROP TABLE t1, t2, t3;

#
# Test combination of join methods
#

create table t1 (i int);
create table t2 (i int);
create table t3 (i int);
insert into t1 values(1),(2);
insert into t2 values(2),(3);
insert into t3 values (2),(4);

select * from t1 natural left join t2;
select * from t1 left join t2 on (t1.i=t2.i);
select * from t1 natural left join t2 natural left join t3;
select * from t1 left join t2 on (t1.i=t2.i) left join t3 on (t2.i=t3.i);

select * from t3 natural right join t2;
select * from t3 right join t2 on (t3.i=t2.i);
select * from t3 natural right join t2 natural right join t1;
select * from t3 right join t2 on (t3.i=t2.i) right join t1 on (t2.i=t1.i);

select * from t1,t2 natural left join t3 order by t1.i,t2.i,t3.i;
select * from t1,t2 left join t3 on (t2.i=t3.i) order by t1.i,t2.i,t3.i;
select t1.i,t2.i,t3.i from t2 natural left join t3,t1 order by t1.i,t2.i,t3.i;
select t1.i,t2.i,t3.i from t2 left join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;

select * from t1,t2 natural right join t3 order by t1.i,t2.i,t3.i;
select * from t1,t2 right join t3 on (t2.i=t3.i) order by t1.i,t2.i,t3.i;
select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
drop table t1,t2,t3;

#
# Bug #27531: Query performance degredation in 4.1.22 and greater
#
CREATE TABLE t1 (a int, b int default 0, c int default 1);

INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
INSERT INTO t1 (a) SELECT a + 8 FROM t1;
INSERT INTO t1 (a) SELECT a + 16 FROM t1;

CREATE TABLE t2 (a int, d int, e int default 0);

INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4);
INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2;
INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2;

# should use join cache
EXPLAIN
SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
  ORDER BY t1.b, t1.c;
SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
  ORDER BY t1.b, t1.c;

DROP TABLE t1,t2;

# End of 4.1 tests

#
#  Tests for WL#2486 Natural/using join according to SQL:2003.
#
#  NOTICE:
#  - The tests are designed so that all statements, except MySQL
#    extensions run on any SQL server. Please do no change.
#  - Tests marked with TODO will be submitted as bugs.
#

create table t1 (c int, b int);
create table t2 (a int, b int);
create table t3 (b int, c int);
create table t4 (y int, c int);
create table t5 (y int, z int);
create table t6 (a int, c int);

insert into t1 values (10,1);
insert into t1 values (3 ,1);
insert into t1 values (3 ,2);
insert into t2 values (2, 1);
insert into t3 values (1, 3);
insert into t3 values (1,10);
insert into t4 values (11,3);
insert into t4 values (2, 3);
insert into t5 values (11,4);
insert into t6 values (2, 3);

# Views with simple natural join.
create algorithm=merge view v1a as
select * from t1 natural join t2;
# as above, but column names are cross-renamed: a->c, c->b, b->a
create algorithm=merge view v1b(a,b,c) as
select * from t1 natural join t2;
# as above, but column names are aliased: a->c, c->b, b->a
create algorithm=merge view v1c as
select b as a, c as b, a as c from t1 natural join t2;
#  as above, but column names are cross-renamed, and aliased
#  a->c->b, c->b->a, b->a->c
create algorithm=merge view v1d(b, a, c) as
select a as c, c as b, b as a from t1 natural join t2;

# Views with JOIN ... ON
create algorithm=merge view v2a as
select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
create algorithm=merge view v2b as
select t1.c as b, t1.b as a, t2.a as c
from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;

# Views with bigger natural join
create algorithm=merge view v3a as
select * from t1 natural join t2 natural join t3;
create algorithm=merge view v3b as
select * from t1 natural join (t2 natural join t3);

# View over views with mixed natural join and join ... on
create algorithm=merge view v4 as
select * from v2a natural join v3a;

# Nested natural/using joins.
select * from (t1 natural join t2) natural join (t3 natural join t4);
select * from (t1 natural join t2) natural left join (t3 natural join t4);
select * from (t3 natural join t4) natural right join (t1 natural join t2);
select * from (t1 natural left join t2) natural left join (t3 natural left join t4);
select * from (t4 natural right join t3) natural right join (t2 natural right join t1);
select * from t1 natural join t2 natural join t3 natural join t4;
select * from ((t1 natural join t2) natural join t3) natural join t4;
select * from t1 natural join (t2 natural join (t3 natural join t4));
# BUG#15355: this query fails in 'prepared statements' mode
# select * from ((t3 natural join (t1 natural join t2)) natural join t4) natural join t5;
# select * from ((t3 natural left join (t1 natural left join t2)) natural left join t4) natural left join t5;
select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3));
select * from (t1 natural join t2), (t3 natural join t4);
# MySQL extension - nested comma ',' operator instead of cross join.
select * from t5 natural join ((t1 natural join t2), (t3 natural join t4));
select * from  ((t1 natural join t2),  (t3 natural join t4)) natural join t5;
select * from t5 natural join ((t1 natural join t2) cross join (t3 natural join t4));
select * from  ((t1 natural join t2) cross join (t3 natural join t4)) natural join t5;

select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c);
select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c));


# Other clauses refer to NJ columns.
select a,b,c from (t1 natural join t2) natural join (t3 natural join t4)
where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a;
select * from (t1 natural join t2) natural left join (t3 natural join t4)
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
select * from (t3 natural join t4) natural right join (t1 natural join t2)
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;

# Qualified column references to NJ columns.
select * from t1 natural join t2 where t1.c > t2.a;
select * from t1 natural join t2 where t1.b > t2.b;
select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL;

# Nested 'join ... on' - name resolution of ON conditions
select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c;
select * from t1 natural join (t2 join t4 on b + 1 = y);
select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c);

# MySQL extension - 'join ... on' over nested comma operator
select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c);
select * from (t1 natural join t2) join (t3 natural join t4) on a = y;
select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3;

# MySQL extension - refererence qualified coalesced columns
select * from t1 natural join t2 where t1.b > 0;
select * from t1 natural join (t4 natural join t5) where t4.y > 7;
select * from (t4 natural join t5) natural join t1 where t4.y > 7;
select * from t1 natural left join (t4 natural join t5) where t4.y > 7;
select * from (t4 natural join t5) natural right join t1 where t4.y > 7;
select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b;

# MySQL extension - select qualified columns of NJ columns
select t1.*, t2.* from t1 natural join t2;
select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4);

# Queries over subselects in the FROM clause
select * from (select * from t1 natural join t2) as t12
              natural join
              (select * from t3 natural join t4) as t34;
select * from (select * from t1 natural join t2) as t12
              natural left join
              (select * from t3 natural join t4) as t34;
select * from (select * from t3 natural join t4) as t34
              natural right join
              (select * from t1 natural join t2) as t12;

# Queries over views
select * from v1a;
select * from v1b;
select * from v1c;
select * from v1d;
select * from v2a;
select * from v2b;
select * from v3a;
select * from v3b;
select * from v4;
select * from v1a natural join v2a;
select v2a.* from v1a natural join v2a;
select * from v1b join v2a on v1b.b = v2a.c;
select * from v1c join v2a on v1c.b = v2a.c;
select * from v1d join v2a on v1d.a = v2a.c;
select * from v1a join (t3 natural join t4) on a = y;

# TODO: add tests with correlated subqueries for natural join/join on.
# related to BUG#15269


#--------------------------------------------------------------------
# Negative tests (tests for errors)
#--------------------------------------------------------------------
# works in Oracle - bug
-- error 1052
select * from t1 natural join (t3 cross join t4);
# works in Oracle - bug
-- error 1052
select * from (t3 cross join t4) natural join t1;
-- error 1052
select * from t1 join (t2, t3) using (b);
-- error 1052
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
-- error 1052
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
-- error 1052
select * from t6 natural join ((t1 natural join t2),  (t3 natural join t4));
-- error 1052
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
-- error 1052
select * from  (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
# this one is OK, the next equivalent one is incorrect (bug in Oracle)
-- error 1052
select * from (t3 join (t4 natural join t5) on (b < z))
              natural join
              (t1 natural join t2);
-- error 1052
select * from (t1 natural join t2) natural join (t3 join (t4 natural join t5) on (b < z));

-- error 1054
select t1.b from v1a;
-- error 1054
select * from v1a join v1b on t1.b = t2.b;

#
# Bug #17523 natural join and information_schema
#
# Omit columns.PRIVILIGES as it may vary with embedded server.
# Omit columns.ORDINAL_POSITION and statistics.CARDINALITY as it may vary with hostname='localhost'.
select 
 statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT, 
 columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT
 from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user';

drop table t1;
drop table t2;
drop table t3;
drop table t4;
drop table t5;
drop table t6;

drop view v1a;
drop view v1b;
drop view v1c;
drop view v1d;
drop view v2a;
drop view v2b;
drop view v3a;
drop view v3b;
drop view v4;

#
# BUG#15229 - columns of nested joins that are not natural joins incorrectly
# materialized
#
create table t1 (a1 int, a2 int);
create table t2 (a1 int, b int);
create table t3 (c1 int, c2 int);
create table t4 (c2 int);

insert into t1 values (1,1);
insert into t2 values (1,1);
insert into t3 values (1,1);
insert into t4 values (1);

select * from t1 join t2 using (a1) join t3 on b=c1 join t4 using (c2);
select * from t3 join (t1 join t2 using (a1)) on b=c1 join t4 using (c2);
select a2 from t1 join t2 using (a1) join t3 on b=c1 join t4 using (c2);
select a2 from t3 join (t1 join t2 using (a1)) on b=c1 join t4 using (c2);
select a2 from ((t1 join t2 using (a1)) join t3 on b=c1) join t4 using (c2);
select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;

drop table t1,t2,t3,t4;

#
# BUG#15355: Common natural join column not resolved in prepared statement nested query
#
create table t1 (c int, b int);
create table t2 (a int, b int);
create table t3 (b int, c int);
create table t4 (y int, c int);
create table t5 (y int, z int);

insert into t1 values (3,2);
insert into t2 values (1,2);
insert into t3 values (2,3);
insert into t4 values (1,3);
insert into t5 values (1,4);

# this fails
prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
natural join t4) natural join t5";
execute stmt1;

# this works
select * from ((t3 natural join (t1 natural join t2)) natural join t4)
  natural join t5;
drop table t1, t2, t3, t4, t5;

# End of tests for WL#2486 - natural/using join

#
# BUG#25106: A USING clause in combination with a VIEW results in column 
#            aliases ignored
#
CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50));
CREATE TABLE t2 (Test_ID INTEGER);
CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1;

CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2
 USING (Test_ID);
DESCRIBE tv1;
CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2
 ON v1.Test_ID = t2.Test_ID;
DESCRIBE tv2;

DROP VIEW v1;
DROP TABLE t1,t2,tv1,tv2;


# BUG#27939: Early NULLs filtering doesn't work for eq_ref access
create table t1 (a int, b int);
insert into t1 values 
  (NULL, 1),
  (NULL, 2),
  (NULL, 3),
  (NULL, 4);

create table t2 (a int not null, primary key(a));
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

create table t3 (a int not null, primary key(a));
insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

flush status;
select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b;
explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b;
--echo We expect rnd_next=5, and read_key must be 0 because of short-cutting:
show status like 'Handler_read%'; 
drop table t1, t2, t3;

#
# BUG#14940: Make E(#rows) from "range" access be re-used by range optimizer
#
create table t1 (a int); 
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

create table t2 (a int, b int, filler char(100), key(a), key(b));
create table t3 (a int, b int, filler char(100), key(a), key(b));

insert into t2 
  select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C;
insert into t3 select * from t2 where a < 800;

# The order of tables must be t2,t3:
explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;

drop table t1, t2, t3;

# BUG#14940 {Wrong query plan is chosen because of odd results of
# prev_record_reads() function }
create table t1 (a int); 
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

create table t2 (a int, b int, primary key(a));
insert into t2 select @v:=A.a+10*B.a, @v  from t1 A, t1 B;

explain select * from t1;
show status like '%cost%';
select 'The cost of accessing t1 (dont care if it changes' '^';

select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z;

explain select * from t1, t2 A, t2 B where A.a = t1.a and B.a=A.b;
show status like '%cost%';
select '^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error' Z;



drop table t1, t2;

#
# Bug #31094: Forcing index-based sort doesn't work anymore if joins are
# done
#

CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
CREATE TABLE t2 (c INT PRIMARY KEY, d INT);

INSERT INTO t1 VALUES(1,NULL),(2,NULL),(3,NULL),(4,NULL);
INSERT INTO t1 SELECT a + 4, b FROM t1;
INSERT INTO t1 SELECT a + 8, b FROM t1;
INSERT INTO t1 SELECT a + 16, b FROM t1;
INSERT INTO t1 SELECT a + 32, b FROM t1;
INSERT INTO t1 SELECT a + 64, b FROM t1;
INSERT INTO t2 SELECT a, b FROM t1;

#expect indexed ORDER BY
EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;
SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;

#expect filesort
EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;

DROP TABLE IF EXISTS t1,t2;


--echo #
--echo # Bug #42116: Mysql crash on specific query
--echo #
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT, INDEX (a));
CREATE TABLE t4 (a INT);
CREATE TABLE t5 (a INT);
CREATE TABLE t6 (a INT);

INSERT INTO t1 VALUES (1), (1), (1);

INSERT INTO t2 VALUES
(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);

INSERT INTO t3 VALUES
(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);

EXPLAIN
SELECT * 
FROM 
  t1 JOIN t2 ON t1.a = t2.a 
  LEFT JOIN 
  (
   (
    t3 LEFT JOIN t4 ON t3.a = t4.a
   ) 
   LEFT JOIN 
   (
     t5 LEFT JOIN t6 ON t5.a = t6.a
   ) 
   ON t4.a = t5.a
  ) 
  ON t1.a = t3.a;

SELECT * 
FROM 
  t1 JOIN t2 ON t1.a = t2.a 
  LEFT JOIN 
  (
   (
    t3 LEFT JOIN t4 ON t3.a = t4.a
   ) 
   LEFT JOIN 
   (
     t5 LEFT JOIN t6 ON t5.a = t6.a
   ) 
   ON t4.a = t5.a
  ) 
  ON t1.a = t3.a;

DROP TABLE t1,t2,t3,t4,t5,t6;

--echo #
--echo # Bug#48483: crash in get_best_combination()
--echo #

CREATE TABLE t1(f1 INT);
INSERT INTO t1 VALUES (1),(2);
CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1;
EXPLAIN EXTENDED
SELECT 1 FROM v1 right join v1 AS v2 ON RAND();
DROP VIEW v1;
DROP TABLE t1;

--echo #
--echo # Bug#52177 crash with explain, row comparison, join, text field
--echo #
CREATE TABLE t1 (a TINYINT, b TEXT, KEY (a));
INSERT INTO t1 VALUES (0,''),(0,'');
FLUSH TABLES;
EXPLAIN SELECT 1 FROM t1 LEFT JOIN t1 a ON 1
WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND
ROW(t1.b, 1111.11) <=> ROW('','');
DROP TABLE t1;

--echo #
--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
--echo # 

CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
INSERT INTO t1 VALUES (0,0), (1,1);

SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;

DROP TABLE t1;

--echo End of 5.0 tests.


#
# Bug#47150 Assertion in Field_long::val_int() on MERGE + TRIGGER + multi-table UPDATE
#
CREATE TABLE t1 (f1 int);

CREATE TABLE t2 (f1 int);
INSERT INTO t2  VALUES (1);
CREATE VIEW v1 AS SELECT * FROM t2;

PREPARE stmt FROM 'UPDATE t2 AS A NATURAL JOIN v1 B SET B.f1 = 1';
EXECUTE stmt;
EXECUTE stmt;

DEALLOCATE PREPARE stmt;

DROP VIEW v1;
DROP TABLE t1, t2;

#
# Bug#45195 valgrind warnings about uninitialized values in store_record_in_cache()
#
CREATE TABLE t1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
CREATE TABLE t2(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('1',null),(null,null);
INSERT INTO t2 VALUES ('1',null),(null,null);
CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a))
ENGINE=MERGE  UNION=(t1,t2);
SELECT t1.a FROM mm1,t1;
DROP TABLE t1, t2, mm1;

#--echo #
#--echo # Bug #55568: user variable assignments crash server when used within
#--echo #             query
#--echo #
#
#
# This test case is invalidated because of fix of bug 55531
# The reason is that {1} is not a valid geometric collection.
#
#CREATE TABLE t1 (a INT);

#INSERT INTO t1 VALUES (0), (1);

#let $i=2;
#while ($i)
#{
#  SELECT MULTIPOINT(
#    1,
#    (
#      SELECT MULTIPOINT(
#        MULTIPOINT(
#          1,
#          (SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d)
#        )
#      ) FROM t1
#    )
#  ) != COUNT(*) q FROM t1 GROUP BY a;
#  dec $i;
#}
#
#DROP TABLE t1;

--echo #
--echo # Bug #54468: crash after item's print() function when ordering/grouping 
--echo #             by subquery
--echo #

CREATE TABLE t1(a INT, b INT);
INSERT INTO t1 VALUES (), ();

SELECT 1 FROM t1
GROUP BY
GREATEST(t1.a,
         (SELECT 1 FROM
          (SELECT t1.b FROM t1,t1 t2
           ORDER BY t1.a, t1.a LIMIT 1) AS d)
        );

DROP TABLE t1;

--echo #
--echo # Bug #53544: Server hangs during JOIN query in stored procedure called
--echo #             twice in a row
--echo #

CREATE TABLE t1(c INT);

INSERT INTO t1 VALUES (1), (2);

PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN
                                        t1 t2 ON t1.c=t2.c RIGHT JOIN
                                        t1 t3 ON t1.c=t3.c 
                   GROUP BY f1;";

EXECUTE stmt;
EXECUTE stmt;

DEALLOCATE PREPARE stmt;
DROP TABLE t1;

--echo #
--echo # Bug LP:798597: Incorrect "Duplicate entry" error with views and
--echo #                GROUP BY
--echo #

CREATE TABLE t1 ( f1 int NOT NULL , f2 int NOT NULL ) ;
INSERT INTO t1 VALUES (214,0),(6,6);
CREATE TABLE t2 ( f2 int) ;
INSERT INTO t2 VALUES (88),(88);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT t1.f1, t2.f2 FROM (t2 LEFT JOIN t1 ON (t2.f2 <> t1.f1)) WHERE (t1.f2 <= 0) ;
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT t1.f1, t2.f2 FROM (t2 LEFT JOIN t1 ON (t2.f2 <> t1.f1)) WHERE (t1.f2 <= 0 or t1.f2 is null) ;
SELECT f1 , MIN(f2) FROM v1 GROUP BY f1;
SELECT f1 , MIN(f2) FROM v2 GROUP BY f1;
drop table t1,t2;
drop view v1,v2;

--echo #
--echo # BUG#47217 Lost optimization caused slowdown & wrong result.
--echo #
CREATE TABLE t1 (pk INT, v VARCHAR(2), PRIMARY KEY(pk));
CREATE INDEX ix1 ON t1(v);
CREATE TABLE t2 (pk INT, v VARCHAR(2), PRIMARY KEY(pk));
CREATE INDEX ix2 ON t2(v);
INSERT INTO t1 VALUES (1,'a'),(2,NULL);
INSERT INTO t2 VALUES (1,NULL);
EXPLAIN SELECT * FROM t1 JOIN t2 ON t1.v = t2.v ORDER BY 1;
EXPLAIN SELECT * FROM t1 JOIN t2 ON t1.v = t2.v;
INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'),
  (8,'dd'),(9,'e'),(10,'ee');
INSERT INTO t2 VALUES (2,NULL);
FLUSH STATUS;
SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1;
SHOW STATUS LIKE 'Handler_read_%';
DROP TABLE t1, t2;

--echo End of 5.1 tests

--echo #
--echo # Bug #43368: STRAIGHT_JOIN DOESN'T WORK FOR NESTED JOINS 
--echo #

create table t1(c1 int primary key, c2 char(10)) engine=myisam;
create table t2(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
create table t3(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
create table t4(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
insert into t1 values(1,'a');
insert into t2 values(1,'a', 1);
insert into t3 values(1,'a', 1);
insert into t3 values(2,'b',2);
insert into t4 values(1,'a', 1);
insert into t4 values(2,'a', 2);
insert into t4 values(3,'a', 3);
insert into t4 values(4,'a', 4);
insert into t1 values(2,'b');
insert into t1 values(3,'c');

EXPLAIN
SELECT * 
FROM t4 JOIN
     (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
     ON t4.ref_t1=t1.c1;

EXPLAIN
SELECT STRAIGHT_JOIN * 
FROM t4 JOIN
     (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
     ON t4.ref_t1=t1.c1;

EXPLAIN
SELECT * 
FROM t4 STRAIGHT_JOIN
     (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
     ON t4.ref_t1=t1.c1;

drop table t1,t2,t3,t4;
--echo End of 5.2 tests

--echo #
--echo # BUG#724275: Crash in JOIN::optimize in maria-5.3
--echo #

create table t1 (a int);
insert into t1 values (1),(2);
insert into t1 select * from t1;

create table t2 (a int, b int, key(a,b));
insert into t2 values (1,1),(1,2),(1,3),(1,4),(2,5),(2,6),(2,7),(2,8),(2,9);
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;

create table t3 (a int, b int, key(a));
insert into t3 values (1,1),(2,2);
select * from 
  t3 straight_join t1 straight_join t2 force index(a) 
where t2.a=1 and t2.b=t1.a and t1.a=t3.b and t3.a=1;

drop table t1,t2,t3;

--echo #
--echo # BUG#729067/730466: unexpected 'Range checked for each record'
--echo #                    for queries with OR in WHERE clause 
--echo #

CREATE TABLE t1 (f1 int, f2 int) ;
INSERT INTO t1 VALUES (4,0),(5,1);

CREATE TABLE t2 (f1 int, f2 int, KEY (f2)) ;
INSERT INTO t2 VALUES (5,7), (8,9);

EXPLAIN
SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1
  WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2;
SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1
  WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2;

DROP TABLE t1,t2;

CREATE TABLE t1(f1 int PRIMARY KEY, f2 int) ;
INSERT INTO t1 VALUES (9,4), (10,9);

CREATE TABLE t2(f1 int PRIMARY KEY, f2 int) ;
INSERT INTO t2 VALUES (9,4), (10,9);

EXPLAIN
SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1
  WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9;
SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1
  WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9;

DROP TABLE t1,t2;

#
# Item_equal used cmp_item::get_comparator() incorrectly
#
create table t1 (i time key);
insert into t1 values ('1:1:1'), ('2:2:2');
create table t2 (i time);
insert into t2 values ('1:1:1');
select t2.i from t1 left join t2 on t2.i = t1.i where t1.i = '1:1:1';
drop table t1,t2;

--echo #
--echo # BUG#954900: unexpected empty set due to an invalid build of key ref
--echo #                   

CREATE TABLE t1 (dog_id int(10), birthday date, PRIMARY KEY (dog_id,birthday));
INSERT INTO t1 VALUES (5918,'2004-07-22');

CREATE TABLE t2 (dog_id int(10) unsigned, t_id char(1), birthday date, a_id int(10),
PRIMARY KEY (dog_id,t_id,birthday,a_id));
INSERT INTO t2 VALUES 
(5918,'N','2004-07-22',5216551), (5918,'N','2004-07-22',5223640),
(5918,'N','2004-07-22',5389491), (5918,'N','2004-07-22',5749434),
(5918,'N','2004-07-22',5992424), (5922,'N','2005-06-30',5076957),
(5924,'N','2000-08-11',20264), (5924,'N','2000-08-11',64251),
(5924,'N','2000-08-11',74748), (5924,'N','2000-08-11',87590),
(5924,'N','2000-08-11',104695), (5924,'N','2000-08-11',133136),
(5924,'N','2000-08-11',5027806), (5924,'N','2000-08-11',5076957),
(5924,'N','2000-08-11',5166821), (5924,'N','2000-08-11',5181896),
(5924,'N','2000-08-11',5217908), (5924,'N','2000-08-11',5220812),
(5924,'N','2000-08-11',5226473), (5924,'N','2000-08-11',5339111),
(5925,'N','2005-02-10',19227), (5925,'N','2005-02-10',74529),
(5925,'N','2005-02-10',74748), (5927,'N','2005-08-18',20264),
(5927,'N','2005-08-18',58364), (5929,'N','2005-01-19',58364),
(5935,'N','2006-03-10',19227), (5935,'N','2006-03-10',64251),
(5935,'N','2006-03-10',5222400), (5935,'N','2006-03-10',5226473),
(5936,'N','2004-10-29',5015032), (5937,'N','2002-04-05',11237),
(5937,'N','2002-04-05',23911), (5937,'N','2002-04-05',112133),
(5937,'N','2002-04-05',169721), (5937,'N','2002-04-05',170650),
(5937,'N','2002-04-05',5014494), (5937,'N','2002-04-05',5166009),
(5937,'N','2002-04-05',5181871), (5937,'N','2002-04-05',5213380),
(5937,'N','2002-04-05',5214875), (5937,'N','2002-04-05',5895062),
(5938,'N','2006-03-24',11237), (5938,'N','2006-03-24',19227),
(5938,'N','2006-03-24',23911), (5938,'N','2006-03-24',58364),
(5938,'N','2006-03-24',64251), (5938,'N','2006-03-24',111716),
(5938,'N','2006-03-24',112702), (5938,'N','2006-03-24',133136),
(5938,'N','2006-03-24',168718), (5938,'N','2006-03-24',5137136),
(5938,'N','2006-03-24',5161519), (5938,'N','2006-03-24',5168120),
(5938,'N','2006-03-24',5219034), (6234,'N','2006-06-02',103058),
(6234,'N','2006-06-02',5146844), (6235,'N','2006-06-01',12900),
(6235,'N','2006-06-01',20264), (6235,'N','2006-06-01',64251),
(6235,'N','2006-06-01',75160), (6235,'N','2006-06-01',5014494),
(6235,'N','2006-06-01',5181638), (6236,'N','2006-06-06',112595),
(6236,'N','2006-06-06',5219601), (6236,'N','2006-06-06',5808374);

CREATE TABLE t3 (dog_id int(10) unsigned);
INSERT INTO t3 VALUES (5918);

CREATE TABLE t4 (dog_id int(10), t_id char(1), birthday date, KEY (t_id));
INSERT INTO t4 VALUES (5918,'N','2004-07-22'), (5919,'N','2004-07-20');

CREATE TABLE t5 (dog_id int(10) unsigned, UNIQUE KEY (dog_id));
INSERT INTO t5 VALUES (5918);

SET @tmp_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='index_condition_pushdown=off';

EXPLAIN
SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
      DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;
SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
      DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;

SET optimizer_switch=@tmp_optimizer_switch;

DROP TABLE t1,t2,t3,t4,t5;

--echo #
--echo # MDEV-4752: Segfault during parsing of illegal query
--echo #
--error ER_PARSE_ERROR
SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);

--echo #
--echo # MDEV-4959: join of const table with NULL fields
--echo #

CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL);
CREATE TABLE t2 (i2 int, a int, b int) ENGINE=MyISAM;
CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
INSERT INTO t2 VALUES (NULL,1,2),(NULL,2,3);

SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
EXPLAIN EXTENDED
SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;

DROP VIEW v2;
DROP TABLE t1,t2;

SET optimizer_switch=@save_optimizer_switch;

--echo #
--echo # Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
--echo #                   

CREATE TABLE t1 (a int);

INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);

CREATE TABLE t2 (a int);

INSERT INTO t2 (a) VALUES (1),(2),(3),(4);

EXPLAIN
SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;
SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;

EXPLAIN
SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;
SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;

EXPLAIN
SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;

DROP TABLE t1,t2;

--echo #
--echo # MDEV-5635: join of a const table with non-const tables
--echo # 

CREATE TABLE t1 (a varchar(3) NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('foo');

CREATE TABLE t2 (b varchar(3), c varchar(3), INDEX(b)) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('bar', 'bar'),( 'qux', 'qux');

SELECT STRAIGHT_JOIN * FROM t1, t2 AS t2_1, t2 AS t2_2
  WHERE t2_2.c = t2_1.c AND t2_2.b = t2_1.b AND ( a IS NULL OR t2_1.c = a );                  

DROP TABLE t1,t2;
#
# Find string "NOTE NOTE NOTE" in order to find some 'unsure' tests
#

#
# Simple select test
#

--disable_warnings
drop table if exists t1,t2,t3,t4,t11;
# The following may be left from older tests
drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa;
drop view if exists v1;
--enable_warnings

SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_select_test,'outer_join_with_cache=off');
if (`select @join_cache_level_for_select_test is null`)
{
  set join_cache_level=1;
}
if (`select @join_cache_level_for_select_test is not null`)
{
  set join_cache_level=@join_cache_level_for_select_test;
}

CREATE TABLE t1 (
  Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
  Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
);

INSERT INTO t1 VALUES (9410,9412);
  
select period from t1;
select * from t1;
select t1.* from t1;

#
# Create test table
#

CREATE TABLE t2 (
  auto int not null auto_increment,
  fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
  companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
  fld3 char(30) DEFAULT '' NOT NULL,
  fld4 char(35) DEFAULT '' NOT NULL,
  fld5 char(35) DEFAULT '' NOT NULL,
  fld6 char(4) DEFAULT '' NOT NULL,
  UNIQUE fld1 (fld1),
  KEY fld3 (fld3),
  PRIMARY KEY (auto)
);  

#
# Populate table
#

--disable_query_log
INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
INSERT INTO t2 VALUES (5,011501,37,'bewilderingly','wallet','balled','');
INSERT INTO t2 VALUES (6,011701,37,'astound','parters','persist','W');
INSERT INTO t2 VALUES (7,011702,37,'admonishing','eschew','attainments','');
INSERT INTO t2 VALUES (8,011703,37,'sumac','quitter','fanatic','');
INSERT INTO t2 VALUES (9,012001,37,'flanking','neat','measures','FAS');
INSERT INTO t2 VALUES (10,012003,37,'combed','Steinberg','rightfulness','');
INSERT INTO t2 VALUES (11,012004,37,'subjective','jarring','capably','');
INSERT INTO t2 VALUES (12,012005,37,'scatterbrain','tinily','impulsive','');
INSERT INTO t2 VALUES (13,012301,37,'Eulerian','balled','starlet','');
INSERT INTO t2 VALUES (14,012302,36,'dubbed','persist','terminators','');
INSERT INTO t2 VALUES (15,012303,37,'Kane','attainments','untying','');
INSERT INTO t2 VALUES (16,012304,37,'overlay','fanatic','announces','FAS');
INSERT INTO t2 VALUES (17,012305,37,'perturb','measures','featherweight','FAS');
INSERT INTO t2 VALUES (18,012306,37,'goblins','rightfulness','pessimist','FAS');
INSERT INTO t2 VALUES (19,012501,37,'annihilates','capably','daughter','');
INSERT INTO t2 VALUES (20,012602,37,'Wotan','impulsive','decliner','FAS');
INSERT INTO t2 VALUES (21,012603,37,'snatching','starlet','lawgiver','');
INSERT INTO t2 VALUES (22,012604,37,'concludes','terminators','stated','');
INSERT INTO t2 VALUES (23,012605,37,'laterally','untying','readable','');
INSERT INTO t2 VALUES (24,012606,37,'yelped','announces','attrition','');
INSERT INTO t2 VALUES (25,012701,37,'grazing','featherweight','cascade','FAS');
INSERT INTO t2 VALUES (26,012702,37,'Baird','pessimist','motors','FAS');
INSERT INTO t2 VALUES (27,012703,37,'celery','daughter','interrogate','');
INSERT INTO t2 VALUES (28,012704,37,'misunderstander','decliner','pests','W');
INSERT INTO t2 VALUES (29,013601,37,'handgun','lawgiver','stairway','');
INSERT INTO t2 VALUES (30,013602,37,'foldout','stated','dopers','FAS');
INSERT INTO t2 VALUES (31,013603,37,'mystic','readable','testicle','W');
INSERT INTO t2 VALUES (32,013604,37,'succumbed','attrition','Parsifal','W');
INSERT INTO t2 VALUES (33,013605,37,'Nabisco','cascade','leavings','');
INSERT INTO t2 VALUES (34,013606,37,'fingerings','motors','postulation','W');
INSERT INTO t2 VALUES (35,013607,37,'aging','interrogate','squeaking','');
INSERT INTO t2 VALUES (36,013608,37,'afield','pests','contrasted','');
INSERT INTO t2 VALUES (37,013609,37,'ammonium','stairway','leftover','');
INSERT INTO t2 VALUES (38,013610,37,'boat','dopers','whiteners','');
INSERT INTO t2 VALUES (39,013801,37,'intelligibility','testicle','erases','W');
INSERT INTO t2 VALUES (40,013802,37,'Augustine','Parsifal','Punjab','W');
INSERT INTO t2 VALUES (41,013803,37,'teethe','leavings','Merritt','');
INSERT INTO t2 VALUES (42,013804,37,'dreaded','postulation','Quixotism','');
INSERT INTO t2 VALUES (43,013901,37,'scholastics','squeaking','sweetish','FAS');
INSERT INTO t2 VALUES (44,016001,37,'audiology','contrasted','dogging','FAS');
INSERT INTO t2 VALUES (45,016201,37,'wallet','leftover','scornfully','FAS');
INSERT INTO t2 VALUES (46,016202,37,'parters','whiteners','bellow','');
INSERT INTO t2 VALUES (47,016301,37,'eschew','erases','bills','');
INSERT INTO t2 VALUES (48,016302,37,'quitter','Punjab','cupboard','FAS');
INSERT INTO t2 VALUES (49,016303,37,'neat','Merritt','sureties','FAS');
INSERT INTO t2 VALUES (50,016304,37,'Steinberg','Quixotism','puddings','');
INSERT INTO t2 VALUES (51,018001,37,'jarring','sweetish','tapestry','');
INSERT INTO t2 VALUES (52,018002,37,'tinily','dogging','fetters','');
INSERT INTO t2 VALUES (53,018003,37,'balled','scornfully','bivalves','');
INSERT INTO t2 VALUES (54,018004,37,'persist','bellow','incurring','');
INSERT INTO t2 VALUES (55,018005,37,'attainments','bills','Adolph','');
INSERT INTO t2 VALUES (56,018007,37,'fanatic','cupboard','pithed','');
INSERT INTO t2 VALUES (57,018008,37,'measures','sureties','emergency','');
INSERT INTO t2 VALUES (58,018009,37,'rightfulness','puddings','Miles','');
INSERT INTO t2 VALUES (59,018010,37,'capably','tapestry','trimmings','');
INSERT INTO t2 VALUES (60,018012,37,'impulsive','fetters','tragedies','W');
INSERT INTO t2 VALUES (61,018013,37,'starlet','bivalves','skulking','W');
INSERT INTO t2 VALUES (62,018014,37,'terminators','incurring','flint','');
INSERT INTO t2 VALUES (63,018015,37,'untying','Adolph','flopping','W');
INSERT INTO t2 VALUES (64,018016,37,'announces','pithed','relaxing','FAS');
INSERT INTO t2 VALUES (65,018017,37,'featherweight','emergency','offload','FAS');
INSERT INTO t2 VALUES (66,018018,37,'pessimist','Miles','suites','W');
INSERT INTO t2 VALUES (67,018019,37,'daughter','trimmings','lists','FAS');
INSERT INTO t2 VALUES (68,018020,37,'decliner','tragedies','animized','FAS');
INSERT INTO t2 VALUES (69,018021,37,'lawgiver','skulking','multilayer','W');
INSERT INTO t2 VALUES (70,018022,37,'stated','flint','standardizes','FAS');
INSERT INTO t2 VALUES (71,018023,37,'readable','flopping','Judas','');
INSERT INTO t2 VALUES (72,018024,37,'attrition','relaxing','vacuuming','W');
INSERT INTO t2 VALUES (73,018025,37,'cascade','offload','dentally','W');
INSERT INTO t2 VALUES (74,018026,37,'motors','suites','humanness','W');
INSERT INTO t2 VALUES (75,018027,37,'interrogate','lists','inch','W');
INSERT INTO t2 VALUES (76,018028,37,'pests','animized','Weissmuller','W');
INSERT INTO t2 VALUES (77,018029,37,'stairway','multilayer','irresponsibly','W');
INSERT INTO t2 VALUES (78,018030,37,'dopers','standardizes','luckily','FAS');
INSERT INTO t2 VALUES (79,018032,37,'testicle','Judas','culled','W');
INSERT INTO t2 VALUES (80,018033,37,'Parsifal','vacuuming','medical','FAS');
INSERT INTO t2 VALUES (81,018034,37,'leavings','dentally','bloodbath','FAS');
INSERT INTO t2 VALUES (82,018035,37,'postulation','humanness','subschema','W');
INSERT INTO t2 VALUES (83,018036,37,'squeaking','inch','animals','W');
INSERT INTO t2 VALUES (84,018037,37,'contrasted','Weissmuller','Micronesia','');
INSERT INTO t2 VALUES (85,018038,37,'leftover','irresponsibly','repetitions','');
INSERT INTO t2 VALUES (86,018039,37,'whiteners','luckily','Antares','');
INSERT INTO t2 VALUES (87,018040,37,'erases','culled','ventilate','W');
INSERT INTO t2 VALUES (88,018041,37,'Punjab','medical','pityingly','');
INSERT INTO t2 VALUES (89,018042,37,'Merritt','bloodbath','interdependent','');
INSERT INTO t2 VALUES (90,018043,37,'Quixotism','subschema','Graves','FAS');
INSERT INTO t2 VALUES (91,018044,37,'sweetish','animals','neonatal','');
INSERT INTO t2 VALUES (92,018045,37,'dogging','Micronesia','scribbled','FAS');
INSERT INTO t2 VALUES (93,018046,37,'scornfully','repetitions','chafe','W');
INSERT INTO t2 VALUES (94,018048,37,'bellow','Antares','honoring','');
INSERT INTO t2 VALUES (95,018049,37,'bills','ventilate','realtor','');
INSERT INTO t2 VALUES (96,018050,37,'cupboard','pityingly','elite','');
INSERT INTO t2 VALUES (97,018051,37,'sureties','interdependent','funereal','');
INSERT INTO t2 VALUES (98,018052,37,'puddings','Graves','abrogating','');
INSERT INTO t2 VALUES (99,018053,50,'tapestry','neonatal','sorters','');
INSERT INTO t2 VALUES (100,018054,37,'fetters','scribbled','Conley','');
INSERT INTO t2 VALUES (101,018055,37,'bivalves','chafe','lectured','');
INSERT INTO t2 VALUES (102,018056,37,'incurring','honoring','Abraham','');
INSERT INTO t2 VALUES (103,018057,37,'Adolph','realtor','Hawaii','W');
INSERT INTO t2 VALUES (104,018058,37,'pithed','elite','cage','');
INSERT INTO t2 VALUES (105,018059,36,'emergency','funereal','hushes','');
INSERT INTO t2 VALUES (106,018060,37,'Miles','abrogating','Simla','');
INSERT INTO t2 VALUES (107,018061,37,'trimmings','sorters','reporters','');
INSERT INTO t2 VALUES (108,018101,37,'tragedies','Conley','Dutchman','FAS');
INSERT INTO t2 VALUES (109,018102,37,'skulking','lectured','descendants','FAS');
INSERT INTO t2 VALUES (110,018103,37,'flint','Abraham','groupings','FAS');
INSERT INTO t2 VALUES (111,018104,37,'flopping','Hawaii','dissociate','');
INSERT INTO t2 VALUES (112,018201,37,'relaxing','cage','coexist','W');
INSERT INTO t2 VALUES (113,018202,37,'offload','hushes','Beebe','');
INSERT INTO t2 VALUES (114,018402,37,'suites','Simla','Taoism','');
INSERT INTO t2 VALUES (115,018403,37,'lists','reporters','Connally','');
INSERT INTO t2 VALUES (116,018404,37,'animized','Dutchman','fetched','FAS');
INSERT INTO t2 VALUES (117,018405,37,'multilayer','descendants','checkpoints','FAS');
INSERT INTO t2 VALUES (118,018406,37,'standardizes','groupings','rusting','');
INSERT INTO t2 VALUES (119,018409,37,'Judas','dissociate','galling','');
INSERT INTO t2 VALUES (120,018601,37,'vacuuming','coexist','obliterates','');
INSERT INTO t2 VALUES (121,018602,37,'dentally','Beebe','traitor','');
INSERT INTO t2 VALUES (122,018603,37,'humanness','Taoism','resumes','FAS');
INSERT INTO t2 VALUES (123,018801,37,'inch','Connally','analyzable','FAS');
INSERT INTO t2 VALUES (124,018802,37,'Weissmuller','fetched','terminator','FAS');
INSERT INTO t2 VALUES (125,018803,37,'irresponsibly','checkpoints','gritty','FAS');
INSERT INTO t2 VALUES (126,018804,37,'luckily','rusting','firearm','W');
INSERT INTO t2 VALUES (127,018805,37,'culled','galling','minima','');
INSERT INTO t2 VALUES (128,018806,37,'medical','obliterates','Selfridge','');
INSERT INTO t2 VALUES (129,018807,37,'bloodbath','traitor','disable','');
INSERT INTO t2 VALUES (130,018808,37,'subschema','resumes','witchcraft','W');
INSERT INTO t2 VALUES (131,018809,37,'animals','analyzable','betroth','W');
INSERT INTO t2 VALUES (132,018810,37,'Micronesia','terminator','Manhattanize','');
INSERT INTO t2 VALUES (133,018811,37,'repetitions','gritty','imprint','');
INSERT INTO t2 VALUES (134,018812,37,'Antares','firearm','peeked','');
INSERT INTO t2 VALUES (135,019101,37,'ventilate','minima','swelling','');
INSERT INTO t2 VALUES (136,019102,37,'pityingly','Selfridge','interrelationships','W');
INSERT INTO t2 VALUES (137,019103,37,'interdependent','disable','riser','');
INSERT INTO t2 VALUES (138,019201,37,'Graves','witchcraft','Gandhian','W');
INSERT INTO t2 VALUES (139,030501,37,'neonatal','betroth','peacock','A');
INSERT INTO t2 VALUES (140,030502,50,'scribbled','Manhattanize','bee','A');
INSERT INTO t2 VALUES (141,030503,37,'chafe','imprint','kanji','');
INSERT INTO t2 VALUES (142,030504,37,'honoring','peeked','dental','');
INSERT INTO t2 VALUES (143,031901,37,'realtor','swelling','scarf','FAS');
INSERT INTO t2 VALUES (144,036001,37,'elite','interrelationships','chasm','A');
INSERT INTO t2 VALUES (145,036002,37,'funereal','riser','insolence','A');
INSERT INTO t2 VALUES (146,036004,37,'abrogating','Gandhian','syndicate','');
INSERT INTO t2 VALUES (147,036005,37,'sorters','peacock','alike','');
INSERT INTO t2 VALUES (148,038001,37,'Conley','bee','imperial','A');
INSERT INTO t2 VALUES (149,038002,37,'lectured','kanji','convulsion','A');
INSERT INTO t2 VALUES (150,038003,37,'Abraham','dental','railway','A');
INSERT INTO t2 VALUES (151,038004,37,'Hawaii','scarf','validate','A');
INSERT INTO t2 VALUES (152,038005,37,'cage','chasm','normalizes','A');
INSERT INTO t2 VALUES (153,038006,37,'hushes','insolence','comprehensive','');
INSERT INTO t2 VALUES (154,038007,37,'Simla','syndicate','chewing','');
INSERT INTO t2 VALUES (155,038008,37,'reporters','alike','denizen','');
INSERT INTO t2 VALUES (156,038009,37,'Dutchman','imperial','schemer','');
INSERT INTO t2 VALUES (157,038010,37,'descendants','convulsion','chronicle','');
INSERT INTO t2 VALUES (158,038011,37,'groupings','railway','Kline','');
INSERT INTO t2 VALUES (159,038012,37,'dissociate','validate','Anatole','');
INSERT INTO t2 VALUES (160,038013,37,'coexist','normalizes','partridges','');
INSERT INTO t2 VALUES (161,038014,37,'Beebe','comprehensive','brunch','');
INSERT INTO t2 VALUES (162,038015,37,'Taoism','chewing','recruited','');
INSERT INTO t2 VALUES (163,038016,37,'Connally','denizen','dimensions','W');
INSERT INTO t2 VALUES (164,038017,37,'fetched','schemer','Chicana','W');
INSERT INTO t2 VALUES (165,038018,37,'checkpoints','chronicle','announced','');
INSERT INTO t2 VALUES (166,038101,37,'rusting','Kline','praised','FAS');
INSERT INTO t2 VALUES (167,038102,37,'galling','Anatole','employing','');
INSERT INTO t2 VALUES (168,038103,37,'obliterates','partridges','linear','');
INSERT INTO t2 VALUES (169,038104,37,'traitor','brunch','quagmire','');
INSERT INTO t2 VALUES (170,038201,37,'resumes','recruited','western','A');
INSERT INTO t2 VALUES (171,038202,37,'analyzable','dimensions','relishing','');
INSERT INTO t2 VALUES (172,038203,37,'terminator','Chicana','serving','A');
INSERT INTO t2 VALUES (173,038204,37,'gritty','announced','scheduling','');
INSERT INTO t2 VALUES (174,038205,37,'firearm','praised','lore','');
INSERT INTO t2 VALUES (175,038206,37,'minima','employing','eventful','');
INSERT INTO t2 VALUES (176,038208,37,'Selfridge','linear','arteriole','A');
INSERT INTO t2 VALUES (177,042801,37,'disable','quagmire','disentangle','');
INSERT INTO t2 VALUES (178,042802,37,'witchcraft','western','cured','A');
INSERT INTO t2 VALUES (179,046101,37,'betroth','relishing','Fenton','W');
INSERT INTO t2 VALUES (180,048001,37,'Manhattanize','serving','avoidable','A');
INSERT INTO t2 VALUES (181,048002,37,'imprint','scheduling','drains','A');
INSERT INTO t2 VALUES (182,048003,37,'peeked','lore','detectably','FAS');
INSERT INTO t2 VALUES (183,048004,37,'swelling','eventful','husky','');
INSERT INTO t2 VALUES (184,048005,37,'interrelationships','arteriole','impelling','');
INSERT INTO t2 VALUES (185,048006,37,'riser','disentangle','undoes','');
INSERT INTO t2 VALUES (186,048007,37,'Gandhian','cured','evened','');
INSERT INTO t2 VALUES (187,048008,37,'peacock','Fenton','squeezes','');
INSERT INTO t2 VALUES (188,048101,37,'bee','avoidable','destroyer','FAS');
INSERT INTO t2 VALUES (189,048102,37,'kanji','drains','rudeness','');
INSERT INTO t2 VALUES (190,048201,37,'dental','detectably','beaner','FAS');
INSERT INTO t2 VALUES (191,048202,37,'scarf','husky','boorish','');
INSERT INTO t2 VALUES (192,048203,37,'chasm','impelling','Everhart','');
INSERT INTO t2 VALUES (193,048204,37,'insolence','undoes','encompass','A');
INSERT INTO t2 VALUES (194,048205,37,'syndicate','evened','mushrooms','');
INSERT INTO t2 VALUES (195,048301,37,'alike','squeezes','Alison','A');
INSERT INTO t2 VALUES (196,048302,37,'imperial','destroyer','externally','FAS');
INSERT INTO t2 VALUES (197,048303,37,'convulsion','rudeness','pellagra','');
INSERT INTO t2 VALUES (198,048304,37,'railway','beaner','cult','');
INSERT INTO t2 VALUES (199,048305,37,'validate','boorish','creek','A');
INSERT INTO t2 VALUES (200,048401,37,'normalizes','Everhart','Huffman','');
INSERT INTO t2 VALUES (201,048402,37,'comprehensive','encompass','Majorca','FAS');
INSERT INTO t2 VALUES (202,048403,37,'chewing','mushrooms','governing','A');
INSERT INTO t2 VALUES (203,048404,37,'denizen','Alison','gadfly','FAS');
INSERT INTO t2 VALUES (204,048405,37,'schemer','externally','reassigned','FAS');
INSERT INTO t2 VALUES (205,048406,37,'chronicle','pellagra','intentness','W');
INSERT INTO t2 VALUES (206,048407,37,'Kline','cult','craziness','');
INSERT INTO t2 VALUES (207,048408,37,'Anatole','creek','psychic','');
INSERT INTO t2 VALUES (208,048409,37,'partridges','Huffman','squabbled','');
INSERT INTO t2 VALUES (209,048410,37,'brunch','Majorca','burlesque','');
INSERT INTO t2 VALUES (210,048411,37,'recruited','governing','capped','');
INSERT INTO t2 VALUES (211,048412,37,'dimensions','gadfly','extracted','A');
INSERT INTO t2 VALUES (212,048413,37,'Chicana','reassigned','DiMaggio','');
INSERT INTO t2 VALUES (213,048601,37,'announced','intentness','exclamation','FAS');
INSERT INTO t2 VALUES (214,048602,37,'praised','craziness','subdirectory','');
INSERT INTO t2 VALUES (215,048603,37,'employing','psychic','fangs','');
INSERT INTO t2 VALUES (216,048604,37,'linear','squabbled','buyer','A');
INSERT INTO t2 VALUES (217,048801,37,'quagmire','burlesque','pithing','A');
INSERT INTO t2 VALUES (218,050901,37,'western','capped','transistorizing','A');
INSERT INTO t2 VALUES (219,051201,37,'relishing','extracted','nonbiodegradable','');
INSERT INTO t2 VALUES (220,056002,37,'serving','DiMaggio','dislocate','');
INSERT INTO t2 VALUES (221,056003,37,'scheduling','exclamation','monochromatic','FAS');
INSERT INTO t2 VALUES (222,056004,37,'lore','subdirectory','batting','');
INSERT INTO t2 VALUES (223,056102,37,'eventful','fangs','postcondition','A');
INSERT INTO t2 VALUES (224,056203,37,'arteriole','buyer','catalog','FAS');
INSERT INTO t2 VALUES (225,056204,37,'disentangle','pithing','Remus','');
INSERT INTO t2 VALUES (226,058003,37,'cured','transistorizing','devices','A');
INSERT INTO t2 VALUES (227,058004,37,'Fenton','nonbiodegradable','bike','A');
INSERT INTO t2 VALUES (228,058005,37,'avoidable','dislocate','qualify','');
INSERT INTO t2 VALUES (229,058006,37,'drains','monochromatic','detained','');
INSERT INTO t2 VALUES (230,058007,37,'detectably','batting','commended','');
INSERT INTO t2 VALUES (231,058101,37,'husky','postcondition','civilize','');
INSERT INTO t2 VALUES (232,058102,37,'impelling','catalog','Elmhurst','');
INSERT INTO t2 VALUES (233,058103,37,'undoes','Remus','anesthetizing','');
INSERT INTO t2 VALUES (234,058105,37,'evened','devices','deaf','');
INSERT INTO t2 VALUES (235,058111,37,'squeezes','bike','Brigham','');
INSERT INTO t2 VALUES (236,058112,37,'destroyer','qualify','title','');
INSERT INTO t2 VALUES (237,058113,37,'rudeness','detained','coarse','');
INSERT INTO t2 VALUES (238,058114,37,'beaner','commended','combinations','');
INSERT INTO t2 VALUES (239,058115,37,'boorish','civilize','grayness','');
INSERT INTO t2 VALUES (240,058116,37,'Everhart','Elmhurst','innumerable','FAS');
INSERT INTO t2 VALUES (241,058117,37,'encompass','anesthetizing','Caroline','A');
INSERT INTO t2 VALUES (242,058118,37,'mushrooms','deaf','fatty','FAS');
INSERT INTO t2 VALUES (243,058119,37,'Alison','Brigham','eastbound','');
INSERT INTO t2 VALUES (244,058120,37,'externally','title','inexperienced','');
INSERT INTO t2 VALUES (245,058121,37,'pellagra','coarse','hoarder','A');
INSERT INTO t2 VALUES (246,058122,37,'cult','combinations','scotch','W');
INSERT INTO t2 VALUES (247,058123,37,'creek','grayness','passport','A');
INSERT INTO t2 VALUES (248,058124,37,'Huffman','innumerable','strategic','FAS');
INSERT INTO t2 VALUES (249,058125,37,'Majorca','Caroline','gated','');
INSERT INTO t2 VALUES (250,058126,37,'governing','fatty','flog','');
INSERT INTO t2 VALUES (251,058127,37,'gadfly','eastbound','Pipestone','');
INSERT INTO t2 VALUES (252,058128,37,'reassigned','inexperienced','Dar','');
INSERT INTO t2 VALUES (253,058201,37,'intentness','hoarder','Corcoran','');
INSERT INTO t2 VALUES (254,058202,37,'craziness','scotch','flyers','A');
INSERT INTO t2 VALUES (255,058303,37,'psychic','passport','competitions','W');
INSERT INTO t2 VALUES (256,058304,37,'squabbled','strategic','suppliers','FAS');
INSERT INTO t2 VALUES (257,058602,37,'burlesque','gated','skips','');
INSERT INTO t2 VALUES (258,058603,37,'capped','flog','institutes','');
INSERT INTO t2 VALUES (259,058604,37,'extracted','Pipestone','troop','A');
INSERT INTO t2 VALUES (260,058605,37,'DiMaggio','Dar','connective','W');
INSERT INTO t2 VALUES (261,058606,37,'exclamation','Corcoran','denies','');
INSERT INTO t2 VALUES (262,058607,37,'subdirectory','flyers','polka','');
INSERT INTO t2 VALUES (263,060401,36,'fangs','competitions','observations','FAS');
INSERT INTO t2 VALUES (264,061701,36,'buyer','suppliers','askers','');
INSERT INTO t2 VALUES (265,066201,36,'pithing','skips','homeless','FAS');
INSERT INTO t2 VALUES (266,066501,36,'transistorizing','institutes','Anna','');
INSERT INTO t2 VALUES (267,068001,36,'nonbiodegradable','troop','subdirectories','W');
INSERT INTO t2 VALUES (268,068002,36,'dislocate','connective','decaying','FAS');
INSERT INTO t2 VALUES (269,068005,36,'monochromatic','denies','outwitting','W');
INSERT INTO t2 VALUES (270,068006,36,'batting','polka','Harpy','W');
INSERT INTO t2 VALUES (271,068007,36,'postcondition','observations','crazed','');
INSERT INTO t2 VALUES (272,068008,36,'catalog','askers','suffocate','');
INSERT INTO t2 VALUES (273,068009,36,'Remus','homeless','provers','FAS');
INSERT INTO t2 VALUES (274,068010,36,'devices','Anna','technically','');
INSERT INTO t2 VALUES (275,068011,36,'bike','subdirectories','Franklinizations','');
INSERT INTO t2 VALUES (276,068202,36,'qualify','decaying','considered','');
INSERT INTO t2 VALUES (277,068302,36,'detained','outwitting','tinnily','');
INSERT INTO t2 VALUES (278,068303,36,'commended','Harpy','uninterruptedly','');
INSERT INTO t2 VALUES (279,068401,36,'civilize','crazed','whistled','A');
INSERT INTO t2 VALUES (280,068501,36,'Elmhurst','suffocate','automate','');
INSERT INTO t2 VALUES (281,068502,36,'anesthetizing','provers','gutting','W');
INSERT INTO t2 VALUES (282,068503,36,'deaf','technically','surreptitious','');
INSERT INTO t2 VALUES (283,068602,36,'Brigham','Franklinizations','Choctaw','');
INSERT INTO t2 VALUES (284,068603,36,'title','considered','cooks','');
INSERT INTO t2 VALUES (285,068701,36,'coarse','tinnily','millivolt','FAS');
INSERT INTO t2 VALUES (286,068702,36,'combinations','uninterruptedly','counterpoise','');
INSERT INTO t2 VALUES (287,068703,36,'grayness','whistled','Gothicism','');
INSERT INTO t2 VALUES (288,076001,36,'innumerable','automate','feminine','');
INSERT INTO t2 VALUES (289,076002,36,'Caroline','gutting','metaphysically','W');
INSERT INTO t2 VALUES (290,076101,36,'fatty','surreptitious','sanding','A');
INSERT INTO t2 VALUES (291,076102,36,'eastbound','Choctaw','contributorily','');
INSERT INTO t2 VALUES (292,076103,36,'inexperienced','cooks','receivers','FAS');
INSERT INTO t2 VALUES (293,076302,36,'hoarder','millivolt','adjourn','');
INSERT INTO t2 VALUES (294,076303,36,'scotch','counterpoise','straggled','A');
INSERT INTO t2 VALUES (295,076304,36,'passport','Gothicism','druggists','');
INSERT INTO t2 VALUES (296,076305,36,'strategic','feminine','thanking','FAS');
INSERT INTO t2 VALUES (297,076306,36,'gated','metaphysically','ostrich','');
INSERT INTO t2 VALUES (298,076307,36,'flog','sanding','hopelessness','FAS');
INSERT INTO t2 VALUES (299,076402,36,'Pipestone','contributorily','Eurydice','');
INSERT INTO t2 VALUES (300,076501,36,'Dar','receivers','excitation','W');
INSERT INTO t2 VALUES (301,076502,36,'Corcoran','adjourn','presumes','FAS');
INSERT INTO t2 VALUES (302,076701,36,'flyers','straggled','imaginable','FAS');
INSERT INTO t2 VALUES (303,078001,36,'competitions','druggists','concoct','W');
INSERT INTO t2 VALUES (304,078002,36,'suppliers','thanking','peering','W');
INSERT INTO t2 VALUES (305,078003,36,'skips','ostrich','Phelps','FAS');
INSERT INTO t2 VALUES (306,078004,36,'institutes','hopelessness','ferociousness','FAS');
INSERT INTO t2 VALUES (307,078005,36,'troop','Eurydice','sentences','');
INSERT INTO t2 VALUES (308,078006,36,'connective','excitation','unlocks','');
INSERT INTO t2 VALUES (309,078007,36,'denies','presumes','engrossing','W');
INSERT INTO t2 VALUES (310,078008,36,'polka','imaginable','Ruth','');
INSERT INTO t2 VALUES (311,078101,36,'observations','concoct','tying','');
INSERT INTO t2 VALUES (312,078103,36,'askers','peering','exclaimers','');
INSERT INTO t2 VALUES (313,078104,36,'homeless','Phelps','synergy','');
INSERT INTO t2 VALUES (314,078105,36,'Anna','ferociousness','Huey','W');
INSERT INTO t2 VALUES (315,082101,36,'subdirectories','sentences','merging','');
INSERT INTO t2 VALUES (316,083401,36,'decaying','unlocks','judges','A');
INSERT INTO t2 VALUES (317,084001,36,'outwitting','engrossing','Shylock','W');
INSERT INTO t2 VALUES (318,084002,36,'Harpy','Ruth','Miltonism','');
INSERT INTO t2 VALUES (319,086001,36,'crazed','tying','hen','W');
INSERT INTO t2 VALUES (320,086102,36,'suffocate','exclaimers','honeybee','FAS');
INSERT INTO t2 VALUES (321,086201,36,'provers','synergy','towers','');
INSERT INTO t2 VALUES (322,088001,36,'technically','Huey','dilutes','W');
INSERT INTO t2 VALUES (323,088002,36,'Franklinizations','merging','numerals','FAS');
INSERT INTO t2 VALUES (324,088003,36,'considered','judges','democracy','FAS');
INSERT INTO t2 VALUES (325,088004,36,'tinnily','Shylock','Ibero-','');
INSERT INTO t2 VALUES (326,088101,36,'uninterruptedly','Miltonism','invalids','');
INSERT INTO t2 VALUES (327,088102,36,'whistled','hen','behavior','');
INSERT INTO t2 VALUES (328,088103,36,'automate','honeybee','accruing','');
INSERT INTO t2 VALUES (329,088104,36,'gutting','towers','relics','A');
INSERT INTO t2 VALUES (330,088105,36,'surreptitious','dilutes','rackets','');
INSERT INTO t2 VALUES (331,088106,36,'Choctaw','numerals','Fischbein','W');
INSERT INTO t2 VALUES (332,088201,36,'cooks','democracy','phony','W');
INSERT INTO t2 VALUES (333,088203,36,'millivolt','Ibero-','cross','FAS');
INSERT INTO t2 VALUES (334,088204,36,'counterpoise','invalids','cleanup','');
INSERT INTO t2 VALUES (335,088302,37,'Gothicism','behavior','conspirator','');
INSERT INTO t2 VALUES (336,088303,37,'feminine','accruing','label','FAS');
INSERT INTO t2 VALUES (337,088305,37,'metaphysically','relics','university','');
INSERT INTO t2 VALUES (338,088402,37,'sanding','rackets','cleansed','FAS');
INSERT INTO t2 VALUES (339,088501,36,'contributorily','Fischbein','ballgown','');
INSERT INTO t2 VALUES (340,088502,36,'receivers','phony','starlet','');
INSERT INTO t2 VALUES (341,088503,36,'adjourn','cross','aqueous','');
INSERT INTO t2 VALUES (342,098001,58,'straggled','cleanup','portrayal','A');
INSERT INTO t2 VALUES (343,098002,58,'druggists','conspirator','despising','W');
INSERT INTO t2 VALUES (344,098003,58,'thanking','label','distort','W');
INSERT INTO t2 VALUES (345,098004,58,'ostrich','university','palmed','');
INSERT INTO t2 VALUES (346,098005,58,'hopelessness','cleansed','faced','');
INSERT INTO t2 VALUES (347,098006,58,'Eurydice','ballgown','silverware','');
INSERT INTO t2 VALUES (348,141903,29,'excitation','starlet','assessor','');
INSERT INTO t2 VALUES (349,098008,58,'presumes','aqueous','spiders','');
INSERT INTO t2 VALUES (350,098009,58,'imaginable','portrayal','artificially','');
INSERT INTO t2 VALUES (351,098010,58,'concoct','despising','reminiscence','');
INSERT INTO t2 VALUES (352,098011,58,'peering','distort','Mexican','');
INSERT INTO t2 VALUES (353,098012,58,'Phelps','palmed','obnoxious','');
INSERT INTO t2 VALUES (354,098013,58,'ferociousness','faced','fragile','');
INSERT INTO t2 VALUES (355,098014,58,'sentences','silverware','apprehensible','');
INSERT INTO t2 VALUES (356,098015,58,'unlocks','assessor','births','');
INSERT INTO t2 VALUES (357,098016,58,'engrossing','spiders','garages','');
INSERT INTO t2 VALUES (358,098017,58,'Ruth','artificially','panty','');
INSERT INTO t2 VALUES (359,098018,58,'tying','reminiscence','anteater','');
INSERT INTO t2 VALUES (360,098019,58,'exclaimers','Mexican','displacement','A');
INSERT INTO t2 VALUES (361,098020,58,'synergy','obnoxious','drovers','A');
INSERT INTO t2 VALUES (362,098021,58,'Huey','fragile','patenting','A');
INSERT INTO t2 VALUES (363,098022,58,'merging','apprehensible','far','A');
INSERT INTO t2 VALUES (364,098023,58,'judges','births','shrieks','');
INSERT INTO t2 VALUES (365,098024,58,'Shylock','garages','aligning','W');
INSERT INTO t2 VALUES (366,098025,37,'Miltonism','panty','pragmatism','');
INSERT INTO t2 VALUES (367,106001,36,'hen','anteater','fevers','W');
INSERT INTO t2 VALUES (368,108001,36,'honeybee','displacement','reexamines','A');
INSERT INTO t2 VALUES (369,108002,36,'towers','drovers','occupancies','');
INSERT INTO t2 VALUES (370,108003,36,'dilutes','patenting','sweats','FAS');
INSERT INTO t2 VALUES (371,108004,36,'numerals','far','modulators','');
INSERT INTO t2 VALUES (372,108005,36,'democracy','shrieks','demand','W');
INSERT INTO t2 VALUES (373,108007,36,'Ibero-','aligning','Madeira','');
INSERT INTO t2 VALUES (374,108008,36,'invalids','pragmatism','Viennese','W');
INSERT INTO t2 VALUES (375,108009,36,'behavior','fevers','chillier','W');
INSERT INTO t2 VALUES (376,108010,36,'accruing','reexamines','wildcats','FAS');
INSERT INTO t2 VALUES (377,108011,36,'relics','occupancies','gentle','');
INSERT INTO t2 VALUES (378,108012,36,'rackets','sweats','Angles','W');
INSERT INTO t2 VALUES (379,108101,36,'Fischbein','modulators','accuracies','');
INSERT INTO t2 VALUES (380,108102,36,'phony','demand','toggle','');
INSERT INTO t2 VALUES (381,108103,36,'cross','Madeira','Mendelssohn','W');
INSERT INTO t2 VALUES (382,108111,50,'cleanup','Viennese','behaviorally','');
INSERT INTO t2 VALUES (383,108105,36,'conspirator','chillier','Rochford','');
INSERT INTO t2 VALUES (384,108106,36,'label','wildcats','mirror','W');
INSERT INTO t2 VALUES (385,108107,36,'university','gentle','Modula','');
INSERT INTO t2 VALUES (386,108108,50,'cleansed','Angles','clobbering','');
INSERT INTO t2 VALUES (387,108109,36,'ballgown','accuracies','chronography','');
INSERT INTO t2 VALUES (388,108110,36,'starlet','toggle','Eskimoizeds','');
INSERT INTO t2 VALUES (389,108201,36,'aqueous','Mendelssohn','British','W');
INSERT INTO t2 VALUES (390,108202,36,'portrayal','behaviorally','pitfalls','');
INSERT INTO t2 VALUES (391,108203,36,'despising','Rochford','verify','W');
INSERT INTO t2 VALUES (392,108204,36,'distort','mirror','scatter','FAS');
INSERT INTO t2 VALUES (393,108205,36,'palmed','Modula','Aztecan','');
INSERT INTO t2 VALUES (394,108301,36,'faced','clobbering','acuity','W');
INSERT INTO t2 VALUES (395,108302,36,'silverware','chronography','sinking','W');
INSERT INTO t2 VALUES (396,112101,36,'assessor','Eskimoizeds','beasts','FAS');
INSERT INTO t2 VALUES (397,112102,36,'spiders','British','Witt','W');
INSERT INTO t2 VALUES (398,113701,36,'artificially','pitfalls','physicists','FAS');
INSERT INTO t2 VALUES (399,116001,36,'reminiscence','verify','folksong','A');
INSERT INTO t2 VALUES (400,116201,36,'Mexican','scatter','strokes','FAS');
INSERT INTO t2 VALUES (401,116301,36,'obnoxious','Aztecan','crowder','');
INSERT INTO t2 VALUES (402,116302,36,'fragile','acuity','merry','');
INSERT INTO t2 VALUES (403,116601,36,'apprehensible','sinking','cadenced','');
INSERT INTO t2 VALUES (404,116602,36,'births','beasts','alimony','A');
INSERT INTO t2 VALUES (405,116603,36,'garages','Witt','principled','A');
INSERT INTO t2 VALUES (406,116701,36,'panty','physicists','golfing','');
INSERT INTO t2 VALUES (407,116702,36,'anteater','folksong','undiscovered','');
INSERT INTO t2 VALUES (408,118001,36,'displacement','strokes','irritates','');
INSERT INTO t2 VALUES (409,118002,36,'drovers','crowder','patriots','A');
INSERT INTO t2 VALUES (410,118003,36,'patenting','merry','rooms','FAS');
INSERT INTO t2 VALUES (411,118004,36,'far','cadenced','towering','W');
INSERT INTO t2 VALUES (412,118005,36,'shrieks','alimony','displease','');
INSERT INTO t2 VALUES (413,118006,36,'aligning','principled','photosensitive','');
INSERT INTO t2 VALUES (414,118007,36,'pragmatism','golfing','inking','');
INSERT INTO t2 VALUES (415,118008,36,'fevers','undiscovered','gainers','');
INSERT INTO t2 VALUES (416,118101,36,'reexamines','irritates','leaning','A');
INSERT INTO t2 VALUES (417,118102,36,'occupancies','patriots','hydrant','A');
INSERT INTO t2 VALUES (418,118103,36,'sweats','rooms','preserve','');
INSERT INTO t2 VALUES (419,118202,36,'modulators','towering','blinded','A');
INSERT INTO t2 VALUES (420,118203,36,'demand','displease','interactions','A');
INSERT INTO t2 VALUES (421,118204,36,'Madeira','photosensitive','Barry','');
INSERT INTO t2 VALUES (422,118302,36,'Viennese','inking','whiteness','A');
INSERT INTO t2 VALUES (423,118304,36,'chillier','gainers','pastimes','W');
INSERT INTO t2 VALUES (424,118305,36,'wildcats','leaning','Edenization','');
INSERT INTO t2 VALUES (425,118306,36,'gentle','hydrant','Muscat','');
INSERT INTO t2 VALUES (426,118307,36,'Angles','preserve','assassinated','');
INSERT INTO t2 VALUES (427,123101,36,'accuracies','blinded','labeled','');
INSERT INTO t2 VALUES (428,123102,36,'toggle','interactions','glacial','A');
INSERT INTO t2 VALUES (429,123301,36,'Mendelssohn','Barry','implied','W');
INSERT INTO t2 VALUES (430,126001,36,'behaviorally','whiteness','bibliographies','W');
INSERT INTO t2 VALUES (431,126002,36,'Rochford','pastimes','Buchanan','');
INSERT INTO t2 VALUES (432,126003,36,'mirror','Edenization','forgivably','FAS');
INSERT INTO t2 VALUES (433,126101,36,'Modula','Muscat','innuendo','A');
INSERT INTO t2 VALUES (434,126301,36,'clobbering','assassinated','den','FAS');
INSERT INTO t2 VALUES (435,126302,36,'chronography','labeled','submarines','W');
INSERT INTO t2 VALUES (436,126402,36,'Eskimoizeds','glacial','mouthful','A');
INSERT INTO t2 VALUES (437,126601,36,'British','implied','expiring','');
INSERT INTO t2 VALUES (438,126602,36,'pitfalls','bibliographies','unfulfilled','FAS');
INSERT INTO t2 VALUES (439,126702,36,'verify','Buchanan','precession','');
INSERT INTO t2 VALUES (440,128001,36,'scatter','forgivably','nullified','');
INSERT INTO t2 VALUES (441,128002,36,'Aztecan','innuendo','affects','');
INSERT INTO t2 VALUES (442,128003,36,'acuity','den','Cynthia','');
INSERT INTO t2 VALUES (443,128004,36,'sinking','submarines','Chablis','A');
INSERT INTO t2 VALUES (444,128005,36,'beasts','mouthful','betterments','FAS');
INSERT INTO t2 VALUES (445,128007,36,'Witt','expiring','advertising','');
INSERT INTO t2 VALUES (446,128008,36,'physicists','unfulfilled','rubies','A');
INSERT INTO t2 VALUES (447,128009,36,'folksong','precession','southwest','FAS');
INSERT INTO t2 VALUES (448,128010,36,'strokes','nullified','superstitious','A');
INSERT INTO t2 VALUES (449,128011,36,'crowder','affects','tabernacle','W');
INSERT INTO t2 VALUES (450,128012,36,'merry','Cynthia','silk','A');
INSERT INTO t2 VALUES (451,128013,36,'cadenced','Chablis','handsomest','A');
INSERT INTO t2 VALUES (452,128014,36,'alimony','betterments','Persian','A');
INSERT INTO t2 VALUES (453,128015,36,'principled','advertising','analog','W');
INSERT INTO t2 VALUES (454,128016,36,'golfing','rubies','complex','W');
INSERT INTO t2 VALUES (455,128017,36,'undiscovered','southwest','Taoist','');
INSERT INTO t2 VALUES (456,128018,36,'irritates','superstitious','suspend','');
INSERT INTO t2 VALUES (457,128019,36,'patriots','tabernacle','relegated','');
INSERT INTO t2 VALUES (458,128020,36,'rooms','silk','awesome','W');
INSERT INTO t2 VALUES (459,128021,36,'towering','handsomest','Bruxelles','');
INSERT INTO t2 VALUES (460,128022,36,'displease','Persian','imprecisely','A');
INSERT INTO t2 VALUES (461,128023,36,'photosensitive','analog','televise','');
INSERT INTO t2 VALUES (462,128101,36,'inking','complex','braking','');
INSERT INTO t2 VALUES (463,128102,36,'gainers','Taoist','true','FAS');
INSERT INTO t2 VALUES (464,128103,36,'leaning','suspend','disappointing','FAS');
INSERT INTO t2 VALUES (465,128104,36,'hydrant','relegated','navally','W');
INSERT INTO t2 VALUES (466,128106,36,'preserve','awesome','circus','');
INSERT INTO t2 VALUES (467,128107,36,'blinded','Bruxelles','beetles','');
INSERT INTO t2 VALUES (468,128108,36,'interactions','imprecisely','trumps','');
INSERT INTO t2 VALUES (469,128202,36,'Barry','televise','fourscore','W');
INSERT INTO t2 VALUES (470,128203,36,'whiteness','braking','Blackfoots','');
INSERT INTO t2 VALUES (471,128301,36,'pastimes','true','Grady','');
INSERT INTO t2 VALUES (472,128302,36,'Edenization','disappointing','quiets','FAS');
INSERT INTO t2 VALUES (473,128303,36,'Muscat','navally','floundered','FAS');
INSERT INTO t2 VALUES (474,128304,36,'assassinated','circus','profundity','W');
INSERT INTO t2 VALUES (475,128305,36,'labeled','beetles','Garrisonian','W');
INSERT INTO t2 VALUES (476,128307,36,'glacial','trumps','Strauss','');
INSERT INTO t2 VALUES (477,128401,36,'implied','fourscore','cemented','FAS');
INSERT INTO t2 VALUES (478,128502,36,'bibliographies','Blackfoots','contrition','A');
INSERT INTO t2 VALUES (479,128503,36,'Buchanan','Grady','mutations','');
INSERT INTO t2 VALUES (480,128504,36,'forgivably','quiets','exhibits','W');
INSERT INTO t2 VALUES (481,128505,36,'innuendo','floundered','tits','');
INSERT INTO t2 VALUES (482,128601,36,'den','profundity','mate','A');
INSERT INTO t2 VALUES (483,128603,36,'submarines','Garrisonian','arches','');
INSERT INTO t2 VALUES (484,128604,36,'mouthful','Strauss','Moll','');
INSERT INTO t2 VALUES (485,128702,36,'expiring','cemented','ropers','');
INSERT INTO t2 VALUES (486,128703,36,'unfulfilled','contrition','bombast','');
INSERT INTO t2 VALUES (487,128704,36,'precession','mutations','difficultly','A');
INSERT INTO t2 VALUES (488,138001,36,'nullified','exhibits','adsorption','');
INSERT INTO t2 VALUES (489,138002,36,'affects','tits','definiteness','FAS');
INSERT INTO t2 VALUES (490,138003,36,'Cynthia','mate','cultivation','A');
INSERT INTO t2 VALUES (491,138004,36,'Chablis','arches','heals','A');
INSERT INTO t2 VALUES (492,138005,36,'betterments','Moll','Heusen','W');
INSERT INTO t2 VALUES (493,138006,36,'advertising','ropers','target','FAS');
INSERT INTO t2 VALUES (494,138007,36,'rubies','bombast','cited','A');
INSERT INTO t2 VALUES (495,138008,36,'southwest','difficultly','congresswoman','W');
INSERT INTO t2 VALUES (496,138009,36,'superstitious','adsorption','Katherine','');
INSERT INTO t2 VALUES (497,138102,36,'tabernacle','definiteness','titter','A');
INSERT INTO t2 VALUES (498,138103,36,'silk','cultivation','aspire','A');
INSERT INTO t2 VALUES (499,138104,36,'handsomest','heals','Mardis','');
INSERT INTO t2 VALUES (500,138105,36,'Persian','Heusen','Nadia','W');
INSERT INTO t2 VALUES (501,138201,36,'analog','target','estimating','FAS');
INSERT INTO t2 VALUES (502,138302,36,'complex','cited','stuck','A');
INSERT INTO t2 VALUES (503,138303,36,'Taoist','congresswoman','fifteenth','A');
INSERT INTO t2 VALUES (504,138304,36,'suspend','Katherine','Colombo','');
INSERT INTO t2 VALUES (505,138401,29,'relegated','titter','survey','A');
INSERT INTO t2 VALUES (506,140102,29,'awesome','aspire','staffing','');
INSERT INTO t2 VALUES (507,140103,29,'Bruxelles','Mardis','obtain','');
INSERT INTO t2 VALUES (508,140104,29,'imprecisely','Nadia','loaded','');
INSERT INTO t2 VALUES (509,140105,29,'televise','estimating','slaughtered','');
INSERT INTO t2 VALUES (510,140201,29,'braking','stuck','lights','A');
INSERT INTO t2 VALUES (511,140701,29,'true','fifteenth','circumference','');
INSERT INTO t2 VALUES (512,141501,29,'disappointing','Colombo','dull','A');
INSERT INTO t2 VALUES (513,141502,29,'navally','survey','weekly','A');
INSERT INTO t2 VALUES (514,141901,29,'circus','staffing','wetness','');
INSERT INTO t2 VALUES (515,141902,29,'beetles','obtain','visualized','');
INSERT INTO t2 VALUES (516,142101,29,'trumps','loaded','Tannenbaum','');
INSERT INTO t2 VALUES (517,142102,29,'fourscore','slaughtered','moribund','');
INSERT INTO t2 VALUES (518,142103,29,'Blackfoots','lights','demultiplex','');
INSERT INTO t2 VALUES (519,142701,29,'Grady','circumference','lockings','');
INSERT INTO t2 VALUES (520,143001,29,'quiets','dull','thugs','FAS');
INSERT INTO t2 VALUES (521,143501,29,'floundered','weekly','unnerves','');
INSERT INTO t2 VALUES (522,143502,29,'profundity','wetness','abut','');
INSERT INTO t2 VALUES (523,148001,29,'Garrisonian','visualized','Chippewa','A');
INSERT INTO t2 VALUES (524,148002,29,'Strauss','Tannenbaum','stratifications','A');
INSERT INTO t2 VALUES (525,148003,29,'cemented','moribund','signaled','');
INSERT INTO t2 VALUES (526,148004,29,'contrition','demultiplex','Italianizes','A');
INSERT INTO t2 VALUES (527,148005,29,'mutations','lockings','algorithmic','A');
INSERT INTO t2 VALUES (528,148006,29,'exhibits','thugs','paranoid','FAS');
INSERT INTO t2 VALUES (529,148007,29,'tits','unnerves','camping','A');
INSERT INTO t2 VALUES (530,148009,29,'mate','abut','signifying','A');
INSERT INTO t2 VALUES (531,148010,29,'arches','Chippewa','Patrice','W');
INSERT INTO t2 VALUES (532,148011,29,'Moll','stratifications','search','A');
INSERT INTO t2 VALUES (533,148012,29,'ropers','signaled','Angeles','A');
INSERT INTO t2 VALUES (534,148013,29,'bombast','Italianizes','semblance','');
INSERT INTO t2 VALUES (535,148023,36,'difficultly','algorithmic','taxed','');
INSERT INTO t2 VALUES (536,148015,29,'adsorption','paranoid','Beatrice','');
INSERT INTO t2 VALUES (537,148016,29,'definiteness','camping','retrace','');
INSERT INTO t2 VALUES (538,148017,29,'cultivation','signifying','lockout','');
INSERT INTO t2 VALUES (539,148018,29,'heals','Patrice','grammatic','');
INSERT INTO t2 VALUES (540,148019,29,'Heusen','search','helmsman','');
INSERT INTO t2 VALUES (541,148020,29,'target','Angeles','uniform','W');
INSERT INTO t2 VALUES (542,148021,29,'cited','semblance','hamming','');
INSERT INTO t2 VALUES (543,148022,29,'congresswoman','taxed','disobedience','');
INSERT INTO t2 VALUES (544,148101,29,'Katherine','Beatrice','captivated','A');
INSERT INTO t2 VALUES (545,148102,29,'titter','retrace','transferals','A');
INSERT INTO t2 VALUES (546,148201,29,'aspire','lockout','cartographer','A');
INSERT INTO t2 VALUES (547,148401,29,'Mardis','grammatic','aims','FAS');
INSERT INTO t2 VALUES (548,148402,29,'Nadia','helmsman','Pakistani','');
INSERT INTO t2 VALUES (549,148501,29,'estimating','uniform','burglarized','FAS');
INSERT INTO t2 VALUES (550,148502,29,'stuck','hamming','saucepans','A');
INSERT INTO t2 VALUES (551,148503,29,'fifteenth','disobedience','lacerating','A');
INSERT INTO t2 VALUES (552,148504,29,'Colombo','captivated','corny','');
INSERT INTO t2 VALUES (553,148601,29,'survey','transferals','megabytes','FAS');
INSERT INTO t2 VALUES (554,148602,29,'staffing','cartographer','chancellor','');
INSERT INTO t2 VALUES (555,150701,29,'obtain','aims','bulk','A');
INSERT INTO t2 VALUES (556,152101,29,'loaded','Pakistani','commits','A');
INSERT INTO t2 VALUES (557,152102,29,'slaughtered','burglarized','meson','W');
INSERT INTO t2 VALUES (558,155202,36,'lights','saucepans','deputies','');
INSERT INTO t2 VALUES (559,155203,29,'circumference','lacerating','northeaster','A');
INSERT INTO t2 VALUES (560,155204,29,'dull','corny','dipole','');
INSERT INTO t2 VALUES (561,155205,29,'weekly','megabytes','machining','0');
INSERT INTO t2 VALUES (562,156001,29,'wetness','chancellor','therefore','');
INSERT INTO t2 VALUES (563,156002,29,'visualized','bulk','Telefunken','');
INSERT INTO t2 VALUES (564,156102,29,'Tannenbaum','commits','salvaging','');
INSERT INTO t2 VALUES (565,156301,29,'moribund','meson','Corinthianizes','A');
INSERT INTO t2 VALUES (566,156302,29,'demultiplex','deputies','restlessly','A');
INSERT INTO t2 VALUES (567,156303,29,'lockings','northeaster','bromides','');
INSERT INTO t2 VALUES (568,156304,29,'thugs','dipole','generalized','A');
INSERT INTO t2 VALUES (569,156305,29,'unnerves','machining','mishaps','');
INSERT INTO t2 VALUES (570,156306,29,'abut','therefore','quelling','');
INSERT INTO t2 VALUES (571,156501,29,'Chippewa','Telefunken','spiritual','A');
INSERT INTO t2 VALUES (572,158001,29,'stratifications','salvaging','beguiles','FAS');
INSERT INTO t2 VALUES (573,158002,29,'signaled','Corinthianizes','Trobriand','FAS');
INSERT INTO t2 VALUES (574,158101,29,'Italianizes','restlessly','fleeing','A');
INSERT INTO t2 VALUES (575,158102,29,'algorithmic','bromides','Armour','A');
INSERT INTO t2 VALUES (576,158103,29,'paranoid','generalized','chin','A');
INSERT INTO t2 VALUES (577,158201,29,'camping','mishaps','provers','A');
INSERT INTO t2 VALUES (578,158202,29,'signifying','quelling','aeronautic','A');
INSERT INTO t2 VALUES (579,158203,29,'Patrice','spiritual','voltage','W');
INSERT INTO t2 VALUES (580,158204,29,'search','beguiles','sash','');
INSERT INTO t2 VALUES (581,158301,29,'Angeles','Trobriand','anaerobic','A');
INSERT INTO t2 VALUES (582,158302,29,'semblance','fleeing','simultaneous','A');
INSERT INTO t2 VALUES (583,158303,29,'taxed','Armour','accumulating','A');
INSERT INTO t2 VALUES (584,158304,29,'Beatrice','chin','Medusan','A');
INSERT INTO t2 VALUES (585,158305,29,'retrace','provers','shouted','A');
INSERT INTO t2 VALUES (586,158306,29,'lockout','aeronautic','freakish','');
INSERT INTO t2 VALUES (587,158501,29,'grammatic','voltage','index','FAS');
INSERT INTO t2 VALUES (588,160301,29,'helmsman','sash','commercially','');
INSERT INTO t2 VALUES (589,166101,50,'uniform','anaerobic','mistiness','A');
INSERT INTO t2 VALUES (590,166102,50,'hamming','simultaneous','endpoint','');
INSERT INTO t2 VALUES (591,168001,29,'disobedience','accumulating','straight','A');
INSERT INTO t2 VALUES (592,168002,29,'captivated','Medusan','flurried','');
INSERT INTO t2 VALUES (593,168003,29,'transferals','shouted','denotative','A');
INSERT INTO t2 VALUES (594,168101,29,'cartographer','freakish','coming','FAS');
INSERT INTO t2 VALUES (595,168102,29,'aims','index','commencements','FAS');
INSERT INTO t2 VALUES (596,168103,29,'Pakistani','commercially','gentleman','');
INSERT INTO t2 VALUES (597,168104,29,'burglarized','mistiness','gifted','');
INSERT INTO t2 VALUES (598,168202,29,'saucepans','endpoint','Shanghais','');
INSERT INTO t2 VALUES (599,168301,29,'lacerating','straight','sportswriting','A');
INSERT INTO t2 VALUES (600,168502,29,'corny','flurried','sloping','A');
INSERT INTO t2 VALUES (601,168503,29,'megabytes','denotative','navies','');
INSERT INTO t2 VALUES (602,168601,29,'chancellor','coming','leaflet','A');
INSERT INTO t2 VALUES (603,173001,40,'bulk','commencements','shooter','');
INSERT INTO t2 VALUES (604,173701,40,'commits','gentleman','Joplin','FAS');
INSERT INTO t2 VALUES (605,173702,40,'meson','gifted','babies','');
INSERT INTO t2 VALUES (606,176001,40,'deputies','Shanghais','subdivision','FAS');
INSERT INTO t2 VALUES (607,176101,40,'northeaster','sportswriting','burstiness','W');
INSERT INTO t2 VALUES (608,176201,40,'dipole','sloping','belted','FAS');
INSERT INTO t2 VALUES (609,176401,40,'machining','navies','assails','FAS');
INSERT INTO t2 VALUES (610,176501,40,'therefore','leaflet','admiring','W');
INSERT INTO t2 VALUES (611,176601,40,'Telefunken','shooter','swaying','0');
INSERT INTO t2 VALUES (612,176602,40,'salvaging','Joplin','Goldstine','FAS');
INSERT INTO t2 VALUES (613,176603,40,'Corinthianizes','babies','fitting','');
INSERT INTO t2 VALUES (614,178001,40,'restlessly','subdivision','Norwalk','W');
INSERT INTO t2 VALUES (615,178002,40,'bromides','burstiness','weakening','W');
INSERT INTO t2 VALUES (616,178003,40,'generalized','belted','analogy','FAS');
INSERT INTO t2 VALUES (617,178004,40,'mishaps','assails','deludes','');
INSERT INTO t2 VALUES (618,178005,40,'quelling','admiring','cokes','');
INSERT INTO t2 VALUES (619,178006,40,'spiritual','swaying','Clayton','');
INSERT INTO t2 VALUES (620,178007,40,'beguiles','Goldstine','exhausts','');
INSERT INTO t2 VALUES (621,178008,40,'Trobriand','fitting','causality','');
INSERT INTO t2 VALUES (622,178101,40,'fleeing','Norwalk','sating','FAS');
INSERT INTO t2 VALUES (623,178102,40,'Armour','weakening','icon','');
INSERT INTO t2 VALUES (624,178103,40,'chin','analogy','throttles','');
INSERT INTO t2 VALUES (625,178201,40,'provers','deludes','communicants','FAS');
INSERT INTO t2 VALUES (626,178202,40,'aeronautic','cokes','dehydrate','FAS');
INSERT INTO t2 VALUES (627,178301,40,'voltage','Clayton','priceless','FAS');
INSERT INTO t2 VALUES (628,178302,40,'sash','exhausts','publicly','');
INSERT INTO t2 VALUES (629,178401,40,'anaerobic','causality','incidentals','FAS');
INSERT INTO t2 VALUES (630,178402,40,'simultaneous','sating','commonplace','');
INSERT INTO t2 VALUES (631,178403,40,'accumulating','icon','mumbles','');
INSERT INTO t2 VALUES (632,178404,40,'Medusan','throttles','furthermore','W');
INSERT INTO t2 VALUES (633,178501,40,'shouted','communicants','cautioned','W');
INSERT INTO t2 VALUES (634,186002,37,'freakish','dehydrate','parametrized','A');
INSERT INTO t2 VALUES (635,186102,37,'index','priceless','registration','A');
INSERT INTO t2 VALUES (636,186201,40,'commercially','publicly','sadly','FAS');
INSERT INTO t2 VALUES (637,186202,40,'mistiness','incidentals','positioning','');
INSERT INTO t2 VALUES (638,186203,40,'endpoint','commonplace','babysitting','');
INSERT INTO t2 VALUES (639,186302,37,'straight','mumbles','eternal','A');
INSERT INTO t2 VALUES (640,188007,37,'flurried','furthermore','hoarder','');
INSERT INTO t2 VALUES (641,188008,37,'denotative','cautioned','congregates','');
INSERT INTO t2 VALUES (642,188009,37,'coming','parametrized','rains','');
INSERT INTO t2 VALUES (643,188010,37,'commencements','registration','workers','W');
INSERT INTO t2 VALUES (644,188011,37,'gentleman','sadly','sags','A');
INSERT INTO t2 VALUES (645,188012,37,'gifted','positioning','unplug','W');
INSERT INTO t2 VALUES (646,188013,37,'Shanghais','babysitting','garage','A');
INSERT INTO t2 VALUES (647,188014,37,'sportswriting','eternal','boulder','A');
INSERT INTO t2 VALUES (648,188015,37,'sloping','hoarder','hollowly','A');
INSERT INTO t2 VALUES (649,188016,37,'navies','congregates','specifics','');
INSERT INTO t2 VALUES (650,188017,37,'leaflet','rains','Teresa','');
INSERT INTO t2 VALUES (651,188102,37,'shooter','workers','Winsett','');
INSERT INTO t2 VALUES (652,188103,37,'Joplin','sags','convenient','A');
INSERT INTO t2 VALUES (653,188202,37,'babies','unplug','buckboards','FAS');
INSERT INTO t2 VALUES (654,188301,40,'subdivision','garage','amenities','');
INSERT INTO t2 VALUES (655,188302,40,'burstiness','boulder','resplendent','FAS');
INSERT INTO t2 VALUES (656,188303,40,'belted','hollowly','priding','FAS');
INSERT INTO t2 VALUES (657,188401,37,'assails','specifics','configurations','');
INSERT INTO t2 VALUES (658,188402,37,'admiring','Teresa','untidiness','A');
INSERT INTO t2 VALUES (659,188503,37,'swaying','Winsett','Brice','W');
INSERT INTO t2 VALUES (660,188504,37,'Goldstine','convenient','sews','FAS');
INSERT INTO t2 VALUES (661,188505,37,'fitting','buckboards','participated','');
INSERT INTO t2 VALUES (662,190701,37,'Norwalk','amenities','Simon','FAS');
INSERT INTO t2 VALUES (663,190703,50,'weakening','resplendent','certificates','');
INSERT INTO t2 VALUES (664,191701,37,'analogy','priding','Fitzpatrick','');
INSERT INTO t2 VALUES (665,191702,37,'deludes','configurations','Evanston','A');
INSERT INTO t2 VALUES (666,191703,37,'cokes','untidiness','misted','');
INSERT INTO t2 VALUES (667,196001,37,'Clayton','Brice','textures','A');
INSERT INTO t2 VALUES (668,196002,37,'exhausts','sews','save','');
INSERT INTO t2 VALUES (669,196003,37,'causality','participated','count','');
INSERT INTO t2 VALUES (670,196101,37,'sating','Simon','rightful','A');
INSERT INTO t2 VALUES (671,196103,37,'icon','certificates','chaperone','');
INSERT INTO t2 VALUES (672,196104,37,'throttles','Fitzpatrick','Lizzy','A');
INSERT INTO t2 VALUES (673,196201,37,'communicants','Evanston','clenched','A');
INSERT INTO t2 VALUES (674,196202,37,'dehydrate','misted','effortlessly','');
INSERT INTO t2 VALUES (675,196203,37,'priceless','textures','accessed','');
INSERT INTO t2 VALUES (676,198001,37,'publicly','save','beaters','A');
INSERT INTO t2 VALUES (677,198003,37,'incidentals','count','Hornblower','FAS');
INSERT INTO t2 VALUES (678,198004,37,'commonplace','rightful','vests','A');
INSERT INTO t2 VALUES (679,198005,37,'mumbles','chaperone','indulgences','FAS');
INSERT INTO t2 VALUES (680,198006,37,'furthermore','Lizzy','infallibly','A');
INSERT INTO t2 VALUES (681,198007,37,'cautioned','clenched','unwilling','FAS');
INSERT INTO t2 VALUES (682,198008,37,'parametrized','effortlessly','excrete','FAS');
INSERT INTO t2 VALUES (683,198009,37,'registration','accessed','spools','A');
INSERT INTO t2 VALUES (684,198010,37,'sadly','beaters','crunches','FAS');
INSERT INTO t2 VALUES (685,198011,37,'positioning','Hornblower','overestimating','FAS');
INSERT INTO t2 VALUES (686,198012,37,'babysitting','vests','ineffective','');
INSERT INTO t2 VALUES (687,198013,37,'eternal','indulgences','humiliation','A');
INSERT INTO t2 VALUES (688,198014,37,'hoarder','infallibly','sophomore','');
INSERT INTO t2 VALUES (689,198015,37,'congregates','unwilling','star','');
INSERT INTO t2 VALUES (690,198017,37,'rains','excrete','rifles','');
INSERT INTO t2 VALUES (691,198018,37,'workers','spools','dialysis','');
INSERT INTO t2 VALUES (692,198019,37,'sags','crunches','arriving','');
INSERT INTO t2 VALUES (693,198020,37,'unplug','overestimating','indulge','');
INSERT INTO t2 VALUES (694,198021,37,'garage','ineffective','clockers','');
INSERT INTO t2 VALUES (695,198022,37,'boulder','humiliation','languages','');
INSERT INTO t2 VALUES (696,198023,50,'hollowly','sophomore','Antarctica','A');
INSERT INTO t2 VALUES (697,198024,37,'specifics','star','percentage','');
INSERT INTO t2 VALUES (698,198101,37,'Teresa','rifles','ceiling','A');
INSERT INTO t2 VALUES (699,198103,37,'Winsett','dialysis','specification','');
INSERT INTO t2 VALUES (700,198105,37,'convenient','arriving','regimented','A');
INSERT INTO t2 VALUES (701,198106,37,'buckboards','indulge','ciphers','');
INSERT INTO t2 VALUES (702,198201,37,'amenities','clockers','pictures','A');
INSERT INTO t2 VALUES (703,198204,37,'resplendent','languages','serpents','A');
INSERT INTO t2 VALUES (704,198301,53,'priding','Antarctica','allot','A');
INSERT INTO t2 VALUES (705,198302,53,'configurations','percentage','realized','A');
INSERT INTO t2 VALUES (706,198303,53,'untidiness','ceiling','mayoral','A');
INSERT INTO t2 VALUES (707,198304,53,'Brice','specification','opaquely','A');
INSERT INTO t2 VALUES (708,198401,37,'sews','regimented','hostess','FAS');
INSERT INTO t2 VALUES (709,198402,37,'participated','ciphers','fiftieth','');
INSERT INTO t2 VALUES (710,198403,37,'Simon','pictures','incorrectly','');
INSERT INTO t2 VALUES (711,202101,37,'certificates','serpents','decomposition','FAS');
INSERT INTO t2 VALUES (712,202301,37,'Fitzpatrick','allot','stranglings','');
INSERT INTO t2 VALUES (713,202302,37,'Evanston','realized','mixture','FAS');
INSERT INTO t2 VALUES (714,202303,37,'misted','mayoral','electroencephalography','FAS');
INSERT INTO t2 VALUES (715,202304,37,'textures','opaquely','similarities','FAS');
INSERT INTO t2 VALUES (716,202305,37,'save','hostess','charges','W');
INSERT INTO t2 VALUES (717,202601,37,'count','fiftieth','freest','FAS');
INSERT INTO t2 VALUES (718,202602,37,'rightful','incorrectly','Greenberg','FAS');
INSERT INTO t2 VALUES (719,202605,37,'chaperone','decomposition','tinting','');
INSERT INTO t2 VALUES (720,202606,37,'Lizzy','stranglings','expelled','W');
INSERT INTO t2 VALUES (721,202607,37,'clenched','mixture','warm','');
INSERT INTO t2 VALUES (722,202901,37,'effortlessly','electroencephalography','smoothed','');
INSERT INTO t2 VALUES (723,202902,37,'accessed','similarities','deductions','FAS');
INSERT INTO t2 VALUES (724,202903,37,'beaters','charges','Romano','W');
INSERT INTO t2 VALUES (725,202904,37,'Hornblower','freest','bitterroot','');
INSERT INTO t2 VALUES (726,202907,37,'vests','Greenberg','corset','');
INSERT INTO t2 VALUES (727,202908,37,'indulgences','tinting','securing','');
INSERT INTO t2 VALUES (728,203101,37,'infallibly','expelled','environing','FAS');
INSERT INTO t2 VALUES (729,203103,37,'unwilling','warm','cute','');
INSERT INTO t2 VALUES (730,203104,37,'excrete','smoothed','Crays','');
INSERT INTO t2 VALUES (731,203105,37,'spools','deductions','heiress','FAS');
INSERT INTO t2 VALUES (732,203401,37,'crunches','Romano','inform','FAS');
INSERT INTO t2 VALUES (733,203402,37,'overestimating','bitterroot','avenge','');
INSERT INTO t2 VALUES (734,203404,37,'ineffective','corset','universals','');
INSERT INTO t2 VALUES (735,203901,37,'humiliation','securing','Kinsey','W');
INSERT INTO t2 VALUES (736,203902,37,'sophomore','environing','ravines','FAS');
INSERT INTO t2 VALUES (737,203903,37,'star','cute','bestseller','');
INSERT INTO t2 VALUES (738,203906,37,'rifles','Crays','equilibrium','');
INSERT INTO t2 VALUES (739,203907,37,'dialysis','heiress','extents','0');
INSERT INTO t2 VALUES (740,203908,37,'arriving','inform','relatively','');
INSERT INTO t2 VALUES (741,203909,37,'indulge','avenge','pressure','FAS');
INSERT INTO t2 VALUES (742,206101,37,'clockers','universals','critiques','FAS');
INSERT INTO t2 VALUES (743,206201,37,'languages','Kinsey','befouled','');
INSERT INTO t2 VALUES (744,206202,37,'Antarctica','ravines','rightfully','FAS');
INSERT INTO t2 VALUES (745,206203,37,'percentage','bestseller','mechanizing','FAS');
INSERT INTO t2 VALUES (746,206206,37,'ceiling','equilibrium','Latinizes','');
INSERT INTO t2 VALUES (747,206207,37,'specification','extents','timesharing','');
INSERT INTO t2 VALUES (748,206208,37,'regimented','relatively','Aden','');
INSERT INTO t2 VALUES (749,208001,37,'ciphers','pressure','embassies','');
INSERT INTO t2 VALUES (750,208002,37,'pictures','critiques','males','FAS');
INSERT INTO t2 VALUES (751,208003,37,'serpents','befouled','shapelessly','FAS');
INSERT INTO t2 VALUES (752,208004,37,'allot','rightfully','genres','FAS');
INSERT INTO t2 VALUES (753,208008,37,'realized','mechanizing','mastering','');
INSERT INTO t2 VALUES (754,208009,37,'mayoral','Latinizes','Newtonian','');
INSERT INTO t2 VALUES (755,208010,37,'opaquely','timesharing','finishers','FAS');
INSERT INTO t2 VALUES (756,208011,37,'hostess','Aden','abates','');
INSERT INTO t2 VALUES (757,208101,37,'fiftieth','embassies','teem','');
INSERT INTO t2 VALUES (758,208102,37,'incorrectly','males','kiting','FAS');
INSERT INTO t2 VALUES (759,208103,37,'decomposition','shapelessly','stodgy','FAS');
INSERT INTO t2 VALUES (760,208104,37,'stranglings','genres','scalps','FAS');
INSERT INTO t2 VALUES (761,208105,37,'mixture','mastering','feed','FAS');
INSERT INTO t2 VALUES (762,208110,37,'electroencephalography','Newtonian','guitars','');
INSERT INTO t2 VALUES (763,208111,37,'similarities','finishers','airships','');
INSERT INTO t2 VALUES (764,208112,37,'charges','abates','store','');
INSERT INTO t2 VALUES (765,208113,37,'freest','teem','denounces','');
INSERT INTO t2 VALUES (766,208201,37,'Greenberg','kiting','Pyle','FAS');
INSERT INTO t2 VALUES (767,208203,37,'tinting','stodgy','Saxony','');
INSERT INTO t2 VALUES (768,208301,37,'expelled','scalps','serializations','FAS');
INSERT INTO t2 VALUES (769,208302,37,'warm','feed','Peruvian','FAS');
INSERT INTO t2 VALUES (770,208305,37,'smoothed','guitars','taxonomically','FAS');
INSERT INTO t2 VALUES (771,208401,37,'deductions','airships','kingdom','A');
INSERT INTO t2 VALUES (772,208402,37,'Romano','store','stint','A');
INSERT INTO t2 VALUES (773,208403,37,'bitterroot','denounces','Sault','A');
INSERT INTO t2 VALUES (774,208404,37,'corset','Pyle','faithful','');
INSERT INTO t2 VALUES (775,208501,37,'securing','Saxony','Ganymede','FAS');
INSERT INTO t2 VALUES (776,208502,37,'environing','serializations','tidiness','FAS');
INSERT INTO t2 VALUES (777,208503,37,'cute','Peruvian','gainful','FAS');
INSERT INTO t2 VALUES (778,208504,37,'Crays','taxonomically','contrary','FAS');
INSERT INTO t2 VALUES (779,208505,37,'heiress','kingdom','Tipperary','FAS');
INSERT INTO t2 VALUES (780,210101,37,'inform','stint','tropics','W');
INSERT INTO t2 VALUES (781,210102,37,'avenge','Sault','theorizers','');
INSERT INTO t2 VALUES (782,210103,37,'universals','faithful','renew','0');
INSERT INTO t2 VALUES (783,210104,37,'Kinsey','Ganymede','already','');
INSERT INTO t2 VALUES (784,210105,37,'ravines','tidiness','terminal','');
INSERT INTO t2 VALUES (785,210106,37,'bestseller','gainful','Hegelian','');
INSERT INTO t2 VALUES (786,210107,37,'equilibrium','contrary','hypothesizer','');
INSERT INTO t2 VALUES (787,210401,37,'extents','Tipperary','warningly','FAS');
INSERT INTO t2 VALUES (788,213201,37,'relatively','tropics','journalizing','FAS');
INSERT INTO t2 VALUES (789,213203,37,'pressure','theorizers','nested','');
INSERT INTO t2 VALUES (790,213204,37,'critiques','renew','Lars','');
INSERT INTO t2 VALUES (791,213205,37,'befouled','already','saplings','');
INSERT INTO t2 VALUES (792,213206,37,'rightfully','terminal','foothill','');
INSERT INTO t2 VALUES (793,213207,37,'mechanizing','Hegelian','labeled','');
INSERT INTO t2 VALUES (794,216101,37,'Latinizes','hypothesizer','imperiously','FAS');
INSERT INTO t2 VALUES (795,216103,37,'timesharing','warningly','reporters','FAS');
INSERT INTO t2 VALUES (796,218001,37,'Aden','journalizing','furnishings','FAS');
INSERT INTO t2 VALUES (797,218002,37,'embassies','nested','precipitable','FAS');
INSERT INTO t2 VALUES (798,218003,37,'males','Lars','discounts','FAS');
INSERT INTO t2 VALUES (799,218004,37,'shapelessly','saplings','excises','FAS');
INSERT INTO t2 VALUES (800,143503,50,'genres','foothill','Stalin','');
INSERT INTO t2 VALUES (801,218006,37,'mastering','labeled','despot','FAS');
INSERT INTO t2 VALUES (802,218007,37,'Newtonian','imperiously','ripeness','FAS');
INSERT INTO t2 VALUES (803,218008,37,'finishers','reporters','Arabia','');
INSERT INTO t2 VALUES (804,218009,37,'abates','furnishings','unruly','');
INSERT INTO t2 VALUES (805,218010,37,'teem','precipitable','mournfulness','');
INSERT INTO t2 VALUES (806,218011,37,'kiting','discounts','boom','FAS');
INSERT INTO t2 VALUES (807,218020,37,'stodgy','excises','slaughter','A');
INSERT INTO t2 VALUES (808,218021,50,'scalps','Stalin','Sabine','');
INSERT INTO t2 VALUES (809,218022,37,'feed','despot','handy','FAS');
INSERT INTO t2 VALUES (810,218023,37,'guitars','ripeness','rural','');
INSERT INTO t2 VALUES (811,218024,37,'airships','Arabia','organizer','');
INSERT INTO t2 VALUES (812,218101,37,'store','unruly','shipyard','FAS');
INSERT INTO t2 VALUES (813,218102,37,'denounces','mournfulness','civics','FAS');
INSERT INTO t2 VALUES (814,218103,37,'Pyle','boom','inaccuracy','FAS');
INSERT INTO t2 VALUES (815,218201,37,'Saxony','slaughter','rules','FAS');
INSERT INTO t2 VALUES (816,218202,37,'serializations','Sabine','juveniles','FAS');
INSERT INTO t2 VALUES (817,218203,37,'Peruvian','handy','comprised','W');
INSERT INTO t2 VALUES (818,218204,37,'taxonomically','rural','investigations','');
INSERT INTO t2 VALUES (819,218205,37,'kingdom','organizer','stabilizes','A');
INSERT INTO t2 VALUES (820,218301,37,'stint','shipyard','seminaries','FAS');
INSERT INTO t2 VALUES (821,218302,37,'Sault','civics','Hunter','A');
INSERT INTO t2 VALUES (822,218401,37,'faithful','inaccuracy','sporty','FAS');
INSERT INTO t2 VALUES (823,218402,37,'Ganymede','rules','test','FAS');
INSERT INTO t2 VALUES (824,218403,37,'tidiness','juveniles','weasels','');
INSERT INTO t2 VALUES (825,218404,37,'gainful','comprised','CERN','');
INSERT INTO t2 VALUES (826,218407,37,'contrary','investigations','tempering','');
INSERT INTO t2 VALUES (827,218408,37,'Tipperary','stabilizes','afore','FAS');
INSERT INTO t2 VALUES (828,218409,37,'tropics','seminaries','Galatean','');
INSERT INTO t2 VALUES (829,218410,37,'theorizers','Hunter','techniques','W');
INSERT INTO t2 VALUES (830,226001,37,'renew','sporty','error','');
INSERT INTO t2 VALUES (831,226002,37,'already','test','veranda','');
INSERT INTO t2 VALUES (832,226003,37,'terminal','weasels','severely','');
INSERT INTO t2 VALUES (833,226004,37,'Hegelian','CERN','Cassites','FAS');
INSERT INTO t2 VALUES (834,226005,37,'hypothesizer','tempering','forthcoming','');
INSERT INTO t2 VALUES (835,226006,37,'warningly','afore','guides','');
INSERT INTO t2 VALUES (836,226007,37,'journalizing','Galatean','vanish','FAS');
INSERT INTO t2 VALUES (837,226008,37,'nested','techniques','lied','A');
INSERT INTO t2 VALUES (838,226203,37,'Lars','error','sawtooth','FAS');
INSERT INTO t2 VALUES (839,226204,37,'saplings','veranda','fated','FAS');
INSERT INTO t2 VALUES (840,226205,37,'foothill','severely','gradually','');
INSERT INTO t2 VALUES (841,226206,37,'labeled','Cassites','widens','');
INSERT INTO t2 VALUES (842,226207,37,'imperiously','forthcoming','preclude','');
INSERT INTO t2 VALUES (843,226208,37,'reporters','guides','Jobrel','');
INSERT INTO t2 VALUES (844,226209,37,'furnishings','vanish','hooker','');
INSERT INTO t2 VALUES (845,226210,37,'precipitable','lied','rainstorm','');
INSERT INTO t2 VALUES (846,226211,37,'discounts','sawtooth','disconnects','');
INSERT INTO t2 VALUES (847,228001,37,'excises','fated','cruelty','');
INSERT INTO t2 VALUES (848,228004,37,'Stalin','gradually','exponentials','A');
INSERT INTO t2 VALUES (849,228005,37,'despot','widens','affective','A');
INSERT INTO t2 VALUES (850,228006,37,'ripeness','preclude','arteries','');
INSERT INTO t2 VALUES (851,228007,37,'Arabia','Jobrel','Crosby','FAS');
INSERT INTO t2 VALUES (852,228008,37,'unruly','hooker','acquaint','');
INSERT INTO t2 VALUES (853,228009,37,'mournfulness','rainstorm','evenhandedly','');
INSERT INTO t2 VALUES (854,228101,37,'boom','disconnects','percentage','');
INSERT INTO t2 VALUES (855,228108,37,'slaughter','cruelty','disobedience','');
INSERT INTO t2 VALUES (856,228109,37,'Sabine','exponentials','humility','');
INSERT INTO t2 VALUES (857,228110,37,'handy','affective','gleaning','A');
INSERT INTO t2 VALUES (858,228111,37,'rural','arteries','petted','A');
INSERT INTO t2 VALUES (859,228112,37,'organizer','Crosby','bloater','A');
INSERT INTO t2 VALUES (860,228113,37,'shipyard','acquaint','minion','A');
INSERT INTO t2 VALUES (861,228114,37,'civics','evenhandedly','marginal','A');
INSERT INTO t2 VALUES (862,228115,37,'inaccuracy','percentage','apiary','A');
INSERT INTO t2 VALUES (863,228116,37,'rules','disobedience','measures','');
INSERT INTO t2 VALUES (864,228117,37,'juveniles','humility','precaution','');
INSERT INTO t2 VALUES (865,228118,37,'comprised','gleaning','repelled','');
INSERT INTO t2 VALUES (866,228119,37,'investigations','petted','primary','FAS');
INSERT INTO t2 VALUES (867,228120,37,'stabilizes','bloater','coverings','');
INSERT INTO t2 VALUES (868,228121,37,'seminaries','minion','Artemia','A');
INSERT INTO t2 VALUES (869,228122,37,'Hunter','marginal','navigate','');
INSERT INTO t2 VALUES (870,228201,37,'sporty','apiary','spatial','');
INSERT INTO t2 VALUES (871,228206,37,'test','measures','Gurkha','');
INSERT INTO t2 VALUES (872,228207,37,'weasels','precaution','meanwhile','A');
INSERT INTO t2 VALUES (873,228208,37,'CERN','repelled','Melinda','A');
INSERT INTO t2 VALUES (874,228209,37,'tempering','primary','Butterfield','');
INSERT INTO t2 VALUES (875,228210,37,'afore','coverings','Aldrich','A');
INSERT INTO t2 VALUES (876,228211,37,'Galatean','Artemia','previewing','A');
INSERT INTO t2 VALUES (877,228212,37,'techniques','navigate','glut','A');
INSERT INTO t2 VALUES (878,228213,37,'error','spatial','unaffected','');
INSERT INTO t2 VALUES (879,228214,37,'veranda','Gurkha','inmate','');
INSERT INTO t2 VALUES (880,228301,37,'severely','meanwhile','mineral','');
INSERT INTO t2 VALUES (881,228305,37,'Cassites','Melinda','impending','A');
INSERT INTO t2 VALUES (882,228306,37,'forthcoming','Butterfield','meditation','A');
INSERT INTO t2 VALUES (883,228307,37,'guides','Aldrich','ideas','');
INSERT INTO t2 VALUES (884,228308,37,'vanish','previewing','miniaturizes','W');
INSERT INTO t2 VALUES (885,228309,37,'lied','glut','lewdly','');
INSERT INTO t2 VALUES (886,228310,37,'sawtooth','unaffected','title','');
INSERT INTO t2 VALUES (887,228311,37,'fated','inmate','youthfulness','');
INSERT INTO t2 VALUES (888,228312,37,'gradually','mineral','creak','FAS');
INSERT INTO t2 VALUES (889,228313,37,'widens','impending','Chippewa','');
INSERT INTO t2 VALUES (890,228314,37,'preclude','meditation','clamored','');
INSERT INTO t2 VALUES (891,228401,65,'Jobrel','ideas','freezes','');
INSERT INTO t2 VALUES (892,228402,65,'hooker','miniaturizes','forgivably','FAS');
INSERT INTO t2 VALUES (893,228403,65,'rainstorm','lewdly','reduce','FAS');
INSERT INTO t2 VALUES (894,228404,65,'disconnects','title','McGovern','W');
INSERT INTO t2 VALUES (895,228405,65,'cruelty','youthfulness','Nazis','W');
INSERT INTO t2 VALUES (896,228406,65,'exponentials','creak','epistle','W');
INSERT INTO t2 VALUES (897,228407,65,'affective','Chippewa','socializes','W');
INSERT INTO t2 VALUES (898,228408,65,'arteries','clamored','conceptions','');
INSERT INTO t2 VALUES (899,228409,65,'Crosby','freezes','Kevin','');
INSERT INTO t2 VALUES (900,228410,65,'acquaint','forgivably','uncovering','');
INSERT INTO t2 VALUES (901,230301,37,'evenhandedly','reduce','chews','FAS');
INSERT INTO t2 VALUES (902,230302,37,'percentage','McGovern','appendixes','FAS');
INSERT INTO t2 VALUES (903,230303,37,'disobedience','Nazis','raining','');
INSERT INTO t2 VALUES (904,018062,37,'humility','epistle','infest','');
INSERT INTO t2 VALUES (905,230501,37,'gleaning','socializes','compartment','');
INSERT INTO t2 VALUES (906,230502,37,'petted','conceptions','minting','');
INSERT INTO t2 VALUES (907,230503,37,'bloater','Kevin','ducks','');
INSERT INTO t2 VALUES (908,230504,37,'minion','uncovering','roped','A');
INSERT INTO t2 VALUES (909,230505,37,'marginal','chews','waltz','');
INSERT INTO t2 VALUES (910,230506,37,'apiary','appendixes','Lillian','');
INSERT INTO t2 VALUES (911,230507,37,'measures','raining','repressions','A');
INSERT INTO t2 VALUES (912,230508,37,'precaution','infest','chillingly','');
INSERT INTO t2 VALUES (913,230509,37,'repelled','compartment','noncritical','');
INSERT INTO t2 VALUES (914,230901,37,'primary','minting','lithograph','');
INSERT INTO t2 VALUES (915,230902,37,'coverings','ducks','spongers','');
INSERT INTO t2 VALUES (916,230903,37,'Artemia','roped','parenthood','');
INSERT INTO t2 VALUES (917,230904,37,'navigate','waltz','posed','');
INSERT INTO t2 VALUES (918,230905,37,'spatial','Lillian','instruments','');
INSERT INTO t2 VALUES (919,230906,37,'Gurkha','repressions','filial','');
INSERT INTO t2 VALUES (920,230907,37,'meanwhile','chillingly','fixedly','');
INSERT INTO t2 VALUES (921,230908,37,'Melinda','noncritical','relives','');
INSERT INTO t2 VALUES (922,230909,37,'Butterfield','lithograph','Pandora','');
INSERT INTO t2 VALUES (923,230910,37,'Aldrich','spongers','watering','A');
INSERT INTO t2 VALUES (924,230911,37,'previewing','parenthood','ungrateful','');
INSERT INTO t2 VALUES (925,230912,37,'glut','posed','secures','');
INSERT INTO t2 VALUES (926,230913,37,'unaffected','instruments','chastisers','');
INSERT INTO t2 VALUES (927,230914,37,'inmate','filial','icon','');
INSERT INTO t2 VALUES (928,231304,37,'mineral','fixedly','reuniting','A');
INSERT INTO t2 VALUES (929,231305,37,'impending','relives','imagining','A');
INSERT INTO t2 VALUES (930,231306,37,'meditation','Pandora','abiding','A');
INSERT INTO t2 VALUES (931,231307,37,'ideas','watering','omnisciently','');
INSERT INTO t2 VALUES (932,231308,37,'miniaturizes','ungrateful','Britannic','');
INSERT INTO t2 VALUES (933,231309,37,'lewdly','secures','scholastics','A');
INSERT INTO t2 VALUES (934,231310,37,'title','chastisers','mechanics','A');
INSERT INTO t2 VALUES (935,231311,37,'youthfulness','icon','humidly','A');
INSERT INTO t2 VALUES (936,231312,37,'creak','reuniting','masterpiece','');
INSERT INTO t2 VALUES (937,231313,37,'Chippewa','imagining','however','');
INSERT INTO t2 VALUES (938,231314,37,'clamored','abiding','Mendelian','');
INSERT INTO t2 VALUES (939,231315,37,'freezes','omnisciently','jarred','');
INSERT INTO t2 VALUES (940,232102,37,'forgivably','Britannic','scolds','');
INSERT INTO t2 VALUES (941,232103,37,'reduce','scholastics','infatuate','');
INSERT INTO t2 VALUES (942,232104,37,'McGovern','mechanics','willed','A');
INSERT INTO t2 VALUES (943,232105,37,'Nazis','humidly','joyfully','');
INSERT INTO t2 VALUES (944,232106,37,'epistle','masterpiece','Microsoft','');
INSERT INTO t2 VALUES (945,232107,37,'socializes','however','fibrosities','');
INSERT INTO t2 VALUES (946,232108,37,'conceptions','Mendelian','Baltimorean','');
INSERT INTO t2 VALUES (947,232601,37,'Kevin','jarred','equestrian','');
INSERT INTO t2 VALUES (948,232602,37,'uncovering','scolds','Goodrich','');
INSERT INTO t2 VALUES (949,232603,37,'chews','infatuate','apish','A');
INSERT INTO t2 VALUES (950,232605,37,'appendixes','willed','Adlerian','');
INSERT INTO t2 VALUES (5950,1232605,37,'appendixes','willed','Adlerian','');
INSERT INTO t2 VALUES (5951,1232606,37,'appendixes','willed','Adlerian','');
INSERT INTO t2 VALUES (5952,1232607,37,'appendixes','willed','Adlerian','');
INSERT INTO t2 VALUES (5953,1232608,37,'appendixes','willed','Adlerian','');
INSERT INTO t2 VALUES (5954,1232609,37,'appendixes','willed','Adlerian','');
INSERT INTO t2 VALUES (951,232606,37,'raining','joyfully','Tropez','');
INSERT INTO t2 VALUES (952,232607,37,'infest','Microsoft','nouns','');
INSERT INTO t2 VALUES (953,232608,37,'compartment','fibrosities','distracting','');
INSERT INTO t2 VALUES (954,232609,37,'minting','Baltimorean','mutton','');
INSERT INTO t2 VALUES (955,236104,37,'ducks','equestrian','bridgeable','A');
INSERT INTO t2 VALUES (956,236105,37,'roped','Goodrich','stickers','A');
INSERT INTO t2 VALUES (957,236106,37,'waltz','apish','transcontinental','A');
INSERT INTO t2 VALUES (958,236107,37,'Lillian','Adlerian','amateurish','');
INSERT INTO t2 VALUES (959,236108,37,'repressions','Tropez','Gandhian','');
INSERT INTO t2 VALUES (960,236109,37,'chillingly','nouns','stratified','');
INSERT INTO t2 VALUES (961,236110,37,'noncritical','distracting','chamberlains','');
INSERT INTO t2 VALUES (962,236111,37,'lithograph','mutton','creditably','');
INSERT INTO t2 VALUES (963,236112,37,'spongers','bridgeable','philosophic','');
INSERT INTO t2 VALUES (964,236113,37,'parenthood','stickers','ores','');
INSERT INTO t2 VALUES (965,238005,37,'posed','transcontinental','Carleton','');
INSERT INTO t2 VALUES (966,238006,37,'instruments','amateurish','tape','A');
INSERT INTO t2 VALUES (967,238007,37,'filial','Gandhian','afloat','A');
INSERT INTO t2 VALUES (968,238008,37,'fixedly','stratified','goodness','A');
INSERT INTO t2 VALUES (969,238009,37,'relives','chamberlains','welcoming','');
INSERT INTO t2 VALUES (970,238010,37,'Pandora','creditably','Pinsky','FAS');
INSERT INTO t2 VALUES (971,238011,37,'watering','philosophic','halting','');
INSERT INTO t2 VALUES (972,238012,37,'ungrateful','ores','bibliography','');
INSERT INTO t2 VALUES (973,238013,37,'secures','Carleton','decoding','');
INSERT INTO t2 VALUES (974,240401,41,'chastisers','tape','variance','A');
INSERT INTO t2 VALUES (975,240402,41,'icon','afloat','allowed','A');
INSERT INTO t2 VALUES (976,240901,41,'reuniting','goodness','dire','A');
INSERT INTO t2 VALUES (977,240902,41,'imagining','welcoming','dub','A');
INSERT INTO t2 VALUES (978,241801,41,'abiding','Pinsky','poisoning','');
INSERT INTO t2 VALUES (979,242101,41,'omnisciently','halting','Iraqis','A');
INSERT INTO t2 VALUES (980,242102,41,'Britannic','bibliography','heaving','');
INSERT INTO t2 VALUES (981,242201,41,'scholastics','decoding','population','A');
INSERT INTO t2 VALUES (982,242202,41,'mechanics','variance','bomb','A');
INSERT INTO t2 VALUES (983,242501,41,'humidly','allowed','Majorca','A');
INSERT INTO t2 VALUES (984,242502,41,'masterpiece','dire','Gershwins','');
INSERT INTO t2 VALUES (985,246201,41,'however','dub','explorers','');
INSERT INTO t2 VALUES (986,246202,41,'Mendelian','poisoning','libretto','A');
INSERT INTO t2 VALUES (987,246203,41,'jarred','Iraqis','occurred','');
INSERT INTO t2 VALUES (988,246204,41,'scolds','heaving','Lagos','');
INSERT INTO t2 VALUES (989,246205,41,'infatuate','population','rats','');
INSERT INTO t2 VALUES (990,246301,41,'willed','bomb','bankruptcies','A');
INSERT INTO t2 VALUES (991,246302,41,'joyfully','Majorca','crying','');
INSERT INTO t2 VALUES (992,248001,41,'Microsoft','Gershwins','unexpected','');
INSERT INTO t2 VALUES (993,248002,41,'fibrosities','explorers','accessed','A');
INSERT INTO t2 VALUES (994,248003,41,'Baltimorean','libretto','colorful','A');
INSERT INTO t2 VALUES (995,248004,41,'equestrian','occurred','versatility','A');
INSERT INTO t2 VALUES (996,248005,41,'Goodrich','Lagos','cosy','');
INSERT INTO t2 VALUES (997,248006,41,'apish','rats','Darius','A');
INSERT INTO t2 VALUES (998,248007,41,'Adlerian','bankruptcies','mastering','A');
INSERT INTO t2 VALUES (999,248008,41,'Tropez','crying','Asiaticizations','A');
INSERT INTO t2 VALUES (1000,248009,41,'nouns','unexpected','offerers','A');
INSERT INTO t2 VALUES (1001,248010,41,'distracting','accessed','uncles','A');
INSERT INTO t2 VALUES (1002,248011,41,'mutton','colorful','sleepwalk','');
INSERT INTO t2 VALUES (1003,248012,41,'bridgeable','versatility','Ernestine','');
INSERT INTO t2 VALUES (1004,248013,41,'stickers','cosy','checksumming','');
INSERT INTO t2 VALUES (1005,248014,41,'transcontinental','Darius','stopped','');
INSERT INTO t2 VALUES (1006,248015,41,'amateurish','mastering','sicker','');
INSERT INTO t2 VALUES (1007,248016,41,'Gandhian','Asiaticizations','Italianization','');
INSERT INTO t2 VALUES (1008,248017,41,'stratified','offerers','alphabetic','');
INSERT INTO t2 VALUES (1009,248018,41,'chamberlains','uncles','pharmaceutic','');
INSERT INTO t2 VALUES (1010,248019,41,'creditably','sleepwalk','creator','');
INSERT INTO t2 VALUES (1011,248020,41,'philosophic','Ernestine','chess','');
INSERT INTO t2 VALUES (1012,248021,41,'ores','checksumming','charcoal','');
INSERT INTO t2 VALUES (1013,248101,41,'Carleton','stopped','Epiphany','A');
INSERT INTO t2 VALUES (1014,248102,41,'tape','sicker','bulldozes','A');
INSERT INTO t2 VALUES (1015,248201,41,'afloat','Italianization','Pygmalion','A');
INSERT INTO t2 VALUES (1016,248202,41,'goodness','alphabetic','caressing','A');
INSERT INTO t2 VALUES (1017,248203,41,'welcoming','pharmaceutic','Palestine','A');
INSERT INTO t2 VALUES (1018,248204,41,'Pinsky','creator','regimented','A');
INSERT INTO t2 VALUES (1019,248205,41,'halting','chess','scars','A');
INSERT INTO t2 VALUES (1020,248206,41,'bibliography','charcoal','realest','A');
INSERT INTO t2 VALUES (1021,248207,41,'decoding','Epiphany','diffusing','A');
INSERT INTO t2 VALUES (1022,248208,41,'variance','bulldozes','clubroom','A');
INSERT INTO t2 VALUES (1023,248209,41,'allowed','Pygmalion','Blythe','A');
INSERT INTO t2 VALUES (1024,248210,41,'dire','caressing','ahead','');
INSERT INTO t2 VALUES (1025,248211,50,'dub','Palestine','reviver','');
INSERT INTO t2 VALUES (1026,250501,34,'poisoning','regimented','retransmitting','A');
INSERT INTO t2 VALUES (1027,250502,34,'Iraqis','scars','landslide','');
INSERT INTO t2 VALUES (1028,250503,34,'heaving','realest','Eiffel','');
INSERT INTO t2 VALUES (1029,250504,34,'population','diffusing','absentee','');
INSERT INTO t2 VALUES (1030,250505,34,'bomb','clubroom','aye','');
INSERT INTO t2 VALUES (1031,250601,34,'Majorca','Blythe','forked','A');
INSERT INTO t2 VALUES (1032,250602,34,'Gershwins','ahead','Peruvianizes','');
INSERT INTO t2 VALUES (1033,250603,34,'explorers','reviver','clerked','');
INSERT INTO t2 VALUES (1034,250604,34,'libretto','retransmitting','tutor','');
INSERT INTO t2 VALUES (1035,250605,34,'occurred','landslide','boulevard','');
INSERT INTO t2 VALUES (1036,251001,34,'Lagos','Eiffel','shuttered','');
INSERT INTO t2 VALUES (1037,251002,34,'rats','absentee','quotes','A');
INSERT INTO t2 VALUES (1038,251003,34,'bankruptcies','aye','Caltech','');
INSERT INTO t2 VALUES (1039,251004,34,'crying','forked','Mossberg','');
INSERT INTO t2 VALUES (1040,251005,34,'unexpected','Peruvianizes','kept','');
INSERT INTO t2 VALUES (1041,251301,34,'accessed','clerked','roundly','');
INSERT INTO t2 VALUES (1042,251302,34,'colorful','tutor','features','A');
INSERT INTO t2 VALUES (1043,251303,34,'versatility','boulevard','imaginable','A');
INSERT INTO t2 VALUES (1044,251304,34,'cosy','shuttered','controller','');
INSERT INTO t2 VALUES (1045,251305,34,'Darius','quotes','racial','');
INSERT INTO t2 VALUES (1046,251401,34,'mastering','Caltech','uprisings','A');
INSERT INTO t2 VALUES (1047,251402,34,'Asiaticizations','Mossberg','narrowed','A');
INSERT INTO t2 VALUES (1048,251403,34,'offerers','kept','cannot','A');
INSERT INTO t2 VALUES (1049,251404,34,'uncles','roundly','vest','');
INSERT INTO t2 VALUES (1050,251405,34,'sleepwalk','features','famine','');
INSERT INTO t2 VALUES (1051,251406,34,'Ernestine','imaginable','sugars','');
INSERT INTO t2 VALUES (1052,251801,34,'checksumming','controller','exterminated','A');
INSERT INTO t2 VALUES (1053,251802,34,'stopped','racial','belays','');
INSERT INTO t2 VALUES (1054,252101,34,'sicker','uprisings','Hodges','A');
INSERT INTO t2 VALUES (1055,252102,34,'Italianization','narrowed','translatable','');
INSERT INTO t2 VALUES (1056,252301,34,'alphabetic','cannot','duality','A');
INSERT INTO t2 VALUES (1057,252302,34,'pharmaceutic','vest','recording','A');
INSERT INTO t2 VALUES (1058,252303,34,'creator','famine','rouses','A');
INSERT INTO t2 VALUES (1059,252304,34,'chess','sugars','poison','');
INSERT INTO t2 VALUES (1060,252305,34,'charcoal','exterminated','attitude','');
INSERT INTO t2 VALUES (1061,252306,34,'Epiphany','belays','dusted','');
INSERT INTO t2 VALUES (1062,252307,34,'bulldozes','Hodges','encompasses','');
INSERT INTO t2 VALUES (1063,252308,34,'Pygmalion','translatable','presentation','');
INSERT INTO t2 VALUES (1064,252309,34,'caressing','duality','Kantian','');
INSERT INTO t2 VALUES (1065,256001,34,'Palestine','recording','imprecision','A');
INSERT INTO t2 VALUES (1066,256002,34,'regimented','rouses','saving','');
INSERT INTO t2 VALUES (1067,256003,34,'scars','poison','maternal','');
INSERT INTO t2 VALUES (1068,256004,34,'realest','attitude','hewed','');
INSERT INTO t2 VALUES (1069,256005,34,'diffusing','dusted','kerosene','');
INSERT INTO t2 VALUES (1070,258001,34,'clubroom','encompasses','Cubans','');
INSERT INTO t2 VALUES (1071,258002,34,'Blythe','presentation','photographers','');
INSERT INTO t2 VALUES (1072,258003,34,'ahead','Kantian','nymph','A');
INSERT INTO t2 VALUES (1073,258004,34,'reviver','imprecision','bedlam','A');
INSERT INTO t2 VALUES (1074,258005,34,'retransmitting','saving','north','A');
INSERT INTO t2 VALUES (1075,258006,34,'landslide','maternal','Schoenberg','A');
INSERT INTO t2 VALUES (1076,258007,34,'Eiffel','hewed','botany','A');
INSERT INTO t2 VALUES (1077,258008,34,'absentee','kerosene','curs','');
INSERT INTO t2 VALUES (1078,258009,34,'aye','Cubans','solidification','');
INSERT INTO t2 VALUES (1079,258010,34,'forked','photographers','inheritresses','');
INSERT INTO t2 VALUES (1080,258011,34,'Peruvianizes','nymph','stiller','');
INSERT INTO t2 VALUES (1081,258101,68,'clerked','bedlam','t1','A');
INSERT INTO t2 VALUES (1082,258102,68,'tutor','north','suite','A');
INSERT INTO t2 VALUES (1083,258103,34,'boulevard','Schoenberg','ransomer','');
INSERT INTO t2 VALUES (1084,258104,68,'shuttered','botany','Willy','');
INSERT INTO t2 VALUES (1085,258105,68,'quotes','curs','Rena','A');
INSERT INTO t2 VALUES (1086,258106,68,'Caltech','solidification','Seattle','A');
INSERT INTO t2 VALUES (1087,258107,68,'Mossberg','inheritresses','relaxes','A');
INSERT INTO t2 VALUES (1088,258108,68,'kept','stiller','exclaim','');
INSERT INTO t2 VALUES (1089,258109,68,'roundly','t1','implicated','A');
INSERT INTO t2 VALUES (1090,258110,68,'features','suite','distinguish','');
INSERT INTO t2 VALUES (1091,258111,68,'imaginable','ransomer','assayed','');
INSERT INTO t2 VALUES (1092,258112,68,'controller','Willy','homeowner','');
INSERT INTO t2 VALUES (1093,258113,68,'racial','Rena','and','');
INSERT INTO t2 VALUES (1094,258201,34,'uprisings','Seattle','stealth','');
INSERT INTO t2 VALUES (1095,258202,34,'narrowed','relaxes','coinciding','A');
INSERT INTO t2 VALUES (1096,258203,34,'cannot','exclaim','founder','A');
INSERT INTO t2 VALUES (1097,258204,34,'vest','implicated','environing','');
INSERT INTO t2 VALUES (1098,258205,34,'famine','distinguish','jewelry','');
INSERT INTO t2 VALUES (1099,258301,34,'sugars','assayed','lemons','A');
INSERT INTO t2 VALUES (1100,258401,34,'exterminated','homeowner','brokenness','A');
INSERT INTO t2 VALUES (1101,258402,34,'belays','and','bedpost','A');
INSERT INTO t2 VALUES (1102,258403,34,'Hodges','stealth','assurers','A');
INSERT INTO t2 VALUES (1103,258404,34,'translatable','coinciding','annoyers','');
INSERT INTO t2 VALUES (1104,258405,34,'duality','founder','affixed','');
INSERT INTO t2 VALUES (1105,258406,34,'recording','environing','warbling','');
INSERT INTO t2 VALUES (1106,258407,34,'rouses','jewelry','seriously','');
INSERT INTO t2 VALUES (1107,228123,37,'poison','lemons','boasted','');
INSERT INTO t2 VALUES (1108,250606,34,'attitude','brokenness','Chantilly','');
INSERT INTO t2 VALUES (1109,208405,37,'dusted','bedpost','Iranizes','');
INSERT INTO t2 VALUES (1110,212101,37,'encompasses','assurers','violinist','');
INSERT INTO t2 VALUES (1111,218206,37,'presentation','annoyers','extramarital','');
INSERT INTO t2 VALUES (1112,150401,37,'Kantian','affixed','spates','');
INSERT INTO t2 VALUES (1113,248212,41,'imprecision','warbling','cloakroom','');
INSERT INTO t2 VALUES (1114,128026,00,'saving','seriously','gazer','');
INSERT INTO t2 VALUES (1115,128024,00,'maternal','boasted','hand','');
INSERT INTO t2 VALUES (1116,128027,00,'hewed','Chantilly','tucked','');
INSERT INTO t2 VALUES (1117,128025,00,'kerosene','Iranizes','gems','');
INSERT INTO t2 VALUES (1118,128109,00,'Cubans','violinist','clinker','');
INSERT INTO t2 VALUES (1119,128705,00,'photographers','extramarital','refiner','');
INSERT INTO t2 VALUES (1120,126303,00,'nymph','spates','callus','');
INSERT INTO t2 VALUES (1121,128308,00,'bedlam','cloakroom','leopards','');
INSERT INTO t2 VALUES (1122,128204,00,'north','gazer','comfortingly','');
INSERT INTO t2 VALUES (1123,128205,00,'Schoenberg','hand','generically','');
INSERT INTO t2 VALUES (1124,128206,00,'botany','tucked','getters','');
INSERT INTO t2 VALUES (1125,128207,00,'curs','gems','sexually','');
INSERT INTO t2 VALUES (1126,118205,00,'solidification','clinker','spear','');
INSERT INTO t2 VALUES (1127,116801,00,'inheritresses','refiner','serums','');
INSERT INTO t2 VALUES (1128,116803,00,'stiller','callus','Italianization','');
INSERT INTO t2 VALUES (1129,116804,00,'t1','leopards','attendants','');
INSERT INTO t2 VALUES (1130,116802,00,'suite','comfortingly','spies','');
INSERT INTO t2 VALUES (1131,128605,00,'ransomer','generically','Anthony','');
INSERT INTO t2 VALUES (1132,118308,00,'Willy','getters','planar','');
INSERT INTO t2 VALUES (1133,113702,00,'Rena','sexually','cupped','');
INSERT INTO t2 VALUES (1134,113703,00,'Seattle','spear','cleanser','');
INSERT INTO t2 VALUES (1135,112103,00,'relaxes','serums','commuters','');
INSERT INTO t2 VALUES (1136,118009,00,'exclaim','Italianization','honeysuckle','');
INSERT INTO t2 VALUES (5136,1118009,00,'exclaim','Italianization','honeysuckle','');
INSERT INTO t2 VALUES (1137,138011,00,'implicated','attendants','orphanage','');
INSERT INTO t2 VALUES (1138,138010,00,'distinguish','spies','skies','');
INSERT INTO t2 VALUES (1139,138012,00,'assayed','Anthony','crushers','');
INSERT INTO t2 VALUES (1140,068304,00,'homeowner','planar','Puritan','');
INSERT INTO t2 VALUES (1141,078009,00,'and','cupped','squeezer','');
INSERT INTO t2 VALUES (1142,108013,00,'stealth','cleanser','bruises','');
INSERT INTO t2 VALUES (1143,084004,00,'coinciding','commuters','bonfire','');
INSERT INTO t2 VALUES (1144,083402,00,'founder','honeysuckle','Colombo','');
INSERT INTO t2 VALUES (1145,084003,00,'environing','orphanage','nondecreasing','');
INSERT INTO t2 VALUES (1146,088504,00,'jewelry','skies','innocents','');
INSERT INTO t2 VALUES (1147,088005,00,'lemons','crushers','masked','');
INSERT INTO t2 VALUES (1148,088007,00,'brokenness','Puritan','file','');
INSERT INTO t2 VALUES (1149,088006,00,'bedpost','squeezer','brush','');
INSERT INTO t2 VALUES (1150,148025,00,'assurers','bruises','mutilate','');
INSERT INTO t2 VALUES (1151,148024,00,'annoyers','bonfire','mommy','');
INSERT INTO t2 VALUES (1152,138305,00,'affixed','Colombo','bulkheads','');
INSERT INTO t2 VALUES (1153,138306,00,'warbling','nondecreasing','undeclared','');
INSERT INTO t2 VALUES (1154,152701,00,'seriously','innocents','displacements','');
INSERT INTO t2 VALUES (1155,148505,00,'boasted','masked','nieces','');
INSERT INTO t2 VALUES (1156,158003,00,'Chantilly','file','coeducation','');
INSERT INTO t2 VALUES (1157,156201,00,'Iranizes','brush','brassy','');
INSERT INTO t2 VALUES (1158,156202,00,'violinist','mutilate','authenticator','');
INSERT INTO t2 VALUES (1159,158307,00,'extramarital','mommy','Washoe','');
INSERT INTO t2 VALUES (1160,158402,00,'spates','bulkheads','penny','');
INSERT INTO t2 VALUES (1161,158401,00,'cloakroom','undeclared','Flagler','');
INSERT INTO t2 VALUES (1162,068013,00,'gazer','displacements','stoned','');
INSERT INTO t2 VALUES (1163,068012,00,'hand','nieces','cranes','');
INSERT INTO t2 VALUES (1164,068203,00,'tucked','coeducation','masterful','');
INSERT INTO t2 VALUES (1165,088205,00,'gems','brassy','biracial','');
INSERT INTO t2 VALUES (1166,068704,00,'clinker','authenticator','steamships','');
INSERT INTO t2 VALUES (1167,068604,00,'refiner','Washoe','windmills','');
INSERT INTO t2 VALUES (1168,158502,00,'callus','penny','exploit','');
INSERT INTO t2 VALUES (1169,123103,00,'leopards','Flagler','riverfront','');
INSERT INTO t2 VALUES (1170,148026,00,'comfortingly','stoned','sisterly','');
INSERT INTO t2 VALUES (1171,123302,00,'generically','cranes','sharpshoot','');
INSERT INTO t2 VALUES (1172,076503,00,'getters','masterful','mittens','');
INSERT INTO t2 VALUES (1173,126304,00,'sexually','biracial','interdependency','');
INSERT INTO t2 VALUES (1174,068306,00,'spear','steamships','policy','');
INSERT INTO t2 VALUES (1175,143504,00,'serums','windmills','unleashing','');
INSERT INTO t2 VALUES (1176,160201,00,'Italianization','exploit','pretenders','');
INSERT INTO t2 VALUES (1177,148028,00,'attendants','riverfront','overstatements','');
INSERT INTO t2 VALUES (1178,148027,00,'spies','sisterly','birthed','');
INSERT INTO t2 VALUES (1179,143505,00,'Anthony','sharpshoot','opportunism','');
INSERT INTO t2 VALUES (1180,108014,00,'planar','mittens','showroom','');
INSERT INTO t2 VALUES (1181,076104,00,'cupped','interdependency','compromisingly','');
INSERT INTO t2 VALUES (1182,078106,00,'cleanser','policy','Medicare','');
INSERT INTO t2 VALUES (1183,126102,00,'commuters','unleashing','corresponds','');
INSERT INTO t2 VALUES (1184,128029,00,'honeysuckle','pretenders','hardware','');
INSERT INTO t2 VALUES (1185,128028,00,'orphanage','overstatements','implant','');
INSERT INTO t2 VALUES (1186,018410,00,'skies','birthed','Alicia','');
INSERT INTO t2 VALUES (1187,128110,00,'crushers','opportunism','requesting','');
INSERT INTO t2 VALUES (1188,148506,00,'Puritan','showroom','produced','');
INSERT INTO t2 VALUES (1189,123303,00,'squeezer','compromisingly','criticizes','');
INSERT INTO t2 VALUES (1190,123304,00,'bruises','Medicare','backer','');
INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
--enable_query_log

#
# Search with a key
#

select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
select fld3 from t2 where fld3 like "%cultivation" ;

#
# Search with a key using sorting and limit the same time
#

select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
select fld3,companynr from t2 where companynr = 58 order by fld3;

select fld3 from t2 order by fld3 desc limit 10;
select fld3 from t2 order by fld3 desc limit 5;
select fld3 from t2 order by fld3 desc limit 5,5;

#
# Search with a key having a constant with each unique key.
# The table is read directly with read-next on fld3
#

select t2.fld3 from t2 where fld3 = 'honeysuckle';
select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
select t2.fld3 from t2 where fld3 LIKE 'h%le';

select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';

#
# Test using INDEX and IGNORE INDEX
#

explain select t2.fld3 from t2 where fld3 = 'honeysuckle';

explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';

explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';

#
# NOTE NOTE NOTE
# The next should give an error
#

-- error 1176
explain select fld3 from t2 ignore index (fld3,not_used);
-- error 1176
explain select fld3 from t2 use index (not_used);

#
# Test sorting with a used key (there is no need for sorting)
#

select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;

# 
# Search with a key having a constant with many occurrences
# The table is read directly with read-next having fld3 to get the
# occurrences
#

select fld1,fld3 from t2 where companynr = 37 and fld3 = 'appendixes';

#
# Search with bunched 'or's.
# If one can limit the key to a certain interval only the possible
# alternatives will be gone through
#

select fld1 from t2 where fld1=250501 or fld1="250502";
explain select fld1 from t2 where fld1=250501 or fld1="250502"; 
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;

#
# Search with a key with LIKE constant
# If the like starts with a certain letter key will be used.
#

--sorted_result
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
select fld1,fld3 from t2 where fld1 like "25050%";
select fld1,fld3 from t2 where fld1 like "25050_";

# 
# Search using distinct. An automatic grouping will be done over all the fields,
# if only distinct is used. In any other case a temporary table will always
# be created. If only the field used for sorting is from the main register,
# it will be sorted first before the distinct table is created.
#

select distinct companynr from t2;
select distinct companynr from t2 order by companynr;
select distinct companynr from t2 order by companynr desc;
select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";

select distinct fld3 from t2 where companynr = 34 order by fld3;
select distinct fld3 from t2 limit 10;
select distinct fld3 from t2 having fld3 like "A%" limit 10;
select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
# MXS: select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
# MXS: qc_get_affected_fields   : ERR: a fld3 != fld3
# MXS: qc_mysqlembedded reports a, even though it is only a reference.

# make a big table.

create table t3 (
 period    int not null,
 name      char(32) not null,
 companynr int not null,
 price     double(11,0),
 price2     double(11,0),
 key (period),
 key (name)
);

--disable_query_log
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1001,"Iranizes",37,5987435,234724);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1002,"violinist",37,28357832,8723648);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1003,"extramarital",37,39654943,235872);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1004,"spates",78,726498,72987523);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1005,"cloakroom",78,98439034,823742);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1006,"gazer",101,834598,27348324);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1007,"hand",154,983543950,29837423);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1008,"tucked",311,234298,3275892);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1009,"gems",447,2374834,9872392);
INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234);
--enable_query_log

create temporary table tmp engine = myisam select * from t3;

insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
insert into tmp select * from t3;
insert into t3 select * from tmp;
#insert into tmp select * from t3;
#insert into t3 select * from tmp;

alter table t3 add t2nr int not null auto_increment primary key first;

drop table tmp;

# big table done

SET BIG_TABLES=1;
select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
SET BIG_TABLES=0;
select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
select distinct fld5 from t2 limit 10;

#
# Force use of remove_dupp
#

select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
SET BIG_TABLES=1; # Force use of MyISAM
select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
SET BIG_TABLES=0;
select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;

#
# A big order by that should trigger a merge in filesort
#

select distinct companynr,rtrim(space(512+companynr)) from t3 order by 1,2;

#
# Search with distinct and order by with many table.
#

select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;

#
# Here the last fld3 is optimized away from the order by
#

explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;

#
# Some test with ORDER BY and limit
#

explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;

#
# Search with a constant table.
#

select period from t1;
select period from t1 where period=1900;
select fld3,period from t1,t2 where fld1 = 011401 order by period;

#
# Search with a constant table and several keyparts. (Rows are read only once
# in the beginning of the search)
#

select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;

explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;

#
# Search with a constant table and several rows from another table
#

select fld3,period from t2,t1 where companynr*10 = 37*10;

#
# Search with a table reference and without a key.
# t3 will be the main table.
#

select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1001 and period <= 1002 and t2.companynr = 37 order by fld3,period, price;

#
# Search with an interval on a table with full key on reference table.
# Here t2 will be the main table and only records matching the
# t2nr will be checked.
#

select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period = 1001 and t2.companynr = 37;

#
# We need another table for join stuff..
#

create table t4 (
  companynr tinyint(2) unsigned zerofill NOT NULL default '00',
  companyname char(30) NOT NULL default '',
  PRIMARY KEY (companynr),
  UNIQUE KEY companyname(companyname)
) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';

--disable_query_log
INSERT INTO t4 (companynr, companyname) VALUES (29,'company 1');
INSERT INTO t4 (companynr, companyname) VALUES (34,'company 2');
INSERT INTO t4 (companynr, companyname) VALUES (36,'company 3');
INSERT INTO t4 (companynr, companyname) VALUES (37,'company 4');
INSERT INTO t4 (companynr, companyname) VALUES (40,'company 5');
INSERT INTO t4 (companynr, companyname) VALUES (41,'company 6');
INSERT INTO t4 (companynr, companyname) VALUES (53,'company 7');
INSERT INTO t4 (companynr, companyname) VALUES (58,'company 8');
INSERT INTO t4 (companynr, companyname) VALUES (65,'company 9');
INSERT INTO t4 (companynr, companyname) VALUES (68,'company 10');
INSERT INTO t4 (companynr, companyname) VALUES (50,'company 11');
INSERT INTO t4 (companynr, companyname) VALUES (00,'Unknown');
--enable_query_log

#
# Test of stright join to force a full join.
#

select STRAIGHT_JOIN t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;

select SQL_SMALL_RESULT t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;

#
# Full join (same alias)
#

select * from t1,t1 t12;
select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;

#
# Test of left join.
#
insert into t2 (fld1, companynr) values (999999,99);

select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;

select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
select count(*) from t2 left join t4 using (companynr) where companynr is not null;
explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null;
delete from t2 where fld1=999999;

#
# Test left join optimization

explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;

explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0;
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0;
# Following can't be optimized
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;

explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;

#
# Joins with forms.
#

select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;

#
# Search using 'or' with the same referens group.
# An interval search will be done first with the first table and after that
# the other table is referenced with a key with a 'test if key in use' for
# each record
#

select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;

select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;

select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;

#
# Test of many parenthesis levels
#

select period from t1 where (((period > 0) or period < 10000 or (period = 1900)) and (period=1900 and period <= 1901) or (period=1903 and (period=1903)) and period>=1902) or ((period=1904 or period=1905) or (period=1906 or period>1907)) or (period=1908 and period = 1909);
select period from t1 where ((period > 0 and period < 1) or (((period > 0 and period < 100) and (period > 10)) or (period > 10)) or (period > 0 and (period > 5 or period > 6)));

select a.fld1 from t2 as a,t2 b where ((a.fld1 = 250501 and a.fld1=b.fld1) or a.fld1=250502 or a.fld1=250503 or (a.fld1=250505 and a.fld1<=b.fld1 and b.fld1>=a.fld1)) and a.fld1=b.fld1;

select fld1 from t2 where fld1 in (250502,98005,98006,250503,250605,250606) and fld1 >=250502 and fld1 not in (250605,250606);

select fld1 from t2 where fld1 between 250502 and 250504;

select fld3 from t2 where (((fld3 like "_%L%" ) or (fld3 like "%ok%")) and ( fld3 like "L%" or fld3 like "G%")) and fld3 like "L%" ;

#
# Group on one table.
# optimizer: sort table by group and send rows.
#

select count(*) from t1;
select companynr,count(*),sum(fld1) from t2 group by companynr;
select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
select companynr,count(price),sum(price),min(price),max(price),avg(price) from t3 group by companynr ;
select distinct mod(companynr,10) from t4 group by companynr;
select distinct 1 from t4 group by companynr;
select count(distinct fld1) from t2;
select companynr,count(distinct fld1) from t2 group by companynr;
select companynr,count(*) from t2 group by companynr;
select companynr,count(distinct concat(fld1,repeat(65,1000))) from t2 group by companynr;
select companynr,count(distinct concat(fld1,repeat(65,200))) from t2 group by companynr;
select companynr,count(distinct floor(fld1/100)) from t2 group by companynr;
select companynr,count(distinct concat(repeat(65,1000),floor(fld1/100))) from t2 group by companynr;

#
# group with where on a key field
#

select sum(fld1),fld3 from t2 where fld3="Romans" group by fld1 limit 10;
select name,count(*) from t3 where name='cloakroom' group by name;
select name,count(*) from t3 where name='cloakroom' and price>10 group by name;
select count(*) from t3 where name='cloakroom' and price2=823742;
select name,count(*) from t3 where name='cloakroom' and price2=823742 group by name;
select name,count(*) from t3 where name >= "extramarital" and price <= 39654943 group by name;
select t2.fld3,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;

#
# Group with extra not group fields.
#

select companynr|0,companyname from t4 group by 1;
select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by t2.companynr order by companyname;
select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;

#
# Calculation with group functions
#

select sum(Period)/count(*) from t1;
select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
# MXS: select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg;
# MXS: qc_get_affected_fields   : ERR: avg companynr price != companynr price
# MXS: qc_mysqlembedded reports false positive, avg is but a reference.

#
# Group with order on not first table
# optimizer: sort table by group and write group records to tmp table.
#            sort tmp_table and send rows.
#

select companynr,count(*) from t2 group by companynr order by 2 desc;
select companynr,count(*) from t2 where companynr > 40 group by companynr order by 2 desc;
select t2.fld4,t2.fld1,count(price),sum(price),min(price),max(price),avg(price) from t3,t2 where t3.companynr = 37 and t2.fld1 = t3.t2nr group by fld1,t2.fld4;

#
# group by with many tables
# optimizer: create tmp table with group-by uniq index.
#           write with update to tmp table.
#           sort tmp table according to order (or group if no order)
#	    send rows
#

select t3.companynr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 group by companynr,fld3;
select t2.companynr,count(*),min(fld3),max(fld3),sum(price),avg(price) from t2,t3 where t3.companynr >= 30 and t3.companynr <= 58 and t3.t2nr = t2.fld1 and 1+1=2 group by t2.companynr;

#
# group with many tables and long group on many tables. group on formula
# optimizer: create tmp table with neaded fields
#           sort tmp table by group and calculate sums to new table
#	    if different order by than group, sort tmp table
#	    send rows
#

select t3.companynr+0,t3.t2nr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 37 group by 1,t3.t2nr,fld3,fld3,fld3,fld3,fld3 order by fld1;

#
# WHERE const folding
# optimize: If there is a "field = const" part in the where, change all
#           instances of field in the and level to const.
#	    All instances of const = const are checked once and removed.
#

#
# Where -> t3.t2nr = 98005 and t2.fld1 = 98005
#

select sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1= t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008;

select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1 = t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008 or t3.t2nr = t2.fld1 and t2.fld1 = 38008 group by t2.fld1;

explain select fld3 from t2 where 1>2 or 2>3;
explain select fld3 from t2 where fld1=fld1;

#
# HAVING
#

select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502; 
select companynr,fld1 from t2 WHERE fld1>=250501 HAVING fld1<=250502;
# MXS: select companynr,count(*) as count,sum(fld1) as sum from t2 group by companynr having count > 40 and sum/count >= 120000;
# MXS: qc_get_affected_fields   : ERR: companynr count fld1 sum != companynr fld1
# MXS: qc_mysqlembedded reports false positive, count and sum are but references.
select companynr from t2 group by companynr having count(*) > 40 and sum(fld1)/count(*) >= 120000 ;
select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by companyname having t2.companynr >= 40;

#
# MIN(), MAX() and COUNT() optimizing
#

select count(*) from t2;
select count(*) from t2 where fld1 < 098024;
# PS does correct pre-zero here. MySQL can't do it as it returns a number.
--disable_ps_protocol
select min(fld1) from t2 where fld1>= 098024;
--enable_ps_protocol
select max(fld1) from t2 where fld1>= 098024;
select count(*) from t3 where price2=76234234;
select count(*) from t3 where companynr=512 and price2=76234234;
explain select min(fld1),max(fld1),count(*) from t2;
# PS does correct pre-zero here. MySQL can't do it as it returns a number.
--disable_ps_protocol
select min(fld1),max(fld1),count(*) from t2;
--enable_ps_protocol
select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742;
select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78;
select t2nr,count(*) from t3 where name='gems' group by t2nr limit 20;
select max(t2nr) from t3 where price=983543950;

#
# Test of alias
#

select t1.period from t3 = t1 limit 1;
select t1.period from t1 as t1 limit 1;
select t1.period as "Nuvarande period" from t1 as t1 limit 1;
select period as ok_period from t1 limit 1;
select period as ok_period from t1 group by ok_period limit 1;
select 1+1 as summa from t1 group by summa limit 1;
select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;

#
# Some simple show commands
#

show tables;
show tables from test like "s%";
show tables from test like "t?";
# We mask out the Privileges column because it differs with embedded server
--replace_column 8 #
show full columns from t2;
--replace_column 8 #
show full columns from t2 from test like 'f%';
--replace_column 8 #
show full columns from t2 from test like 's%';
show keys from t2;

drop table t4, t3, t2, t1;

#
# Test of DO
#

DO 1;
DO benchmark(100,1+1),1,1;

#
# Bug #6449: do default;
#

--error ER_PARSE_ERROR
do default;
--error ER_BAD_FIELD_ERROR
do foobar;

#
# random in WHERE clause
#

CREATE TABLE t1 (
  id mediumint(8) unsigned NOT NULL auto_increment,
  pseudo varchar(35) NOT NULL default '',
  PRIMARY KEY  (id),
  UNIQUE KEY pseudo (pseudo)
);
INSERT INTO t1 (pseudo) VALUES ('test');
INSERT INTO t1 (pseudo) VALUES ('test1');
SELECT 1 as rnd1 from t1 where rand() > 2;
DROP TABLE t1;

#
# Test of bug with SUM(CASE...)
#

CREATE TABLE t1 (gvid int(10) unsigned default NULL,  hmid int(10) unsigned default NULL,  volid int(10) unsigned default NULL,  mmid int(10) unsigned default NULL,  hdid int(10) unsigned default NULL,  fsid int(10) unsigned default NULL,  ctid int(10) unsigned default NULL,  dtid int(10) unsigned default NULL,  cost int(10) unsigned default NULL,  performance int(10) unsigned default NULL,  serialnumber bigint(20) unsigned default NULL,  monitored tinyint(3) unsigned default '1',  removed tinyint(3) unsigned default '0',  target tinyint(3) unsigned default '0',  dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,  name varchar(255) binary default NULL,  description varchar(255) default NULL,  UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
CREATE TABLE t2 (  hmid int(10) unsigned default NULL,  volid int(10) unsigned default NULL,  sampletid smallint(5) unsigned default NULL,  sampletime datetime default NULL,  samplevalue bigint(20) unsigned default NULL,  KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
# Disable PS becasue we get more warnings from PS than from normal execution
--disable_ps_protocol
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
--enable_ps_protocol
# Testing the same select with NULL's instead of invalid datetime values
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
DROP TABLE t1,t2;

#
# Test of bigint comparision
#

create table  t1 (  A_Id bigint(20) NOT NULL default '0',  A_UpdateBy char(10) NOT NULL default '',  A_UpdateDate bigint(20) NOT NULL default '0',  A_UpdateSerial int(11) NOT NULL default '0',  other_types bigint(20) NOT NULL default '0',  wss_type bigint(20) NOT NULL default '0');
INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
select wss_type from t1 where wss_type ='102935229216544106';
select wss_type from t1 where wss_type ='102935229216544105';
select wss_type from t1 where wss_type ='102935229216544104';
select wss_type from t1 where wss_type ='102935229216544093';
select wss_type from t1 where wss_type =102935229216544093;
drop table t1;
select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
select @a;
select @b;
select @c;

#
# Test of removing redundant braces in the FROM part
# (We test each construct with the braced join to the left and right;
#  the latter case used to cause a syntax errors.)
#

create table t1 (a int not null auto_increment primary key);
insert into t1 values ();
insert into t1 values ();
insert into t1 values ();
# ,
select * from (t1 as t2 left join t1 as t3 using (a)), t1;
select * from t1, (t1 as t2 left join t1 as t3 using (a));
# stright_join
select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
# inner join on
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
# inner join using
select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 using ( a );
select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) using ( a );
# left [outer] join on
--sorted_result
select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
--sorted_result
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
# left join using
select * from (t1 as t2 left join t1 as t3 using (a)) left join t1 using ( a );
select * from t1 left join (t1 as t2 left join t1 as t3 using (a)) using ( a );
# natural left join
select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
select * from t1 natural left join (t1 as t2 left join t1 as t3 using (a));
# right join on
--sorted_result
select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
--sorted_result
select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
# right [outer] joing using
select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
select * from t1 right outer join (t1 as t2 left join t1 as t3 using (a)) using ( a );
# natural right join
select * from (t1 as t2 left join t1 as t3 using (a)) natural right join t1;
select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a));
# natural join
select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
drop table t1;

CREATE TABLE t1 (  aa char(2),  id int(11) NOT NULL auto_increment,  t2_id int(11) NOT NULL default '0',  PRIMARY KEY  (id),  KEY replace_id (t2_id)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
CREATE TABLE t2 ( id int(11) NOT NULL auto_increment,  PRIMARY KEY  (id)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0   order by t1.id   LIMIT 0, 5;
drop table t1,t2;

#
# outer join, impossible on condition, where, and usable key for range
#
create table t1 (id1 int NOT NULL);
create table t2 (id2 int NOT NULL);
create table t3 (id3 int NOT NULL);
create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));

insert into t1 values (1);
insert into t1 values (2);
insert into t2 values (1);
insert into t4 values (1,1);

explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
left join t4 on id3 = id4 where id2 = 1 or id4 = 1;

drop table t1,t2,t3,t4;
#
# Bug #2298
#

create table t1(s varchar(10) not null);
create table t2(s varchar(10) not null primary key);
create table t3(s varchar(10) not null primary key);
insert into t1 values ('one\t'), ('two\t');
insert into t2 values ('one\r'), ('two\t');
insert into t3 values ('one '), ('two\t');
select * from t1 where s = 'one';
select * from t2 where s = 'one';
select * from t3 where s = 'one';
select * from t1,t2 where t1.s = t2.s;
select * from t2,t3 where t2.s = t3.s;
drop table t1, t2, t3;

#
# Bug #3759
# Both queries should produce identical plans and results.
#
create table t1 (a integer,  b integer, index(a), index(b));
create table t2 (c integer,  d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
select * from t1 left join t2 on a=c where d in (4);
explain select * from t1 left join t2 on a=c where d = 4;
select * from t1 left join t2 on a=c where d = 4;
drop table t1, t2;

#
# Covering index is mentioned in EXPLAIN output for const tables (bug #5333)
#

CREATE TABLE t1 (
  i int(11) NOT NULL default '0',
  c char(10) NOT NULL default '',
  PRIMARY KEY  (i),
  UNIQUE KEY c (c)
) ENGINE=MyISAM;

INSERT INTO t1 VALUES (1,'a');
INSERT INTO t1 VALUES (2,'b');
INSERT INTO t1 VALUES (3,'c');

EXPLAIN SELECT i FROM t1 WHERE i=1;

DROP TABLE t1;

#
# Test case for bug 7520: a wrong cost of the index for a BLOB field
#

CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );

INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');

EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;

DROP TABLE t1, t2;

#
# Test case for bug 7098: substitution of a constant for a string field 
#

CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
INSERT INTO t1 VALUES ('Paris');

SELECT * FROM t1 WHERE city='London';
SELECT * FROM t1 WHERE city='london';
EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
SELECT * FROM t1 WHERE city='London' AND city='london';
EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';

DROP TABLE t1;

#
# Bug#7425 inconsistent sort order on unsigned columns result of substraction
#

create table t1 (a int(11) unsigned, b int(11) unsigned);
insert into t1 values (1,0), (1,1), (18446744073709551615,0);
select a-b  from t1 order by 1;
select a-b , (a-b < 0)  from t1 order by 1;
# MXS: select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
# MXS: qc_get_affected_fields   : ERR: a b d != a b
# MXS: qc_mysqlembedded reports false positive, d is but a reference.
select cast((a - b) as unsigned) from t1 order by 1;
drop table t1;


#
# Bug#8733 server accepts malformed query (multiply mentioned distinct)
#
create table t1 (a int(11));
select all all * from t1;
select distinct distinct * from t1;
--error 1221
select all distinct * from t1;
--error 1221
select distinct all * from t1;
drop table t1;

#
# Test for BUG#10095
#
CREATE TABLE t1 (
  kunde_intern_id int(10) unsigned NOT NULL default '0',
  kunde_id int(10) unsigned NOT NULL default '0',
  FK_firma_id int(10) unsigned NOT NULL default '0',
  aktuell enum('Ja','Nein') NOT NULL default 'Ja',
  vorname varchar(128) NOT NULL default '',
  nachname varchar(128) NOT NULL default '',
  geloescht enum('Ja','Nein') NOT NULL default 'Nein',
  firma varchar(128) NOT NULL default ''
);

INSERT INTO t1 VALUES 
  (3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
  (3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');


SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
  WHERE
   (
      (
         ( '' != '' AND firma LIKE CONCAT('%', '', '%'))
         OR
         (vorname LIKE CONCAT('%', 'Vorname1', '%') AND 
          nachname LIKE CONCAT('%', '1Nachname', '%') AND 
          'Vorname1' != '' AND 'xxxx' != '')
      )
      AND
      (
        aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
      )
   )
 ;

SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
geloescht FROM t1
  WHERE
   (
     (
       aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
     )
     AND
     (
         ( '' != '' AND firma LIKE CONCAT('%', '', '%')  )
         OR
         (  vorname LIKE CONCAT('%', 'Vorname1', '%') AND
nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
'xxxx' != '')
     )
   )
 ;

SELECT COUNT(*) FROM t1 WHERE 
( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1)) 
AND FK_firma_id = 2;

drop table t1;

#
#
# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX
#

CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b));
INSERT INTO t1 VALUES (0x8000000000000000);
SELECT b FROM t1 WHERE b=0x8000000000000000;
DROP TABLE t1;

#
# IN with outer join condition (BUG#9393)
#
CREATE TABLE `t1` ( `gid` int(11) default NULL, `uid` int(11) default NULL);

CREATE TABLE `t2` ( `ident` int(11) default NULL, `level` char(16) default NULL);
INSERT INTO `t2` VALUES (0,'READ');

CREATE TABLE `t3` ( `id` int(11) default NULL, `name` char(16) default NULL);
INSERT INTO `t3` VALUES (1,'fs');

select * from t3 left join t1 on t3.id = t1.uid, t2 where t2.ident in (0, t1.gid, t3.id, 0);

drop table t1,t2,t3;

# Test for BUG#11700
CREATE TABLE t1 (
  acct_id int(11) NOT NULL default '0',
  profile_id smallint(6) default NULL,
  UNIQUE KEY t1$acct_id (acct_id),
  KEY t1$profile_id (profile_id)
);
INSERT INTO t1 VALUES (132,17),(133,18);

CREATE TABLE t2 (
  profile_id smallint(6) default NULL,
  queue_id int(11) default NULL,
  seq int(11) default NULL,
  KEY t2$queue_id (queue_id)
);
INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);

CREATE TABLE t3 (
  id int(11) NOT NULL default '0',
  qtype int(11) default NULL,
  seq int(11) default NULL,
  warn_lvl int(11) default NULL,
  crit_lvl int(11) default NULL,
  rr1 tinyint(4) NOT NULL default '0',
  rr2 int(11) default NULL,
  default_queue tinyint(4) NOT NULL default '0',
  KEY t3$qtype (qtype),
  KEY t3$id (id)
);

INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0),
  (36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0);

SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q 
WHERE 
  (pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND 
  (pq.queue_id = q.id) AND (q.rr1 <> 1);

drop table t1,t2,t3;

#
# Bug #11482 Wrongly applied optimization was erroneously rejecting valid
#            rows 
create table t1 (f1 int);
insert into t1 values (1),(NULL);
create table t2 (f2 int, f3 int, f4 int);
create index idx1 on t2 (f4);
insert into t2 values (1,2,3),(2,4,6);
select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
from  t2 C where A.f4 = C.f4) or A.f3 IS NULL; 
drop table t1,t2;

#
# Bug #11521 Negative integer keys incorrectly substituted for 0 during
#            range analysis.

create table t2 (a tinyint unsigned);
create index t2i on t2(a);
insert into t2 values (0), (254), (255);
explain select * from t2 where a > -1;
select * from t2 where a > -1;
drop table t2;

#
# Bug #11745: SELECT ... FROM DUAL with WHERE condition
#

CREATE TABLE t1 (a int, b int, c int);
# MXS: INSERT INTO t1
# MXS:   SELECT 50, 3, 3 FROM DUAL
# MXS:     WHERE NOT EXISTS
# MXS:       (SELECT * FROM t1 WHERE a = 50 AND b = 3);
# MXS: qc_get_table_names       : ERR: t1, t1 != t1, DUAL, t1
# MXS: qc_mysqlembedded misses DUAL
SELECT * FROM t1;
# MXS: INSERT INTO t1
# MXS:   SELECT 50, 3, 3 FROM DUAL
# MXS:     WHERE NOT EXISTS
# MXS:       (SELECT * FROM t1 WHERE a = 50 AND b = 3);
# MXS: qc_get_table_names       : ERR: t1, t1 != t1, DUAL, t1
# MXS: qc_mysqlembedded misses DUAL
select found_rows();
SELECT * FROM t1;
select count(*) from t1;
select found_rows();
select count(*) from t1 limit 2,3;
select found_rows();
select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
select found_rows();

DROP TABLE t1;

#
# Bug 7672 Unknown column error in order clause
#
CREATE TABLE t1 (a INT, b INT);
# MXSTODO: (SELECT a, b AS c FROM t1) ORDER BY c+1;
# MXSTODO: qc_mysqlite cannot yet parse selects inside parenthesis.
# MXSTODO: (SELECT a, b AS c FROM t1) ORDER BY b+1;
# MXSTODO: qc_mysqlite cannot yet parse selects inside parenthesis.
SELECT a, b AS c FROM t1 ORDER BY c+1;
SELECT a, b AS c FROM t1 ORDER BY b+1;
drop table t1;

#
# Bug #13356 assertion failed in resolve_const_item()
#
create table t1(f1 int, f2 int);
create table t2(f3 int);
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
insert into t1 values(1,1),(2,null);
insert into t2 values(2);
select * from t1,t2 where f1=f3 and (f1,f2) = (2,null);
select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null);
drop table t1,t2; 

#
# Bug #13535
#
create table t1 (f1 int not null auto_increment primary key, f2 varchar(10));
create table t11 like t1;
insert into t1 values(1,""),(2,"");
--replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X
show table status like 't1%';
select 123 as a from t1 where f1 is null;
drop table t1,t11;

#
# Bug #3874 (function in GROUP and LEFT JOIN)
#

CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) );
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, e INT );
INSERT INTO t2 VALUES ( 1,10,1), (1,10,2), (1,11,1), (1,11,2), (1,2,1), (1,2,2),(1,2,3);
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t1.a, t1.b, c;
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t2.a, t2.b, c;
SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2,t1
WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
DROP TABLE IF EXISTS t1, t2;

#
# Bug #13855 select distinct with group by caused server crash
#
create table t1 (f1 int primary key, f2 int);
create table t2 (f3 int, f4 int, primary key(f3,f4));
insert into t1 values (1,1);
insert into t2 values (1,1),(1,2);
select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
drop table t1,t2;

#
# Bug #14482 Server crash when subselecting from the same table
#
create table t1 (f1 int,f2 int);
insert into t1 values(1,1);
create table t2 (f3 int, f4 int, primary key(f3,f4));
insert into t2 values(1,1);
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2)); 
drop table t1,t2;

#
# Bug #4981: 4.x and 5.x produce non-optimal execution path, 3.23 regression test failure
#
CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c));
insert into t1 values (1,0,0),(2,0,0);
CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a));
insert into t2 values (1,'',''), (2,'','');
CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b));
insert into t3 values (1,1),(1,2);
# must have "range checked" for t2
explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 
 where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and 
       t2.b like '%%' order by t2.b limit 0,1;
DROP TABLE t1,t2,t3;

#
# Bug #17873: confusing error message when IGNORE INDEX refers a column name
#

CREATE TABLE t1 (a int, INDEX idx(a));
INSERT INTO t1 VALUES (2), (3), (1);

EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
--error 1176
EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
--error 1176
EXPLAIN SELECT * FROM t1 FORCE INDEX (a);

DROP TABLE t1;

#
# Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
#
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,1), (2,1), (4,10);

CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b));
INSERT INTO t2 VALUES (1,NULL), (2,10);
ALTER TABLE t1 ENABLE KEYS;

EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
DROP TABLE IF EXISTS t1,t2;

#
# Bug #20954 "avg(keyval) retuns 0.38 but max(keyval) returns an empty set"
#
--disable_ps_protocol
CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1));
CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2));
INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941);
INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941);

explain select max(key1) from t1 where key1 <= 0.6158;
explain select max(key2) from t2 where key2 <= 1.6158;
explain select min(key1) from t1 where key1 >= 0.3762;
explain select min(key2) from t2 where key2 >= 1.3762;
explain select max(key1), min(key2) from t1, t2
where key1 <= 0.6158 and key2 >= 1.3762;
explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;

select max(key1) from t1 where key1 <= 0.6158;
select max(key2) from t2 where key2 <= 1.6158;
select min(key1) from t1 where key1 >= 0.3762;
select min(key2) from t2 where key2 >= 1.3762;
select max(key1), min(key2) from t1, t2
where key1 <= 0.6158 and key2 >= 1.3762;
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;

DROP TABLE t1,t2;
--enable_ps_protocol

#
# Bug #18759 "Incorrect string to numeric conversion"
#
# This test is here so that the behavior will not be changed to 4.1
# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
# will be converted internally to real (double) value and it is not
# as accurate as bigint (longlong) for integers. Thus the results may
# vary. In 5.1 internally it is decimal, which is a string type and
# will be more accurate. Due to rather big changes needed to fix this
# in 4.1 or 5.0 it is not desired to do it in the stable versions.
#
# This test is here only to make sure that behavior is not changed in
# 4.1 and 5.0
#
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
DROP TABLE t1;

#
# Bug #22533: storing large hex strings
#

create table t1(a bigint unsigned, b bigint);
insert into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff), 
  (0x10000000000000000, 0x10000000000000000), 
  (0x8fffffffffffffff, 0x8fffffffffffffff);
select hex(a), hex(b) from t1;
drop table t1;

#
# Bug #32103: optimizer crash when join on int and mediumint with variable in 
#             where clause
#

CREATE TABLE t1 (c0 int);
CREATE TABLE t2 (c0 int);

# We need any variable that:
# 1. has integer type, 
# 2. can be used with the "@@name" syntax
# 3. available in every server build
INSERT INTO t1 VALUES(@@connect_timeout);
INSERT INTO t2 VALUES(@@connect_timeout);

# We only need to ensure 1 row is returned to validate the results
--replace_column 1 X 2 X
SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout);

DROP TABLE t1, t2;

--echo End of 4.1 tests

#
# Test for bug #6474
#

CREATE TABLE t1 ( 
K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '', 
K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000', 
F2I4 int(11) NOT NULL default '0' 
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO t1 VALUES 
('W%RT', '0100',  1), 
('W-RT', '0100', 1), 
('WART', '0100', 1), 
('WART', '0200', 1), 
('WERT', '0100', 2), 
('WORT','0200', 2), 
('WT', '0100', 2), 
('W_RT', '0100', 2), 
('WaRT', '0100', 3), 
('WART', '0300', 3), 
('WRT' , '0400', 3), 
('WURM', '0500', 3), 
('W%T', '0600', 4), 
('WA%T', '0700', 4), 
('WA_T', '0800', 4);

SELECT K2C4, K4N4, F2I4 FROM t1
  WHERE  K2C4 = 'WART' AND 
        (F2I4 = 2 AND K2C4 = 'WART' OR (F2I4 = 2 OR K4N4 = '0200'));
SELECT K2C4, K4N4, F2I4 FROM t1
  WHERE  K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200');
DROP TABLE t1;

#
# Bug#8670
#
create table t1 (a int, b int);
create table t2 like t1;
select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;
select t1.a from ((t1 inner join t2 on t1.a=t2.a)) where t2.a=1;
select x.a, y.a, z.a from ( (t1 x inner join t2 y on x.a=y.a) inner join t2 z on y.a=z.a) WHERE x.a=1;
drop table t1,t2;

#
# Bug#9820
#

create table t1 (s1 varchar(5));
insert into t1 values ('Wall');
select min(s1) from t1 group by s1 with rollup;
drop table t1;

#
# Bug#9799
#

create table t1 (s1 int) engine=myisam;
insert into t1 values (0);
select avg(distinct s1) from t1 group by s1 with rollup;
drop table t1;

#
# Bug#9800
#

create table t1 (s1 int);
insert into t1 values (null),(1);
select distinct avg(s1) as x from t1 group by s1 with rollup;
drop table t1;


#
# Test for bug #10084: STRAIGHT_JOIN with ON expression 
#

CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
INSERT INTO t2 VALUES (2), (4), (6);

SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;

EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a;

DROP TABLE t1,t2;

#
# Bug #10650
#

select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;

#
# Bug #11398 Bug in field_conv() results in wrong result of join with index
#
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
insert into t1 values (" 2", 2);
insert into t2 values (" 2", " one "),(" 2", " two ");
select * from t1 left join t2 on f1 = f3;
drop table t1,t2;

#
# Bug #6558 Views: CREATE VIEW fails with JOIN ... USING
#

create table t1 (empnum smallint, grp int);
create table t2 (empnum int, name char(5));
insert into t1 values(1,1);
insert into t2 values(1,'bob');
create view v1 as select * from t2 inner join t1 using (empnum);
select * from v1;
drop table t1,t2;
drop view v1;

#
# Bug #10646 Columns included in the join between two tables are ambigious
# in the select
#

create table t1 (pk int primary key, b int);
create table t2 (pk int primary key, c int);
select pk from t1 inner join t2 using (pk);
drop table t1,t2;

#
# Bug #10972 Natural join of view and underlying table gives wrong result
#

create table t1 (s1 int, s2 char(5), s3 decimal(10));
create view v1 as select s1, s2, 'x' as s3 from t1;
select * from t1 natural join v1;
insert into t1 values (1,'x',5);
select * from t1 natural join v1;
drop table t1;
drop view v1;

#
# Bug #6276 A SELECT that does a NATURAL OUTER JOIN without common
#           columns crashes server because of empty ON condition
#

create table t1(a1 int);
create table t2(a2 int);
insert into t1 values(1),(2);
insert into t2 values(1),(2);
create view v2 (c) as select a1 from t1;

--sorted_result
select * from t1 natural left join t2;
--sorted_result
select * from t1 natural right join t2;

--sorted_result
select * from v2 natural left join t2;
--sorted_result
select * from v2 natural right join t2;

drop table t1, t2;
drop view v2;


#
# Bug #4789 Incosistent results of more than 2-way natural joins due to
#           incorrect transformation to join ... on.
#

create table t1 (a int(10), t1_val int(10));
create table t2 (b int(10), t2_val int(10));
create table t3 (a int(10), b int(10));
insert into t1 values (1,1),(2,2);
insert into t2 values (1,1),(2,2),(3,3);
insert into t3 values (1,1),(2,1),(3,1),(4,1);
# the following two queries must return the same result
select * from t1 natural join t2 natural join t3;
select * from t1 natural join t3 natural join t2;
drop table t1, t2, t3;


#
# Bug #12841: Server crash on DO IFNULL(NULL,NULL)
#
# (testing returning of int, decimal, real, string)
DO IFNULL(NULL, NULL);
SELECT CAST(IFNULL(NULL, NULL) AS DECIMAL);
SELECT ABS(IFNULL(NULL, NULL));
SELECT IFNULL(NULL, NULL);

#
# BUG #12595 (ESCAPE must be exactly one)
#
SET @OLD_SQL_MODE12595=@@SQL_MODE, @@SQL_MODE='';
SHOW LOCAL VARIABLES LIKE 'SQL_MODE';

CREATE TABLE BUG_12595(a varchar(100));
INSERT INTO BUG_12595 VALUES ('hakan%'), ('hakank'), ("ha%an");
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%';
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
-- error 1210
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
# this should work when sql_mode is not NO_BACKSLASH_ESCAPES
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan%' ESCAPE '';
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%' ESCAPE '';
SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE 0x5c;
SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%';
SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE '\\';
SELECT * FROM BUG_12595 WHERE a LIKE 'ha|%an' ESCAPE '|';

SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SHOW LOCAL VARIABLES LIKE 'SQL_MODE';
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%';
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
-- error 1210
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
-- error 1210
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%' ESCAPE '\\';
#this gives an error when NO_BACKSLASH_ESCAPES is set
-- error 1210
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan%' ESCAPE '';
SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE 0x5c;
SELECT * FROM BUG_12595 WHERE a LIKE 'ha|%an' ESCAPE '|';
-- error 1210
SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\n%' ESCAPE '\n';

SET @@SQL_MODE=@OLD_SQL_MODE12595;
DROP TABLE BUG_12595;

#
# Bug #6495 Illogical requirement for column qualification in NATURAL join
#

create table t1 (a char(1));
create table t2 (a char(1));
insert into t1 values ('a'),('b'),('c');
insert into t2 values ('b'),('c'),('d');
select a from t1 natural join t2;
select * from t1 natural join t2 where a = 'b';
drop table t1, t2;

#
# Bug #12977 Compare table names with qualifying field tables only
# for base tables, search all nested join operands of natural joins.
#

CREATE TABLE t1 (`id` TINYINT);
CREATE TABLE t2 (`id` TINYINT);
CREATE TABLE t3 (`id` TINYINT);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (2);
INSERT INTO t3 VALUES (3);
-- error 1052
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
-- error 1052
SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id);
-- error 1052
SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
-- error 1052
SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);

drop table t1, t2, t3;

#
# Bug #13067 JOIN xxx USING is case sensitive
#

create table t1 (a int(10),b int(10));
create table t2 (a int(10),b int(10));
insert into t1 values (1,10),(2,20),(3,30);
insert into t2 values (1,10);
# both queries should produce the same result
select * from t1 inner join t2 using (A);
select * from t1 inner join t2 using (a);
drop table t1, t2;

#
# Bug #12943 Incorrect nesting of [INNER| CROSS] JOIN due to unspecified
#            associativity in the parser.
#

create table t1 (a int, c int);
create table t2 (b int);
create table t3 (b int, a int);
create table t4 (c int);
insert into t1 values (1,1);
insert into t2 values (1);
insert into t3 values (1,1);
insert into t4 values (1);

select * from t1 join t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
# Notice that ',' has lower priority than 'join', thus we have that:
# t1, t2 join t3 <==> t1, (t2 join t3).
-- error 1054
select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
select * from t1 join t2 join t4 using (c);
drop table t1, t2, t3, t4;

#
# Bug #12291 Table wasn't reinited for index scan after sequential scan 
#
create table t1(x int, y int);
create table t2(x int, y int);
create table t3(x int, primary key(x));
insert into t1 values (1, 1), (2, 1), (3, 1), (4, 3), (5, 6), (6, 6);
insert into t2 values (1, 1), (2, 1), (3, 3), (4, 6), (5, 6);
insert into t3 values (1), (2), (3), (4), (5);
select t1.x, t3.x from t1, t2, t3  where t1.x = t2.x and t3.x >= t1.y and t3.x <= t2.y;
drop table t1,t2,t3;

#
# Bug #13127 LEFT JOIN against a VIEW returns NULL instead of correct value
#

create table t1 (id char(16) not null default '', primary key  (id));
insert into t1 values ('100'),('101'),('102');
create table t2 (id char(16) default null);
insert into t2 values (1);
create view v1 as select t1.id from t1;
create view v2 as select t2.id from t2;
create view v3 as select (t1.id+2) as id from t1 natural left join t2;

# all queries must return the same result
select t1.id from t1 left join v2 using (id);
select t1.id from v2 right join t1 using (id);
--sorted_result
select t1.id from t1 left join v3 using (id);
select * from t1 left join v2 using (id);
select * from v2 right join t1 using (id);
--sorted_result
select * from t1 left join v3 using (id);

select v1.id from v1 left join v2 using (id);
select v1.id from v2 right join v1 using (id);
--sorted_result
select v1.id from v1 left join v3 using (id);
select * from v1 left join v2 using (id);
select * from v2 right join v1 using (id);
--sorted_result
select * from v1 left join v3 using (id);

drop table t1, t2;
drop view v1, v2, v3;

#
# Bug #13597 Column in ON condition not resolved if references a table in
# nested right join.
#

create table t1 (id int(11) not null default '0');
insert into t1 values (123),(191),(192);
create table t2 (id char(16) character set utf8 not null);
insert into t2 values ('58013'),('58014'),('58015'),('58016');
create table t3 (a_id int(11) not null, b_id char(16) character set utf8);
insert into t3 values (123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013');

# both queries are equivalent
select count(*)
from t1 inner join (t3 left join t2 on t2.id = t3.b_id) on t1.id = t3.a_id;

select count(*)
from t1 inner join (t2 right join t3 on t2.id = t3.b_id) on t1.id = t3.a_id;

drop table t1,t2,t3;

#
# Bug #13832 Incorrect parse order of join productions due to unspecified
# operator priorities results in incorrect join tree.
#

create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
select * from t1 join t2 join t3 on (t1.a=t3.c);
select * from t1 join t2 left join t3 on (t1.a=t3.c);
select * from t1 join t2 right join t3 on (t1.a=t3.c);
select * from t1 join t2 straight_join t3 on (t1.a=t3.c);
drop table t1, t2 ,t3;

#
# Bug #14093 Query takes a lot of time when date format is not valid
# fix optimizes execution. so here we just check that returned set is
# correct.
create table t1(f1 int, f2 date);
insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
  (4,'2005-10-01'),(5,'2005-12-30');
# should return all records
select * from t1 where f2 >= 0            order by f2;
select * from t1 where f2 >= '0000-00-00' order by f2;
# should return 4,5
select * from t1 where f2 >= '2005-09-31' order by f2;
select * from t1 where f2 >= '2005-09-3a' order by f2;
# should return 1,2,3
select * from t1 where f2 <= '2005-09-31' order by f2;
select * from t1 where f2 <= '2005-09-3a' order by f2;
drop table t1;

#
# Bug ##14662  	ORDER BY on column of a view, with an alias of the same
# column causes ambiguous
#

create table t1 (f1 int, f2 int);
insert into t1 values (1, 30), (2, 20), (3, 10);
create algorithm=merge view v1 as select f1, f2 from t1;
create algorithm=merge view v2 (f2, f1) as select f1, f2 from t1;
create algorithm=merge view v3 as select t1.f1 as f2, t1.f2 as f1 from t1;
select t1.f1 as x1, f1 from t1 order by t1.f1;
select v1.f1 as x1, f1 from v1 order by v1.f1;
select v2.f1 as x1, f1 from v2 order by v2.f1;
select v3.f1 as x1, f1 from v3 order by v3.f1;
select f1, f2, v1.f1 as x1 from v1 order by v1.f1;
select f1, f2, v2.f1 as x1 from v2 order by v2.f1;
select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
drop table t1;
drop view v1, v2, v3;

#
# Bug #15106: lost equality predicate of the form field=const in a join query
#

CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
                PRIMARY KEY(key_a,key_b));

INSERT INTO t1 VALUES (0,'');
INSERT INTO t1 VALUES (1,'i');
INSERT INTO t1 VALUES (2,'j');
INSERT INTO t1 VALUES (3,'k');

INSERT INTO t2 VALUES (1,'r');
INSERT INTO t2 VALUES (2,'s');
INSERT INTO t2 VALUES (3,'t');

INSERT INTO t3 VALUES (1,5,'x');
INSERT INTO t3 VALUES (1,6,'y');
INSERT INTO t3 VALUES (2,5,'xx');
INSERT INTO t3 VALUES (2,6,'yy');
INSERT INTO t3 VALUES (2,7,'zz');
INSERT INTO t3 VALUES (3,5,'xxx');

SELECT t2.key_a,foo 
  FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
          INNER JOIN t3 ON t1.key_a = t3.key_a
    WHERE t2.key_a=2 and key_b=5;
EXPLAIN SELECT t2.key_a,foo 
  FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
          INNER JOIN t3 ON t1.key_a = t3.key_a
    WHERE t2.key_a=2 and key_b=5;

SELECT t2.key_a,foo 
  FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
          INNER JOIN t3 ON t1.key_a = t3.key_a
    WHERE t2.key_a=2 and key_b=5;
EXPLAIN SELECT t2.key_a,foo 
  FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
          INNER JOIN t3 ON t1.key_a = t3.key_a
    WHERE t2.key_a=2 and key_b=5;

DROP TABLE t1,t2,t3;

#
# Bug#15347 Wrong result of subselect when records cache and set functions
#           are involved
#
create  table t1 (f1 int);
insert into t1 values(1),(2);
create table t2 (f2 int, f3 int, key(f2));
insert into t2 values(1,1),(2,2);
create table t3 (f4 int not null);
insert into t3 values (2),(2),(2);
select f1,(select count(*) from t2,t3 where f2=f1 and f3=f4) as count from t1;
drop table t1,t2,t3;

#
# Bug #15633 Evaluation of Item_equal for non-const table caused wrong
#            select result
#
create table t1 (f1 int unique);
create table t2 (f2 int unique);
create table t3 (f3 int unique);
insert into t1 values(1),(2);
insert into t2 values(1),(2);
insert into t3 values(1),(NULL);
select * from t3 where f3 is null;
select t2.f2 from t1 left join t2 on f1=f2 join t3 on f1=f3 where f1=1;
drop table t1,t2,t3;

#
# Bug#15268 Unchecked null value caused server crash
#
create table t1(f1 char, f2 char not null);
insert into t1 values(null,'a');
create table t2 (f2 char not null);
insert into t2 values('b');
select * from t1 left join t2 on f1=t2.f2 where t1.f2='a';
drop table t1,t2;

#
# Bug#15538 unchecked table absense caused server crash.
#
--error 1064
select * from (select * left join t on f1=f2) tt;

#
# Bug #16504: re-evaluation of Item_equal object after reading const table
#

CREATE TABLE t1 (sku int PRIMARY KEY, pr int);
CREATE TABLE t2 (sku int PRIMARY KEY, sppr int, name varchar(255));

INSERT INTO t1 VALUES
  (10, 10), (20, 10), (30, 20), (40, 30), (50, 10), (60, 10);

INSERT INTO t2 VALUES 
  (10, 10, 'aaa'), (20, 10, 'bbb'), (30, 10, 'ccc'), (40, 20, 'ddd'),
  (50, 10, 'eee'), (60, 20, 'fff'), (70, 20, 'ggg'), (80, 30, 'hhh');

SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
  FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
EXPLAIN
SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
  FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);


DROP TABLE t1,t2;

#
# Bug#18712: Truncation problem (needs just documenting and test
# cases to prevent fixing this accidently. It is intended behaviour)
#

SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
INSERT t1 SET i = 0;
UPDATE t1 SET i = -1;
SELECT * FROM t1;
UPDATE t1 SET i = CAST(i - 1 AS SIGNED);
SELECT * FROM t1;
UPDATE t1 SET i = i - 1;
SELECT * FROM t1;
DROP TABLE t1;
SET SQL_MODE=default;

# BUG#17379

create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, b int, c int, e int, primary key(a,b,c));
insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
analyze table t2;
select 'In next EXPLAIN, B.rows must be exactly 10:' Z;

explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
          and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
drop table t1, t2;

#
#Bug #18940: selection of optimal execution plan caused by equality
#            propagation (the bug was fixed by the patch for bug #17379)

CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
                      (3,1), (5,1), (8,9), (2,2), (0,9);

CREATE TABLE t2 (c int, d int, f int, INDEX(c,f));
INSERT INTO t2 VALUES
 (1,0,0), (1,0,1), (2,0,0), (2,0,1), (3,0,0), (4,0,1),
 (5,0,0), (5,0,1), (6,0,0), (0,0,1), (7,0,0), (7,0,1),
 (0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1);

EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;

DROP TABLE t1, t2;

#
# Bug #18895: BIT values cause joins to fail
#
create table t1 (
    a int unsigned    not null auto_increment primary key,
    b bit             not null,
    c bit             not null
);

create table t2 (
    a int unsigned    not null auto_increment primary key,
    b bit             not null,
    c int unsigned    not null,
    d varchar(50)
);

insert into t1 (b,c) values (0,1), (0,1);
insert into t2 (b,c) values (0,1);

# Row 1 should succeed.  Row 2 should fail.  Both fail.
select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
where t1.b <> 1 order by t1.a;

drop table t1,t2;

#
# Bug #20569: Garbage in DECIMAL results from some mathematical functions
#
SELECT 0.9888889889 * 1.011111411911;

#
# Bug #10977: No warning issued if a column name is truncated
#
prepare stmt from 'select 1 as " a "';
execute stmt;

#
# Bug #21390: wrong estimate of rows after elimination of const tables
#

CREATE TABLE t1 (a int NOT NULL PRIMARY KEY, b int NOT NULL);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);

CREATE TABLE t2 (c int NOT NULL, INDEX idx(c));
INSERT INTO t2 VALUES
  (1), (1), (1), (1), (1), (1), (1), (1),
  (2), (2), (2), (2),
  (3), (3),
  (4);

EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=1;
EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=4;

DROP TABLE t1, t2;

#
# No matches for a join after substitution of a const table
#

CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a int);
INSERT INTO t1 VALUES (1,2), (2,NULL), (3,2);

CREATE TABLE t2 (b int, c INT, INDEX idx1(b));
INSERT INTO t2 VALUES (2,1), (3,2);

CREATE TABLE t3 (d int,  e int, INDEX idx1(d));
INSERT INTO t3 VALUES (2,10), (2,20), (1,30), (2,40), (2,50);

EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
  WHERE t1.id=2;
SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
  WHERE t1.id=2;

DROP TABLE t1,t2,t3;

#
# Bug#20503: Server crash due to the ORDER clause isn't taken into account
#            while space allocation
#
create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int,
c7 int, c8 int, c9 int, fulltext key (`c1`));
select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8 
  from t1 where c9=1 order by c2, c2;
drop table t1;

#
# Bug #22735: no equality propagation for BETWEEN and IN with STRING arguments
#

CREATE TABLE t1 (pk varchar(10) PRIMARY KEY, fk varchar(16));
CREATE TABLE t2 (pk varchar(16) PRIMARY KEY, fk varchar(10));

INSERT INTO t1 VALUES
  ('d','dddd'), ('i','iii'), ('a','aa'), ('b','bb'), ('g','gg'), 
  ('e','eee'), ('c','cccc'), ('h','hhh'), ('j','jjj'), ('f','fff');
INSERT INTO t2 VALUES
  ('jjj', 'j'), ('cc','c'), ('ccc','c'), ('aaa', 'a'), ('jjjj','j'),
  ('hhh','h'), ('gg','g'), ('fff','f'), ('ee','e'), ('ffff','f'),
  ('bbb','b'), ('ff','f'), ('cccc','c'), ('dddd','d'), ('jj','j'),
  ('aaaa','a'), ('bb','b'), ('eeee','e'), ('aa','a'), ('hh','h');

EXPLAIN SELECT t2.* 
  FROM t1 JOIN t2 ON t2.fk=t1.pk
    WHERE t2.fk < 'c' AND t2.pk=t1.fk;
EXPLAIN SELECT t2.* 
  FROM t1 JOIN t2 ON t2.fk=t1.pk 
    WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk;
EXPLAIN SELECT t2.* 
  FROM t1 JOIN t2 ON t2.fk=t1.pk 
    WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk;

DROP TABLE t1,t2;

#
# Bug #22367: Optimizer uses ref join type instead of eq_ref for simple 
#               join on strings
#
CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a));
CREATE TABLE t2 (a int, b varchar(20) NOT NULL,
                 PRIMARY KEY (a), UNIQUE KEY (b));
INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
INSERT INTO t2 VALUES (1,'a'),(2,'b'),(3,'c');

EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t2.b=t1.b WHERE t1.a=3;

DROP TABLE t1,t2;

#
# Bug #19579: predicates that become sargable after reading const tables
#             are not taken into account by optimizer
#

CREATE TABLE t1(id int PRIMARY KEY, b int, e int);
CREATE TABLE t2(i int, a int, INDEX si(i), INDEX ai(a));
CREATE TABLE t3(a int PRIMARY KEY, c char(4), INDEX ci(c));

INSERT INTO t1 VALUES 
  (1,10,19), (2,20,22), (4,41,42), (9,93,95), (7, 77,79),
  (6,63,67), (5,55,58), (3,38,39), (8,81,89);
INSERT INTO t2 VALUES
  (21,210), (41,410), (82,820), (83,830), (84,840),
  (65,650), (51,510), (37,370), (94,940), (76,760),
  (22,220), (33,330), (40,400), (95,950), (38,380),
  (67,670), (88,880), (57,570), (96,960), (97,970);
INSERT INTO t3 VALUES
  (210,'bb'), (950,'ii'), (400,'ab'), (500,'ee'), (220,'gg'),
  (440,'gg'), (310,'eg'), (380,'ee'), (840,'bb'), (830,'ff'),
  (230,'aa'), (960,'ii'), (410,'aa'), (510,'ee'), (290,'bb'),
  (450,'gg'), (320,'dd'), (390,'hh'), (850,'jj'), (860,'ff');

EXPLAIN
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
  WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND 
        t3.a=t2.a AND t3.c IN ('bb','ee');
EXPLAIN
SELECT t3.a FROM t1,t2,t3
  WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
        t3.a=t2.a AND t3.c IN ('bb','ee') ;

EXPLAIN 
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
  WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
        t3.c IN ('bb','ee');
EXPLAIN 
SELECT t3.a FROM t1,t2,t3
  WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
        t3.c IN ('bb','ee');

DROP TABLE t1,t2,t3;
 
#
# Bug#25172: Not checked buffer size leads to a server crash
#
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
CREATE TABLE t2 ( f11 int PRIMARY KEY );
INSERT INTO t1 VALUES (1,1,1,0,0,0,0),(2,1,1,3,8,1,0),(3,1,1,4,12,1,0);
INSERT INTO t2 VALUES (62);
SELECT * FROM t1 LEFT JOIN t2 ON f11 = t1.checked_out GROUP BY f1 ORDER BY f2, f3, f4, f5 LIMIT 0, 1;
DROP TABLE t1, t2;

#
# Bug#6298: LIMIT #, -1 no longer works to set start with no end limit
#

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1(a int);
INSERT into t1 values (1), (2), (3);

# LIMIT N, -1 was accepted by accident in 4.0, but was not intended.
# This test verifies that this illegal construct is now properly detected.

--error ER_PARSE_ERROR
SELECT * FROM t1 LIMIT 2, -1;

DROP TABLE t1;

#
# 25407: wrong estimate of NULL keys for unique indexes
#

CREATE TABLE t1 (
  ID_with_null int NULL,
  ID_better int NOT NULL,
  INDEX idx1 (ID_with_null),
  INDEX idx2 (ID_better)
);

INSERT INTO t1 VALUES (1,1), (2,1), (null,3), (null,3), (null,3), (null,3);
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;

SELECT COUNT(*) FROM t1 WHERE ID_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID_better=1;

EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;

DROP INDEX idx1 ON t1;
CREATE UNIQUE INDEX idx1 ON t1(ID_with_null);

EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;

DROP TABLE t1;

CREATE TABLE t1 (
  ID1_with_null int NULL,
  ID2_with_null int NULL,
  ID_better int NOT NULL,
  INDEX idx1 (ID1_with_null, ID2_with_null),
  INDEX idx2 (ID_better)
);

INSERT INTO t1 VALUES (1,1,1), (2,2,1), (3,null,3), (null,3,3), (null,null,3),
  (3,null,3), (null,3,3), (null,null,3), (3,null,3), (null,3,3), (null,null,3);

INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;

SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3;
SELECT COUNT(*) FROM t1 WHERE ID1_with_null=3 AND ID2_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null IS NULL;
SELECT COUNT(*) FROM t1 WHERE ID_better=1;

EXPLAIN SELECT * FROM t1
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
EXPLAIN SELECT * FROM t1
  WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
EXPLAIN SELECT * FROM t1
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;

DROP INDEX idx1 ON t1;
CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null);

EXPLAIN SELECT * FROM t1
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
EXPLAIN SELECT * FROM t1
  WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ;
EXPLAIN SELECT * FROM t1
  WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
EXPLAIN SELECT * FROM t1
  WHERE ID_better=1 AND ID1_with_null IS NULL AND 
        (ID2_with_null=1 OR ID2_with_null=2);

DROP TABLE t1;

#
# Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison
#
CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts));
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
ANALYZE TABLE t1;

CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
ANALYZE TABLE t2;

EXPLAIN
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
  AND t1.ts BETWEEN t2.dt1 AND t2.dt2
  AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";

SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
  AND t1.ts BETWEEN t2.dt1 AND t2.dt2
  AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";

DROP TABLE t1,t2;
# Bug #22026: Warning when using IF statement and large unsigned bigint
#

create table t1 (a bigint unsigned);
insert into t1 values
  (if(1, 9223372036854775808, 1)),
  (case when 1 then 9223372036854775808 else 1 end),
  (coalesce(9223372036854775808, 1));
select * from t1;
drop table t1;
create table t1 select
  if(1, 9223372036854775808, 1) i,
  case when 1 then 9223372036854775808 else 1 end c,
  coalesce(9223372036854775808, 1) co;
show create table t1;
drop table t1;
# Ensure we handle big values properly
select 
  if(1, cast(1111111111111111111 as unsigned), 1) i,
  case when 1 then cast(1111111111111111111 as unsigned) else 1 end c,
  coalesce(cast(1111111111111111111 as unsigned), 1) co;

#
# Bug #22971: indexes on text columns are ignored for ref accesses 
#

CREATE TABLE t1 (name varchar(255));
CREATE TABLE t2 (name varchar(255), n int, KEY (name(3)));
INSERT INTO t1 VALUES ('ccc'), ('bb'), ('cc '), ('aa  '), ('aa');
INSERT INTO t2 VALUES ('bb',1), ('aa',2), ('cc   ',3);
INSERT INTO t2 VALUES (concat('cc ', 0x06), 4);
INSERT INTO t2 VALUES ('cc',5), ('bb ',6), ('cc ',7);
SELECT * FROM t2;
SELECT * FROM t2 ORDER BY name;
SELECT name, LENGTH(name), n FROM t2 ORDER BY name;

EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; 
SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; 
EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;

DROP TABLE t1,t2;

CREATE TABLE t1 (name text);
CREATE TABLE t2 (name text, n int, KEY (name(3)));
INSERT INTO t1 VALUES ('ccc'), ('bb'), ('cc '), ('aa  '), ('aa');
INSERT INTO t2 VALUES ('bb',1), ('aa',2), ('cc   ',3);
INSERT INTO t2 VALUES (concat('cc ', 0x06), 4);
INSERT INTO t2 VALUES ('cc',5), ('bb ',6), ('cc ',7);
SELECT * FROM t2;
SELECT * FROM t2 ORDER BY name;
SELECT name, LENGTH(name), n FROM t2 ORDER BY name;

EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; 
SELECT name, LENGTH(name), n FROM t2 WHERE name='cc '; 
EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;

DROP TABLE t1,t2;


#
# Bug #26963: join with predicates that contain fields from equalities evaluated
#             to constants after constant table substitution
#

CREATE TABLE t1 (
 access_id int NOT NULL default '0',
 name varchar(20) default NULL,
 rank int NOT NULL default '0',
 KEY idx (access_id)
);

CREATE TABLE t2 (
  faq_group_id int NOT NULL default '0',
  faq_id int NOT NULL default '0',
  access_id int default NULL,
  UNIQUE KEY idx1 (faq_id),
  KEY idx2 (faq_group_id,faq_id)
);

INSERT INTO t1 VALUES 
  (1,'Everyone',2),(2,'Help',3),(3,'Technical Support',1),(4,'Chat User',4);
INSERT INTO t2 VALUES
  (261,265,1),(490,494,1);


SELECT t2.faq_id 
  FROM t1 INNER JOIN t2 IGNORE INDEX (idx1)
       ON (t1.access_id = t2.access_id)
       LEFT JOIN t2 t
       ON (t.faq_group_id = t2.faq_group_id AND
           find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
   WHERE
     t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);

SELECT t2.faq_id 
  FROM t1 INNER JOIN t2
       ON (t1.access_id = t2.access_id)
       LEFT JOIN t2 t
       ON (t.faq_group_id = t2.faq_group_id AND
           find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
   WHERE
     t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);

DROP TABLE t1,t2;


#
# Bug #19372: Optimizer does not use index anymore when WHERE index NOT IN
# () is added
#
CREATE TABLE t1 (a INT, b INT, KEY inx (b,a));

INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7);
EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
    ON ( f1.b=f2.b AND f1.a<f2.a ) 
    WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
DROP TABLE t1;    

#
# Bug #27352: Incorrect result of nested selects instead of error reporting
#

CREATE TABLE t1 (c1 INT, c2 INT);
INSERT INTO t1 VALUES (1,11), (2,22), (2,22);

let $n= 31;
let $q= COUNT(c2);
while ($n)
{
  let $q= (SELECT $q);
  dec $n;
}
--disable_warnings
eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
--enable_warnings

let $n= 64;
let $q= COUNT(c2);
while ($n)
{
  let $q= (SELECT $q);
  dec $n;
}
--error ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;

DROP TABLE t1;

#
# Bug #30396: crash for a join with equalities and sargable predicates
#             in disjunctive parts of the WHERE condition 
#

CREATE TABLE t1 (
  c1 int(11) NOT NULL AUTO_INCREMENT,
  c2 varchar(1000) DEFAULT NULL,
  c3 bigint(20) DEFAULT NULL,
  c4 bigint(20) DEFAULT NULL,
  PRIMARY KEY (c1)
);

EXPLAIN EXTENDED 
SELECT  join_2.c1  
FROM 
	t1 AS join_0, 
	t1 AS join_1, 
	t1 AS join_2, 
	t1 AS join_3, 
	t1 AS join_4, 
	t1 AS join_5, 
	t1 AS join_6, 
	t1 AS join_7
WHERE 
	join_0.c1=join_1.c1  AND 
	join_1.c1=join_2.c1  AND 
	join_2.c1=join_3.c1  AND 
	join_3.c1=join_4.c1  AND 
	join_4.c1=join_5.c1  AND 
	join_5.c1=join_6.c1  AND 
	join_6.c1=join_7.c1 
         OR 
	join_0.c2 < '?'  AND 
	join_1.c2 < '?'  AND
	join_2.c2 > '?'  AND
	join_2.c2 < '!'  AND
	join_3.c2 > '?'  AND 
	join_4.c2 = '?'  AND 
	join_5.c2 <> '?' AND
	join_6.c2 <> '?' AND 
	join_7.c2 >= '?' AND
        join_0.c1=join_1.c1  AND 
	join_1.c1=join_2.c1  AND 
        join_2.c1=join_3.c1  AND
	join_3.c1=join_4.c1  AND 
	join_4.c1=join_5.c1  AND 
	join_5.c1=join_6.c1  AND 
	join_6.c1=join_7.c1
GROUP BY 
	join_3.c1,
	join_2.c1,
	join_7.c1,
	join_1.c1,
	join_0.c1;
	
SHOW WARNINGS;

DROP TABLE t1;

#
# Bug #27695: Misleading warning when declaring all space column names and
#             truncation of one-space column names to zero length names.
#

--disable_ps_protocol
SELECT 1 AS ` `;
SELECT 1 AS `  `;
SELECT 1 AS ` x`;
--enable_ps_protocol

--error 1166
CREATE VIEW v1 AS SELECT 1 AS ``;

--error 1166
CREATE VIEW v1 AS SELECT 1 AS ` `;

--error 1166
CREATE VIEW v1 AS SELECT 1 AS `  `;

--error 1166
CREATE VIEW v1 AS SELECT (SELECT 1 AS `  `);

CREATE VIEW v1 AS SELECT 1 AS ` x`;
SELECT `x` FROM v1;

--error 1166
ALTER VIEW v1 AS SELECT 1 AS ` `;

DROP VIEW v1;

#
# Bug#31800: Date comparison fails with timezone and slashes for greater
#            than comparison
#

# On DATETIME-like literals with trailing garbage, BETWEEN fudged in a
# DATETIME comparator, while greater/less-than used bin-string comparisons.
# Should correctly be compared as DATE or DATETIME, but throw a warning:

select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
                                                and '2007/10/20 00:00:00 GMT';
select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';

# We have all we need -- and trailing garbage:
# (leaving out a leading zero in first example to prove it's a
# value-comparison, not a string-comparison!)
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6';
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6';
# no time at all:
select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6';
# partial time:
select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
# fail, different second part:
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
# correct syntax, no trailing nonsense -- this one must throw no warning:
select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56';
# no warning, but failure (different hour parts):
select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00';
# succeed:
select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00';
# succeed, but warn for "trailing garbage" (":34"):
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00';
# invalid date (Feb 30) succeeds
select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34';
# 0-day for both, just works in default SQL mode.
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
# 0-day, succeed
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
                                                and '2007/10/20 00:00:00';
set SQL_MODE=TRADITIONAL;
# 0-day throws warning in traditional mode, and fails
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
# different code-path: get_datetime_value() with 0-day
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
                                                and '2007/10/20';
set SQL_MODE=DEFAULT;
select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
select str_to_date('','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
select str_to_date(NULL,'%Y-%m-%d %H:%i') = '2007-10-01 12:34';
select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '';

select str_to_date('1','%Y-%m-%d') = '1';
select str_to_date('1','%Y-%m-%d') = '1';
select str_to_date('','%Y-%m-%d') = '';

select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL;
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01';
select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL;
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01';
select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL;

#
# Bug #30666: Incorrect order when using range conditions on 2 tables or more
#

CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, 
                 c22 INT DEFAULT NULL, 
                 KEY(c21, c22));
CREATE TABLE t3 (c31 INT UNSIGNED NOT NULL DEFAULT 0, 
                 c32 INT DEFAULT NULL, 
                 c33 INT NOT NULL, 
                 c34 INT UNSIGNED DEFAULT 0,
                 KEY (c33, c34, c32));

INSERT INTO t1 values (),(),(),(),();
INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b;
INSERT INTO t3 VALUES (1, 1, 1, 0), 
                      (2, 2, 0, 0), 
                      (3, 3, 1, 0), 
                      (4, 4, 0, 0), 
                      (5, 5, 1, 0);

# Show that ORDER BY produces the correct results order
SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND 
                                 t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND 
                                 t3.c33 = 1 AND t2.c22 in (1, 3) 
                           ORDER BY c32; 

# Show that ORDER BY DESC produces the correct results order
SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND 
                                 t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND 
                                 t3.c33 = 1 AND t2.c22 in (1, 3) 
                           ORDER BY c32 DESC; 

DROP TABLE t1, t2, t3;
###########################################################################

--echo
--echo #
--echo # Bug#30736: Row Size Too Large Error Creating a Table and
--echo # Inserting Data.
--echo #

--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings

--echo

CREATE TABLE t1(
  c1 DECIMAL(10, 2),
  c2 FLOAT);

--echo

INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5);

--echo

CREATE TABLE t2(
  c3 DECIMAL(10, 2))
  SELECT
    c1 * c2 AS c3
  FROM t1;

--echo

SELECT * FROM t1;

--echo

SELECT * FROM t2;

--echo

DROP TABLE t1;
DROP TABLE t2;

--echo

###########################################################################

#
# Bug #32335: Error on BIGINT > NULL + 1 
#

CREATE TABLE t1 (c1 BIGINT NOT NULL);
INSERT INTO t1 (c1) VALUES (1);
SELECT * FROM t1 WHERE c1 > NULL + 1;
DROP TABLE t1;

--echo

###########################################################################

#
# Bug #33764: Wrong result with IN(), CONCAT() and implicit type conversion
#

CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
DROP TABLE t1;

#
# Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan"
#

CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, c INT, KEY(a));

INSERT INTO t1 VALUES (1, 1), (2, 2);
INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
                      (2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
                      (3, 1), (3, 2), (3, 3), (3, 4), (3, 5),
                      (4, 1), (4, 2), (4, 3), (4, 4), (4, 5);

FLUSH STATUS;
SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3;
SHOW STATUS LIKE 'Handler_read%';
DROP TABLE t1, t2;

#
# Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error
#
CREATE TABLE t1 (f1 bigint(20) NOT NULL default '0',
                 f2 int(11) NOT NULL default '0',
                 f3 bigint(20) NOT NULL default '0',
                 f4 varchar(255) NOT NULL default '',
                 PRIMARY KEY (f1),
                 KEY key1 (f4),
                 KEY key2 (f2));
CREATE TABLE t2 (f1 int(11) NOT NULL default '0',
                 f2 enum('A1','A2','A3') NOT NULL default 'A1',
                 f3 int(11) NOT NULL default '0',
                 PRIMARY KEY (f1),
                 KEY key1 (f3));
CREATE TABLE t3 (f1 bigint(20) NOT NULL default '0',
                 f2 datetime NOT NULL default '1980-01-01 00:00:00',
                 PRIMARY KEY (f1));

insert into t1 values (1, 1, 1, 'abc');
insert into t1 values (2, 1, 2, 'def');
insert into t1 values (3, 1, 2, 'def');
insert into t2 values (1, 'A1', 1);
insert into t3 values (1, '1980-01-01');

SELECT a.f3, cr.f4, count(*) count
FROM t2 a
STRAIGHT_JOIN t1 cr ON cr.f2 = a.f1
LEFT JOIN
(t1 cr2
  JOIN t3 ae2 ON cr2.f3 = ae2.f1
) ON a.f1 = cr2.f2 AND ae2.f2 < now() - INTERVAL 7 DAY AND
cr.f4 = cr2.f4
GROUP BY a.f3, cr.f4;

drop table t1, t2, t3;


#
# Bug #40925: Equality propagation takes non indexed attribute
#

CREATE TABLE t1 (a INT KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);

EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;

DROP TABLE t1;


--echo #
--echo # Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when 
--echo # forcing a spatial index
--echo #
CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
INSERT INTO t1 VALUES
  (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
  (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
DROP TABLE t1;


--echo #
--echo # Bug #48291 : crash with row() operator,select into @var, and 
--echo #   subquery returning multiple rows
--echo #

CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (2),(3);

--echo # Should not crash
--error ER_SUBQUERY_NO_1_ROW
SELECT 1 FROM t1 WHERE a <> 1 AND NOT
ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
INTO @var0;

DROP TABLE t1;
 
--echo #
--echo # Bug #48458: simple query tries to allocate enormous amount of
--echo #   memory
--echo #

CREATE TABLE t1(a INT NOT NULL, b YEAR);
INSERT INTO t1 VALUES ();
CREATE TABLE t2(c INT);
--echo # Should not err out because of out-of-memory
SELECT 1 FROM t2 JOIN t1 ON 1=1
  WHERE a != '1' AND NOT a >= b OR NOT ROW(b,a )<> ROW(a,a);
DROP TABLE t1,t2;


--echo #
--echo # Bug #49199: Optimizer handles incorrectly: 
--echo # field='const1' AND field='const2' in some cases
--echo
CREATE TABLE t1(a DATETIME NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
DROP TABLE t1;

CREATE TABLE t1(a DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
DROP TABLE t1;

CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
INSERT INTO t1 VALUES('2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
DROP TABLE t1;

CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
DROP TABLE t1;

CREATE TABLE t1(a DATETIME NOT NULL, b VARCHAR(20) NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';

SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
DROP TABLE t1;

CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
SELECT x.a, y.a, z.a FROM t1 x 
  JOIN t1 y ON x.a=y.a 
  JOIN t1 z ON y.a=z.a 
  WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x 
  JOIN t1 y ON x.a=y.a 
  JOIN t1 z ON y.a=z.a 
  WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
DROP TABLE t1;


--echo #
--echo # Bug #49897: crash in ptr_compare when char(0) NOT NULL 
--echo # column is used for ORDER BY
--echo #
SET @old_sort_buffer_size= @@session.sort_buffer_size;
SET @@sort_buffer_size= 40000;

CREATE TABLE t1(a CHAR(0) NOT NULL);
--disable_warnings
INSERT INTO t1 VALUES (0), (0), (0);
--enable_warnings
INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12;
INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12;
INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12;
EXPLAIN SELECT a FROM t1 ORDER BY a;
--disable_result_log
SELECT a FROM t1 ORDER BY a;
--enable_result_log
DROP TABLE t1;

CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int);
--disable_warnings
INSERT INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
--enable_warnings
INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12;
INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12;
INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12;
EXPLAIN SELECT a FROM t1 ORDER BY a LIMIT 5;
SELECT a FROM t1 ORDER BY a LIMIT 5;
EXPLAIN SELECT * FROM t1 ORDER BY a, b LIMIT 5;
SELECT * FROM t1 ORDER BY a, b LIMIT 5;
EXPLAIN SELECT * FROM t1 ORDER BY a, b, c LIMIT 5;
SELECT * FROM t1 ORDER BY a, b, c LIMIT 5;
EXPLAIN SELECT * FROM t1 ORDER BY c, a LIMIT 5;
SELECT * FROM t1 ORDER BY c, a LIMIT 5;

SET @@sort_buffer_size= @old_sort_buffer_size;
DROP TABLE t1;


--echo End of 5.0 tests

#
# Bug #30639: limit offset,rowcount wraps when rowcount >= 2^32 in windows
#
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SELECT a FROM t1 ORDER BY a LIMIT 2;
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;
DROP TABLE t1;

#
# Bug #37936: ASSERT_COLUMN_MARKED_FOR_WRITE in Field_datetime::store ,
# Field_varstring::store
#

CREATE TABLE t1 (date_key date);

CREATE TABLE t2 (
  pk int,
  int_nokey int,
  int_key int,
  date_key date NOT NULL,
  date_nokey date,
  varchar_key varchar(1)
);

INSERT INTO t2 VALUES 
(1,1,1,'0000-00-00',NULL,NULL),
(1,1,1,'0000-00-00',NULL,NULL);

# MXSTODO: SELECT 1 FROM t2 WHERE pk > ANY (SELECT 1 FROM t2);
# MXSTODO: qc_mysql cannot parse.

SELECT COUNT(DISTINCT 1) FROM t2 
  WHERE date_key = (SELECT 1 FROM t1 WHERE t2.date_key IS NULL) GROUP BY pk; 
SELECT date_nokey FROM t2
  WHERE int_key IN (SELECT 1 FROM t1)
  HAVING date_nokey = '10:41:7' 
  ORDER BY date_key;

DROP TABLE t1,t2;

#
# Bug #42957: no results from 
# select where .. (col=col and col=col) or ... (false expression)
#
CREATE TABLE t1 (a INT NOT NULL, b INT);
INSERT INTO t1 VALUES (1, 1);
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
DROP TABLE t1;

CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
DROP TABLE t1;


--echo #
--echo # Bug#45266: Uninitialized variable lead to an empty result.
--echo #
--disable_warnings
drop table if exists A,AA,B,BB;
CREATE TABLE `A` (
  `pk` int(11) NOT NULL AUTO_INCREMENT,
  `date_key` date NOT NULL,
  `date_nokey` date NOT NULL,
  `datetime_key` datetime NOT NULL,
  `int_nokey` int(11) NOT NULL,
  `time_key` time NOT NULL,
  `time_nokey` time NOT NULL,
  PRIMARY KEY (`pk`),
  KEY `date_key` (`date_key`),
  KEY `time_key` (`time_key`),
  KEY `datetime_key` (`datetime_key`)
);

CREATE TABLE `AA` (
  `pk` int(11) NOT NULL AUTO_INCREMENT,
  `int_nokey` int(11) NOT NULL,
  `time_key` time NOT NULL,
  KEY `time_key` (`time_key`),
  PRIMARY KEY (`pk`)
);

CREATE TABLE `B` (
  `date_nokey` date NOT NULL,
  `date_key` date NOT NULL,
  `time_key` time NOT NULL,
  `datetime_nokey` datetime NOT NULL,
  `varchar_key` varchar(1) NOT NULL,
  KEY `date_key` (`date_key`),
  KEY `time_key` (`time_key`),
  KEY `varchar_key` (`varchar_key`)
);

INSERT INTO `B` VALUES ('2003-07-28','2003-07-28','15:13:38','0000-00-00 00:00:00','f'),('0000-00-00','0000-00-00','00:05:48','2004-07-02 14:34:13','x');

CREATE TABLE `BB` (
  `pk` int(11) NOT NULL AUTO_INCREMENT,
  `int_nokey` int(11) NOT NULL,
  `date_key` date NOT NULL,
  `varchar_nokey` varchar(1) NOT NULL,
  `date_nokey` date NOT NULL,
  PRIMARY KEY (`pk`),
  KEY `date_key` (`date_key`)
);

INSERT INTO `BB` VALUES (10,8,'0000-00-00','i','0000-00-00'),(11,0,'2005-08-18','','2005-08-18');
# Test #1
SELECT table1 . `pk` AS field1 
  FROM 
    (BB AS table1 INNER JOIN 
      (AA AS table2 STRAIGHT_JOIN A AS table3 
        ON ( table3 . `date_key` = table2 . `pk` ))
       ON ( table3 . `datetime_key` = table2 . `int_nokey` ))
  WHERE  ( table3 . `date_key` <= 4 AND table2 . `pk` = table1 . `varchar_nokey`)
  GROUP BY field1 ;

# MXSTODO: SELECT table3 .`date_key` field1
# MXSTODO:   FROM
# MXSTODO:     B table1 LEFT JOIN B table3 JOIN
# MXSTODO:       (BB table6 JOIN A table7 ON table6 .`varchar_nokey`)
# MXSTODO:        ON table6 .`int_nokey` ON table6 .`date_key`
# MXSTODO:   WHERE  NOT ( table1 .`varchar_key`  AND table7 .`pk`) GROUP  BY field1;
# MXSTODO: qc_mysql fails to parse, problem near some ON.

# Test #2
SELECT table4 . `time_nokey` AS field1 FROM 
  (AA AS table1 CROSS JOIN 
    (AA AS table2 STRAIGHT_JOIN 
      (B AS table3 STRAIGHT_JOIN A AS table4 
       ON ( table4 . `date_key` = table3 . `time_key` ))
     ON ( table4 . `pk` = table3 . `date_nokey` ))
   ON ( table4 . `time_key` = table3 . `datetime_nokey` ))
  WHERE  ( table4 . `time_key` < table1 . `time_key` AND
            table1 . `int_nokey` != 'f')
  GROUP BY field1  ORDER BY field1 , field1;

SELECT table1 .`time_key` field2  FROM B table1  LEFT JOIN  BB JOIN A table5 ON table5 .`date_nokey`  ON table5 .`int_nokey` GROUP  BY field2;
--enable_warnings

drop table A,AA,B,BB;
--echo #end of test for bug#45266

--echo #
--echo # Bug#33546: Slowdown on re-evaluation of constant expressions.
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (2);
SELECT * FROM t1 WHERE a = 1 + 1;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
SELECT * FROM t1 HAVING a = 1 + 1;
EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');

delimiter |;
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
BEGIN
  SET @cnt := @cnt + 1;
  RETURN 1;
END;|
delimiter ;|

SET @cnt := 0;
SELECT * FROM t1 WHERE a = f1();
SELECT @cnt;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1();
DROP TABLE t1, t2;
DROP FUNCTION f1;
--echo # End of bug#33546

--echo # 
--echo # BUG#48052: Valgrind warning - uninitialized value in init_read_record()
--echo # 

# Needed in 6.0 codebase
#--echo # Disable Index condition pushdown
#--replace_column 1 #
#SELECT @old_icp:=@@engine_condition_pushdown;
#SET SESSION engine_condition_pushdown = 'OFF';

CREATE TABLE t1 (
  pk int(11) NOT NULL,
  i int(11) DEFAULT NULL,
  v varchar(1) DEFAULT NULL,
  PRIMARY KEY (pk)
);

INSERT INTO t1 VALUES (2,7,'m');
INSERT INTO t1 VALUES (3,9,'m');

SELECT  v
FROM t1
WHERE NOT pk > 0  
HAVING v <= 't' 
ORDER BY pk;

# Needed in 6.0 codebase
#--echo # Restore old value for Index condition pushdown
#SET SESSION engine_condition_pushdown=@old_icp;

DROP TABLE t1;

--echo #
--echo # Bug#49489 Uninitialized cache led to a wrong result.
--echo #
CREATE TABLE t1(c1 DOUBLE(5,4));
INSERT INTO t1 VALUES (9.1234);
SELECT * FROM t1 WHERE c1 < 9.12345;
DROP TABLE t1;
--echo # End of test for bug#49489.


--echo #
--echo # Bug #49517: Inconsistent behavior while using 
--echo # NULLable BIGINT and INT columns in comparison
--echo #
CREATE TABLE t1(a BIGINT UNSIGNED NOT NULL, b BIGINT NULL, c INT NULL);
INSERT INTO t1 VALUES(105, NULL, NULL);
SELECT * FROM t1 WHERE b < 102;
SELECT * FROM t1 WHERE c < 102;
SELECT * FROM t1 WHERE 102 < b;
SELECT * FROM t1 WHERE 102 < c;
DROP TABLE t1;


--echo #
--echo # Bug #54459: Assertion failed: param.sort_length, 
--echo # file .\filesort.cc, line 149 (part II)
--echo #
CREATE TABLE t1(a ENUM('') NOT NULL);
INSERT INTO t1 VALUES (), (), ();
EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
DROP TABLE t1;

--echo #
--echo # Bug #702310: usage of 2 join buffers after ref access to an empty table 
--echo #

CREATE TABLE t1 (f1 int) ;
INSERT INTO t1 VALUES (9);

CREATE TABLE t2 (f1 int);
INSERT INTO t2 VALUES (3),(7),(18);
INSERT INTO t2 VALUES (3),(7),(18);
INSERT INTO t2 VALUES (3),(7),(18);
INSERT INTO t2 VALUES (3),(7),(18);

CREATE TABLE t3 (f1 int);
INSERT INTO t3 VALUES (17);

CREATE TABLE t4  (f1 int PRIMARY KEY, f2 varchar(1024)) ;

CREATE TABLE t5 (f1 int) ;
INSERT INTO t5 VALUES (20),(5);

CREATE TABLE t6(f1 int);
INSERT INTO t6 VALUES (9),(7);

SET SESSION join_buffer_size = 2176;

EXPLAIN
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;

SET SESSION join_buffer_size = DEFAULT;

DROP TABLE t1,t2,t3,t4,t5,t6;

--echo #
--echo # Bug #698882: best equality substitution not applied to ref 
--echo #

CREATE TABLE t1 (a1 int NOT NULL, b1 char(10), INDEX idx (a1));
CREATE TABLE t2 (a2 int NOT NULL, b2 char(10), INDEX idx (a2));
CREATE TABLE t3 (a3 int NOT NULL, b3 char(10), INDEX idx (a3));
INSERT INTO t1 VALUES (2,'xx'), (1,'xxx'),  (11,'xxxxxxx');
INSERT INTO t2 VALUES
  (7,'yyyy'), (2,'y'), (3,'yyy'), (1,'yy'), (1,'yyyyy'),
  (3,'yy'),  (1,'y'), (4,'yyy'), (7,'y'),  (4,'yyyyy'), (7,'yyy'),
  (7,'yyyy'), (2,'yy'),  (3,'yyy'), (1,'yyyyyyyy'), (1,'yyyyy'),
  (3,'yy'), (1,'yyy'), (4,'yyy'), (7,'y'), (4,'yyyyy'), (7,'yyy');
INSERT INTO t3 VALUES
  (9,'zzzzzzz'), (2,'zzzzz'), (1,'z'), (9,'zz'), (1,'zz'), (5,'zzzzzzz'),
  (4,'zz'), (3,'z'), (5,'zzzzzz'), (3,'zz'), (4,'zzzz'), (3,'z'),
  (9,'zzzzzzzz'), (2,'zz'), (1,'zz'), (9,'zzz'), (1,'zzz'), (5,'zzzzzzzz'),
  (4,'zzz'), (3,'zz'), (5,'zzzzzzz'), (3,'zzz'), (4,'zzzzz'), (3,'zz'),
  (9,'zzzzzz'), (2,'zzzz'), (1,'zzz'), (9,'z'), (1,'z'), (5,'zzzzzz'),
  (4,'z'), (3,'zzz'), (5,'zzzzz'), (3,'z'), (4,'zzz'), (3,'zzzz'),
  (9,'zzzzz'), (2,'zzz'), (1,'zzzz'), (9,'zzz'), (1,'zzzz'), (5,'zzzzz'),
  (4,'zzz'), (3,'zzzz'), (5,'zzzz'), (3,'zzz'), (4,'zz'), (3,'zzzzz');

set @tmp= @@optimizer_switch;
SET SESSION optimizer_switch='index_condition_pushdown=off';

EXPLAIN SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1;
EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t1.a1;
EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t2.a2;

--sorted_result
SELECT * from t1,t2,t3
  WHERE t3.a3=t1.a1 AND t2.a2=t1.a1 AND
        LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7;
--sorted_result
SELECT * FROM t1,t2,t3
  WHERE t2.a2=t1.a1 AND t3.a3=t1.a1 AND 
        LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7;
--sorted_result
SELECT * FROM t1,t2,t3
  WHERE t2.a2=t1.a1 AND t3.a3=t2.a2 AND
        LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7;

SET SESSION optimizer_switch=@tmp;

DROP TABLE t1,t2,t3;


--echo #
--echo # Bug #707555: crash with equality substitution in ref 
--echo #

CREATE TABLE t1 (f11 int, f12 int, PRIMARY KEY (f11), KEY (f12)) ;
INSERT INTO t1 VALUES (1,NULL), (8,NULL);

CREATE TABLE t2 (f21 int, f22 int, f23 int, KEY (f22)) ;
INSERT INTO t2 VALUES (1,NULL,3), (2,7,8);

CREATE TABLE t3 (f31 int, f32 int(11), PRIMARY KEY (f31), KEY (f32)) ;
INSERT INTO t3 VALUES (1,494862336);

CREATE TABLE t4 (f41 int, f42 int, PRIMARY KEY (f41), KEY (f42)) ;
INSERT INTO t4 VALUES (1,NULL), (8,NULL);

CREATE TABLE t5 (f51 int, PRIMARY KEY (f51)) ;
INSERT IGNORE INTO t5 VALUES (100);

CREATE TABLE t6 (f61 int, f62 int, KEY (f61)) ;
INSERT INTO t6 VALUES (NULL,1), (3,10);

CREATE TABLE t7 (f71 int, f72 int, KEY (f72)) ;
INSERT INTO t7 VALUES (1,NULL), (2,7);

EXPLAIN
SELECT t2.f23 FROM
  (t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31)
  LEFT JOIN
  (((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0)
  ON t3.f31 = t6.f61
    WHERE t7.f71>0;

SELECT t2.f23 FROM
  (t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31)
  LEFT JOIN
  (((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0)
  ON t3.f31 = t6.f61
    WHERE t7.f71>0;

DROP TABLE t1,t2,t3,t4,t5,t6,t7;
#
# Bug #780425: "sql_buffer_result=1 gives wrong result for GROUP BY with a
# constant expression"
#

CREATE TABLE t1(f1 int UNSIGNED) engine=myisam;
INSERT INTO t1 VALUES (3),(2),(1);
set sql_buffer_result=0;
SELECT f1 FROM t1 GROUP BY 1;
SELECT f1 FROM t1 GROUP BY '123' = 'abc';
SELECT 1 FROM t1 GROUP BY 1;
set sql_buffer_result=1;
SELECT f1 FROM t1 GROUP BY 1;
SELECT f1 FROM t1 GROUP BY '123' = 'abc';
SELECT 1 FROM t1 GROUP BY 1;
drop table t1;
set sql_buffer_result= 0;


--echo #
--echo # Bug #58422: Incorrect result when OUTER JOIN'ing 
--echo # with an empty table
--echo #

CREATE TABLE t_empty(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
CREATE TABLE t1(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
CREATE TABLE t2(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
INSERT INTO t2 VALUES (1,1), (2,2), (3,3);

EXPLAIN
SELECT *
  FROM 
    t1
  LEFT OUTER JOIN
    (t2 INNER JOIN t_empty ON TRUE)
  ON t1.pk=t2.pk
  WHERE t2.pk <> 2;

SELECT *
  FROM 
    t1
  LEFT OUTER JOIN
    (t2 INNER JOIN t_empty ON TRUE)
  ON t1.pk=t2.pk
  WHERE t2.pk <> 2;


EXPLAIN
SELECT *
  FROM 
    t1
  LEFT OUTER JOIN
    (t2 CROSS JOIN t_empty)
  ON t1.pk=t2.pk
  WHERE t2.pk <> 2;

SELECT *
  FROM 
    t1
  LEFT OUTER JOIN
    (t2 CROSS JOIN t_empty)
  ON t1.pk=t2.pk
  WHERE t2.pk <> 2;


EXPLAIN
SELECT *
  FROM 
    t1
  LEFT OUTER JOIN
    (t2 INNER JOIN t_empty ON t_empty.i=t2.i)
  ON t1.pk=t2.pk
  WHERE t2.pk <> 2;

SELECT *
  FROM 
    t1
  LEFT OUTER JOIN
    (t2 INNER JOIN t_empty ON t_empty.i=t2.i)
  ON t1.pk=t2.pk
  WHERE t2.pk <> 2;



DROP TABLE t1,t2,t_empty;


--echo End of 5.1 tests

--echo #
--echo # Bug#45227: Lost HAVING clause led to a wrong result.
--echo #
CREATE TABLE `CC` (
  `int_nokey` int(11) NOT NULL,
  `int_key` int(11) NOT NULL,
  `varchar_key` varchar(1) NOT NULL,
  `varchar_nokey` varchar(1) NOT NULL,
  KEY `int_key` (`int_key`),
  KEY `varchar_key` (`varchar_key`)
);
INSERT INTO `CC` VALUES
(0,8,'q','q'),(5,8,'m','m'),(7,3,'j','j'),(1,2,'z','z'),(8,2,'a','a'),(2,6,'',''),(1,8,'e'
,'e'),(8,9,'t','t'),(5,2,'q','q'),(4,6,'b','b'),(5,5,'w','w'),(3,2,'m','m'),(0,4,'x','x'),
(8,9,'',''),(0,6,'w','w'),(4,5,'x','x'),(0,0,'e','e'),(0,0,'e','e'),(2,8,'p','p'),(0,0,'x'
,'x');
# MXS: EXPLAIN SELECT `varchar_nokey` G1  FROM CC  WHERE `int_nokey` AND `int_key`  <= 4
# MXS:   HAVING G1  ORDER  BY `varchar_key` LIMIT  6   ;
# MXS: qc_get_affected_fields   : ERR: G1 int_key int_nokey varchar_nokey != int_key int_nokey varchar_nokey
# MXS: qc_mysqlembedded reports aliases, e.g. G1, as actual fields.

# MXS: SELECT `varchar_nokey` G1  FROM CC  WHERE `int_nokey` AND `int_key`  <= 4
# MXS:   HAVING G1  ORDER  BY `varchar_key` LIMIT  6   ;
# MXS: qc_get_affected_fields   : ERR: G1 int_key int_nokey varchar_nokey != int_key int_nokey varchar_nokey
# MXS: qc_mysqlembedded reports aliases, e.g. G1, as actual fields.

DROP TABLE CC;
--echo # End of test#45227
--echo #                    
--echo # BUG#776274: substitution of a single row table
--echo #                    

CREATE TABLE t1 (a int NOT NULL , b int);
INSERT INTO t1 VALUES (2,2);

SELECT * FROM t1 WHERE a = b;
EXPLAIN
SELECT * FROM t1 WHERE a = b;

DROP TABLE t1;

--echo #
--echo # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on 
--echo #            SELECT from VIEW with GROUP BY
--echo #

CREATE TABLE t1 (
  col_int_key int DEFAULT NULL,
  KEY int_key (col_int_key)
) ;

INSERT INTO t1 VALUES (1),(2);

CREATE VIEW view_t1 AS 
  SELECT t1.col_int_key AS col_int_key
  FROM t1;

SELECT col_int_key FROM view_t1 GROUP BY col_int_key;

DROP VIEW view_t1;
DROP TABLE t1;

--echo # End of test BUG#54515

--echo #
--echo # Bug #57203 Assertion `field_length <= 255' failed.
--echo #

SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) 
UNION ALL 
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
AS foo
;

CREATE table t1(a text);
INSERT INTO t1 VALUES (''), ('');
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
GROUP BY t2.a ORDER BY t1.a;

DROP TABLE t1;

--echo # End of test BUG#57203

--echo #
--echo # lp:822760 Wrong result with view + invalid dates
--echo #
CREATE TABLE t1 (f1 date);
INSERT IGNORE INTO t1 VALUES ('0000-00-00');
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM t1 HAVING f1 = 'zz';
SELECT * FROM t1 HAVING f1 <= 'aa' ;
SELECT * FROM t1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
SELECT * FROM t1 WHERE f1 = 'zz' AND f1 <= 'aa' ;
SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
DROP TABLE t1;
DROP VIEW v1;

--echo #
--echo # Bug#63020: Function "format"'s 'locale' argument is not considered
--echo #	     when creating a "view'
--echo #

CREATE TABLE t1 (f1 DECIMAL(10,2));
INSERT INTO t1 VALUES (11.67),(17865.3),(12345678.92);
CREATE VIEW view_t1 AS SELECT FORMAT(f1,1,'sk_SK') AS f1 FROM t1;
SHOW CREATE VIEW view_t1;
SELECT * FROM view_t1;
DROP TABLE t1;
DROP VIEW view_t1;
--echo # End of test  BUG#63020

--echo #
--echo # Bug #13571700 TINYBLOB NOT NULL, CRASH IN PROTOCOL::NET_STORE_DATA
--echo #

CREATE TABLE t1 (a TINYBLOB NOT NULL);
SELECT a, COUNT(*) FROM t1 WHERE 0;
DROP TABLE t1;

SET optimizer_switch=@save_optimizer_switch;

--echo #
--echo # LP bug#994275 Assertion `real->type() == Item::FIELD_ITEM' failed
--echo # in add_not_null_conds(JOIN*) with JOIN, ZEROFILL column, PK
--echo #

CREATE TABLE t1 ( a INT(6) ZEROFILL );
INSERT INTO t1 VALUES (1),(2);

CREATE TABLE t2 ( b INT PRIMARY KEY );
INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
drop table t1,t2;

--echo #
--echo # Bug mdev-4250: wrong transformation of WHERE condition with OR
--echo #

CREATE TABLE t1 (pk int PRIMARY KEY, a int);
INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);

SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
EXPLAIN EXTENDED 
SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;

DROP TABLE t1;

SELECT * FROM mysql.time_zone 
WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1) 
        AND Time_zone_id = Time_zone_id 
     OR Time_zone_id <> Time_zone_id ) 
  AND Use_leap_seconds <> 'N';

--echo #
--echo # Bug mdev-4274: result of simplification of OR badly merged
--echo #                into embedding AND  
--echo #

CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (8,8);

CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8), (9);

EXPLAIN EXTENDED
SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) 
  WHERE 1 IS NULL OR b < 33 AND b = c;
SELECT * FROM t1 INNER JOIN t2 ON ( c = a ) 
  WHERE 1 IS NULL OR b < 33 AND b = c;

DROP TABLE t1,t2;

--echo #
--echo # Bug mdev-4413: another manifestations of bug mdev-4274
--echo #                (valgrind complains)
--echo #

CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (7,1);

CREATE TABLE t2 (c int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (0), (8);

SELECT * FROM t1, t2 
  WHERE c = a AND
        ( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );

DROP TABLE t1, t2;

--echo #
--echo # Bug mdev-4355: equalities from the result of simplification of OR
--echo #                are not propagated to lower AND levels
--echo #

CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,101),(2,102),(3,103),(4,104),(5,11);

EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);

EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);

EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);

EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1);
SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1);

EXPLAIN EXTENDED
SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);

DROP TABLE t1;

--echo #
--echo # Bug mdev-4418: impossible multiple equality in OR formula 
--echo #                after row substitution
--echo #

CREATE TABLE t1 (a int, b varchar(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (0,'j'), (8,'v');

CREATE TABLE t2 (c varchar(1), d varchar(1)) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('k','k');

EXPLAIN EXTENDED
SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b));
SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b));

DROP TABLE t1,t2;

--echo #
--echo # Bug mdev-4944: range conditition in OR formula with fields
--echo #                belonging to multiple equalities 
--echo #

CREATE TABLE t1 (i1 int, j1 int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,8);

CREATE TABLE t2 (i2 int, INDEX idx (i2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8), (9);

EXPLAIN EXTENDED
SELECT * FROM t1, t2 
  WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
SELECT * FROM t1, t2 
  WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );

DROP TABLE t1,t2;

--echo #
--echo # Bug mdev-4971: equality propagation after merging degenerate 
--echo #                disjunction into embedding AND level 
--echo #

CREATE TABLE t1 (pk1 int, a1 int, b1 int, PRIMARY KEY(pk1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,10,100), (2,20,200) ;

CREATE TABLE t2 (pk2 int, a2 int, PRIMARY KEY(pk2)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,1);

SELECT * FROM t1, t2
  WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL );
EXPLAIN EXTENDED
SELECT * FROM t1, t2
  WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL );

INSERT INTO t1 VALUES (3,1,6);
SELECT * FROM t1, t2
  WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL );

DROP TABLE t1,t2;

--echo End of 5.3 tests

--echo #
--echo # mysql BUG#1271 Undefined variable in PASSWORD() 
--echo # function is not handled correctly
--echo #

create table t1 (
name VARCHAR(50) NOT NULL PRIMARY KEY,
pw VARCHAR(41) NOT NULL);

INSERT INTO t1 (name, pw) 
VALUES ('tom', PASSWORD('my_pw'));

SET @pass='my_pw';
SET @wrong='incorrect';

select * from t1;
select length(PASSWORD(@pass));


SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass);
SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong);
SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined);


select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass));
select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong));
select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));

drop table t1;

--echo End of 10.0 tests
#
# Basically created like
#
#     $ cd server
#     $ egrep -i "^SET" > set.test
#
# followed by some fixes.
#
# Lot's of duplicates, but that does not relly matter.
#
set global myisam_data_pointer_size=2;
set global myisam_data_pointer_size=default;
set debug_sync='RESET';
set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='RESET';
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='RESET';
set @@storage_engine= Aria;
set @@storage_engine= default;
set @@storage_engine= MyISAM;
set @@storage_engine= default;
set names koi8r;
set @orig_sql_mode = @@sql_mode;
set sql_mode="no_zero_date";
set sql_mode= @orig_sql_mode;
SET @save_sql_mode=@@sql_mode;
SET sql_mode=strict_all_tables;
SET @@sql_mode=@save_sql_mode;
SET SESSION old_alter_table= 1;
SET SESSION old_alter_table= 0;
SET @orig_sql_mode = @@sql_mode;
SET @@sql_mode = 'STRICT_TRANS_TABLES';
SET @@sql_mode = @orig_sql_mode;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
set GLOBAL sql_mode=default;
set sql_mode="MySQL40";
set @@sql_mode="ANSI";
SET @@SQL_MODE="";
SET @@SQL_MODE="MYSQL323";
SET @@SQL_MODE="MYSQL40";
SET @@SQL_MODE="NO_FIELD_OPTIONS";
set global kc1.key_buffer_size = 65536;
set debug_sync='assign_key_cache_op_unlock wait_for op_locked';
set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned';
set debug_sync='now signal assigned';
set global kc1.key_buffer_size = 0;
set debug_sync='reset';
set default_storage_engine=innodb;
set default_storage_engine=MYISAM;
SET SQL_WARNINGS=1;
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
SET SQL_MODE='';
set sql_mode=NO_AUTO_VALUE_ON_ZERO;
set sql_mode= '';
set sql_mode=NO_AUTO_VALUE_ON_ZERO;
set sql_mode= '';
SET @@SESSION.AUTO_INCREMENT_INCREMENT=10;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=default;
SET @@SESSION.AUTO_INCREMENT_OFFSET=default;
set sql_mode="";
set sql_mode=default;
set sql_mode='high_not_precedence';
set sql_mode=default;
SET @a=0, @b=0;
set @my_max_allowed_packet= @@max_allowed_packet;
set global max_allowed_packet=100*@@max_allowed_packet;
set global max_allowed_packet=@my_max_allowed_packet;
SET SQL_MODE="";
set session sort_buffer_size= 32768;
set session sort_buffer_size= default;
set debug_dbug='d,str_to_datetime_warn';
SET NAMES latin1;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
set names binary;
set names koi8r;
set names cp1251;
set names binary;
set @v1=1e18;
set names latin1;
SET @@GLOBAL.max_allowed_packet=2048;
SET @@GLOBAL.max_allowed_packet=default;
set sql_mode= TRADITIONAL;
set sql_mode=DEFAULT;
SET SQL_MODE=ALLOW_INVALID_DATES;
set global secure_auth=0;
SET @@global.max_join_size = 10000;
SET @@session.max_join_size = default;
SET @@global.max_join_size = 18446744073709551615;
SET @@session.max_join_size = default;
set global secure_auth=default;
SET lock_wait_timeout= 1;
set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
set @@global.concurrent_insert= @old_concurrent_insert;
set sql_mode='TRADITIONAL';
set sql_mode='';
set sql_mode='TRADITIONAL';
SET sql_mode='';
set sql_mode='TRADITIONAL';
set sql_mode='TRADITIONAL';
set sql_mode='TRADITIONAL';
SET SQL_MODE='';
SET SQL_MODE='TRADITIONAL';
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET @@autocommit=0;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET @@completion_type=1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET @@completion_type=0;
SET @@completion_type=1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET @@completion_type=0;
SET TRANSACTION ISOLATION LEVEL	READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET @@completion_type=1;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET @@completion_type=0;
SET @@autocommit=1;
SET TRANSACTION READ ONLY;
SET TRANSACTION READ WRITE;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE;
SET TRANSACTION READ ONLY, ISOLATION LEVEL READ COMMITTED;
SET TRANSACTION READ WRITE, ISOLATION LEVEL READ COMMITTED;
SET TRANSACTION READ ONLY, READ WRITE;
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ ONLY;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
SET SESSION TRANSACTION READ ONLY, ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ ONLY;
SET GLOBAL TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ WRITE;
SET GLOBAL TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ WRITE;
SET TRANSACTION READ ONLY;
SET @only= 1;
SET TRANSACTION READ ONLY;
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ WRITE, ISOLATION LEVEL REPEATABLE READ;
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
SET TRANSACTION READ ONLY;
set @a=0;
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET global secure_auth=0;
set password="";
set password='gambling3';
set password=old_password('gambling3');
set @id := 1;
SET GLOBAL max_connections = 3;
SET GLOBAL event_scheduler = ON;
SET GLOBAL event_scheduler = OFF;
SET GLOBAL event_scheduler = ON;
SET GLOBAL event_scheduler = OFF;
SET global secure_auth=default;
SET @rnd_max= 2147483647;
SET @orig_myisam_sort_buffer_size = @@session.myisam_sort_buffer_size;
SET session myisam_sort_buffer_size=20000000;
SET session myisam_sort_buffer_size = @orig_myisam_sort_buffer_size;
SET GLOBAL debug_dbug="d,crash_commit_before";
set debug_sync='RESET';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set @a:=0;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set @a:=0;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set @a:=0;
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='RESET';
set debug_sync='create_table_like_after_open SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='RESET';
SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30');
SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30');
SET GLOBAL event_scheduler=off;
SET GLOBAL event_scheduler=on;
SET GLOBAL event_scheduler=off;
SET GLOBAL event_scheduler=on;
SET GLOBAL event_scheduler=off;
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00');
SET ROLE role_1;
SET ROLE NONE;
SET @sum=0;
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @old_debug= @@session.debug;
set debug_dbug='+d,send_kill_after_delete';
set debug_dbug=@old_debug;
set local sql_mode="";
set global sql_mode="";
set global sql_mode=default;
SET SESSION storage_engine="heap";
SET SESSION storage_engine="gemini";
SET SESSION storage_engine=default;
SET SESSION storage_engine="heap";
SET SESSION storage_engine="gemini";
SET SESSION storage_engine=default;
set names utf8;
set names default;
SET sql_mode = NO_ZERO_DATE;
SET sql_mode = '';
SET sql_mode = TRADITIONAL;
SET sql_mode = '';
set @old_mode= @@sql_mode;
set @@sql_mode='ALLOW_INVALID_DATES';
set @@sql_mode= @old_mode;
set @@sql_mode='ALLOW_INVALID_DATES';
set @@sql_mode= @old_mode;
set @@session.sql_mode='STRICT_ALL_TABLES';
set @@session.sql_mode=default;
set @@lock_wait_timeout=5;
set @@session.collation_server=filename;
set @@session.collation_server=default;
set names ascii;
SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
SET NAMES big5;
SET collation_connection='big5_chinese_ci';
SET collation_connection='big5_bin';
SET NAMES big5;
set names big5;
set names big5;
SET NAMES utf8;
SET collation_connection=big5_chinese_ci;
set names big5;
set collation_connection=big5_bin;
SET NAMES big5;
SET NAMES big5;
SET NAMES binary;
SET NAMES big5;
SET NAMES binary;
SET NAMES binary;
set names binary;
SET NAMES binary;
SET CHARACTER SET 'latin1';
SET CHARACTER SET koi8r;
SET CHARACTER SET 'DEFAULT';
SET NAMES latin1;
SET NAMES latin1 COLLATE latin1_german2_ci;
SET NAMES latin1;
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_general_ci';
SET @test_character_set= 'cp1250';
SET @test_collation= 'cp1250_czech_cs';
set names cp1250;
set names cp1250;
set names cp1250 collate cp1250_czech_cs;
set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators) 
    using cp1250);
set names cp1250 collate cp1250_czech_cs;
SET NAMES cp1251;
set global LC_TIME_NAMES=convert((-8388608) using cp1251);
SET NAMES cp1251;
SET NAMES utf8;
SET collation_connection=cp932_japanese_ci;
SET NAMES cp932;
SET @a='1';
set names cp932;
set collation_connection=cp932_bin;
SET NAMES cp932;
SET @old_character_set_client= @@character_set_client;
SET @old_character_set_connection= @@character_set_connection;
SET @old_character_set_results= @@character_set_results;
SET character_set_client= 'utf8';
SET character_set_connection= 'utf8';
SET character_set_results= 'utf8';
SET @@character_set_client= @old_character_set_client;
SET @@character_set_connection= @old_character_set_connection;
SET @@character_set_results= @old_character_set_results;
SET @@character_set_server=latin5;
SET lc_messages=ru_RU;
SET NAMES utf8;
SET GLOBAL lc_messages=ru_RU;
SET GLOBAL lc_messages=en_US;
SET lc_messages=cs_CZ;
SET NAMES UTF8;
SET lc_messages=ru_RU;
SET NAMES latin1;
set names eucjpms;
set character_set_database = eucjpms;
SET collation_connection='eucjpms_japanese_ci';
SET collation_connection='eucjpms_bin';
set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8);
SET NAMES utf8;
SET collation_connection=eucjpms_japanese_ci;
set names eucjpms;
set collation_connection=eucjpms_bin;
SET @test_character_set= 'euckr';
SET @test_collation= 'euckr_korean_ci';
SET NAMES euckr;
SET collation_connection='euckr_korean_ci';
SET collation_connection='euckr_bin';
SET NAMES euckr;
SET NAMES utf8;
SET NAMES utf8;
SET collation_connection=euckr_korean_ci;
set names euckr;
set collation_connection=euckr_bin;
SET NAMES utf8;
SET CHARACTER SET utf8;
SET CHARACTER SET default;
SET @test_character_set= 'gb2312';
SET @test_collation= 'gb2312_chinese_ci';
SET NAMES gb2312;
SET collation_connection='gb2312_chinese_ci';
SET collation_connection='gb2312_bin';
SET NAMES gb2312;
SET NAMES utf8;
SET collation_connection=gb2312_chinese_ci;
set names gb2312;
set collation_connection=gb2312_bin;
SET NAMES gbk;
# MXSTODO qc_sqlite can not parse quoted variables.
# MXSTODO SET @`tcontent`:=_binary 0x50434B000900000000000000E9000000 COLLATE `binary`/*!*/;
SET @test_character_set= 'gbk';
SET @test_collation= 'gbk_chinese_ci';
SET NAMES gbk;
SET collation_connection='gbk_chinese_ci';
SET collation_connection='gbk_bin';
SET NAMES gbk;
SET NAMES utf8;
SET collation_connection=gbk_chinese_ci;
set names gbk;
set collation_connection=gbk_bin;
SET NAMES gbk;
SET NAMES hebrew;
set names latin1;
set @@collation_connection=latin1_german2_ci;
SET NAMES latin1;
set @@collation_connection=latin1_german2_ci;
SET NAMES latin1;
SET @test_character_set= 'latin1';
SET @test_collation= 'latin1_swedish_ci';
SET collation_connection='latin1_swedish_ci';
SET collation_connection='latin1_bin';
set @str= _latin1 'ABC ���߲��~ ������ ����� ����� @ abc';
SET NAMES latin1;
SET NAMES utf8;
SET NAMES latin1;
set @@collation_connection=latin1_swedish_ci;
set @@collation_connection=latin1_bin;
set @@collation_connection=latin1_general_cs;
set @@collation_connection=binary;
set names latin1;
SET NAMES latin1;
SET NAMES latin1 COLLATE latin1_bin;
SET NAMES utf8, character_set_connection=latin1;
SET NAMES utf8;
SET NAMES latin1;
SET NAMES latin1;
SET NAMES latin1;
SET NAMES latin1;
SET NAMES latin1;
SET NAMES latin1;
set names latin2;
set names latin2 collate latin2_czech_cs;
set names utf8;
SET collation_connection=latin2_czech_cs;
set sql_mode="";
SET sql_mode='';
SET sql_mode=DEFAULT;
SET sql_mode='';
SET sql_mode=DEFAULT;
SET NAMES latin2;
set names latin2 collate latin2_czech_cs;
SET NAMES latin2;
set names latin2;
set collation_connection=latin2_bin;
set names utf8;
set names latin1;
set @@character_set_results=NULL;
SET NAMES utf8 COLLATE utf8_phone_ci;
SET NAMES utf8;
SET NAMES utf8 COLLATE utf8_5624_1;
SET NAMES utf8 COLLATE utf8_5624_2;
SET NAMES utf8 COLLATE utf8_5624_3;
SET NAMES utf8 COLLATE utf8_5624_4;
SET NAMES utf8, collation_connection=utf8_bengali_standard_ci;
SET NAMES utf8, collation_connection=utf8_bengali_traditional_ci;
SET NAMES utf8 COLLATE utf8_5624_5;
SET NAMES utf8 COLLATE utf8_5624_5_bad;
SET CHARACTER SET latin1;
SET CHARACTER SET utf8;
SET CHARACTER SET koi8r;
SET CHARACTER SET utf8;
SET CHARACTER SET 'binary';
SET NAMES latin1;
SET CHARACTER SET koi8r;
SET CHARACTER SET koi8r;
SET CHARACTER SET cp1251;
SET CHARACTER SET utf8;
SET CHARACTER SET koi8r;
SET CHARACTER SET default;
SET NAMES UTF8;
SET CHARACTER SET koi8r;
SET CHARACTER SET cp1251;
SET CHARACTER SET koi8r;
SET NAMES koi8r;
SET character_set_connection=cp1251;
SET NAMES binary;
SET NAMES utf8;
SET NAMES binary;
SET character_set_connection=utf8;
SET NAMES utf8;
SET character_set_connection=binary;
SET NAMES latin1;
SET NAMES binary;
SET NAMES binary;
SET NAMES utf8;
set names latin1;
set names koi8r;
set names latin1;
set names ascii;
set names latin1;
set names koi8r;
set names koi8r;
SET CHARACTER SET DEFAULT;
SET optimizer_switch = 'in_to_exists=on';
SET character_set_connection = utf8;
SET character_set_connection = default;
SET optimizer_switch= default;
set names sjis;
set @sjis1= _sjis   0xa1a2a3a4a5a6a7a8a9aaabacadaeaf;
set @sjis2= _sjis 0xb0b1b2b3b4b5b6b7b8b9babbbcbdbebf;
set @sjis3= _sjis 0xc0c1c2c3c4c5c6c7c8c9cacbcccdcecf;
set @sjis4= _sjis 0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf;
set @utf81= CONVERT(@sjis1 USING utf8);
set @utf82= CONVERT(@sjis2 USING utf8);
set @utf83= CONVERT(@sjis3 USING utf8);
set @utf84= CONVERT(@sjis4 USING utf8);
SET NAMES sjis;
SET collation_connection='sjis_japanese_ci';
SET collation_connection='sjis_bin';
SET NAMES sjis;
SET NAMES utf8;
SET collation_connection=sjis_japanese_ci;
set names sjis;
set collation_connection=sjis_bin;
SET NAMES sjis;
SET NAMES swe7;
SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
SET NAMES tis620;
SET collation_connection='tis620_thai_ci';
SET collation_connection='tis620_bin';
set names tis620;
set collation_connection=tis620_thai_ci;
set collation_connection=tis620_bin;
SET NAMES utf8 COLLATE utf8_unicode_ci;
set names utf8;
set collation_connection=utf8_unicode_ci;
SET NAMES utf8;
SET @test_character_set= 'utf8';
SET @test_collation= 'utf8_swedish_ci';
SET collation_connection='utf8_unicode_ci';
set names utf8;
set collation_connection=ucs2_unicode_ci;
set names utf8;
SET collation_connection=utf8_czech_ci;
SET collation_connection=ucs2_czech_ci;
SET NAMES utf8 COLLATE utf8_unicode_ci;
set collation_connection=ucs2_unicode_ci;
set @@collation_connection=utf8_unicode_ci;
set @@collation_connection=utf8_czech_ci;
set @@collation_connection=ucs2_czech_ci;
SET collation_connection=utf8_german2_ci;
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci;
SET NAMES utf8 COLLATE utf8_unicode_ci;
SET NAMES utf8 COLLATE utf8_german2_ci;
SET NAMES utf8 COLLATE utf8_myanmar_ci;
SET collation_connection=ucs2_myanmar_ci;
SET NAMES utf8 COLLATE utf8_unicode_ci;
SET NAMES utf8 COLLATE utf8_german2_ci;
SET NAMES utf8 COLLATE utf8_german2_ci;
SET NAMES utf8;
SET @test_character_set= 'ucs2';
SET @test_collation= 'ucs2_general_ci';
SET NAMES latin1;
SET character_set_connection=ucs2;
SET CHARACTER SET koi8r;
SET NAMES koi8r;
SET character_set_connection=ucs2;
SET NAMES latin1;
set @ivar= 1234;
set @str1 = 'select ?';
set @str2 = convert(@str1 using ucs2);
set names latin1;
SET collation_connection='ucs2_general_ci';
SET NAMES latin1;
SET collation_connection='ucs2_bin';
SET NAMES latin1;
SET collation_connection='ucs2_swedish_ci';
SET NAMES latin1;
set sql_mode="";
set sql_mode=default;
set @param1='%%';
set names latin1;
set names ucs2;
set names ucs2 collate ucs2_bin;
set character_set_client= ucs2;
set character_set_client= concat('ucs', substr('2', 1));
set @param1='%%';
set names latin1;
set character_set_connection=ucs2;
set names latin1;
set names latin1;
set character_set_connection=ucs2;
set names latin1;
SET @@sql_mode=pad_char_to_full_length;
SET @@sql_mode=default;
set collation_connection=ucs2_general_ci;
set names latin1;
SET character_set_connection=ucs2;
SET LC_TIME_NAMES=ru_RU;
SET NAMES utf8;
SET character_set_connection=ucs2;
SET character_set_connection=latin1;
SET NAMES utf8;
SET NAMES latin1;
SET collation_connection=ucs2_general_ci;
SET NAMES latin1;
set collation_connection=ucs2_general_ci;
set collation_connection=ucs2_bin;
SET collation_connection=ucs2_general_ci;
SET NAMES latin1;
SET collation_connection=ucs2_german2_ci;
SET NAMES latin1;
SET sql_mode='strict_all_tables';
SET sql_mode=DEFAULT;
SET NAMES latin1, collation_connection=ucs2_bin;
SET NAMES latin1, collation_connection=ucs2_general_ci;
SET NAMES latin1;
SET NAMES utf8, character_set_connection=ucs2;
SET NAMES latin1, character_set_connection=ucs2;
SET NAMES utf8;
set names ujis;
set @ujis1= _ujis     0x8EA18EA28EA38EA48EA58EA68EA78EA88EA98EAA8EAB8EAC8EAD8EAE8EAF;
set @ujis2= _ujis 0x8EB08EB18EB28EB38EB48EB58EB68EB78EB88EB98EBA8EBB8EBC8EBD8EBE8EBF;
set @ujis3= _ujis 0x8EC08EC18EC28EC38EC48EC58EC68EC78EC88EC98ECA8ECB8ECC8ECD8ECE8ECF;
set @ujis4= _ujis 0x8ED08ED18ED28ED38ED48ED58ED68ED78ED88ED98EDA8EDB8EDC8EDD8EDE8EDF;
set sql_mode="";
set sql_mode=default;
SET collation_connection='ujis_japanese_ci';
SET collation_connection='ujis_bin';
set names ujis;
set character_set_database = ujis;
set character_set_server = ujis;
SET NAMES utf8;
set names default;
set character_set_database=default;
set character_set_server=default;
SET NAMES utf8;
SET collation_connection=ujis_japanese_ci;
set names ujis;
set collation_connection=ujis_bin;
SET TIME_ZONE='+03:00';
SET NAMES utf8mb4, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES latin1;
SET @ivar= 1234;
SET @str1 = 'SELECT ?';
SET @str2 = CONVERT(@str1 USING utf16le);
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection='utf16le_general_ci';
SET NAMES utf8, collation_connection='utf16le_bin';
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET @param1='%%';
SET @param1='%%';
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_bin;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES latin1;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET max_sort_length=4;
SET max_sort_length=DEFAULT;
SET NAMES utf8, @@character_set_results=NULL;
SET NAMES latin1;
SET NAMES utf8;
SET NAMES utf8, @@collation_connection=utf16le_bin;
SET NAMES utf8, collation_connection=utf16le_general_ci;
SET NAMES utf8, collation_connection=utf16le_bin;
SET NAMES utf8;
SET TIME_ZONE='+03:00';
SET NAMES latin1;
SET character_set_connection=utf16;
SET NAMES latin1;
SET character_set_connection=utf16;
SET NAMES utf8;
SET character_set_connection=utf16;
SET NAMES latin1;
set @ivar= 1234;
set @str1 = 'select ?';
set @str2 = convert(@str1 using utf16);
set names utf8;
SET NAMES latin1;
SET collation_connection='utf16_general_ci';
SET NAMES latin1;
SET collation_connection='utf16_bin';
SET NAMES latin1;
set @param1='%%';
set @param1='%%';
set names latin1;
set character_set_connection=utf16;
set names latin1;
set names latin1;
set collation_connection=utf16_general_ci;
set names latin1;
set names latin1;
set character_set_connection=utf16;
set collation_connection=utf16_general_ci;
set names latin1;
SET collation_connection=utf16_general_ci;
SET NAMES latin1;
SET collation_connection=utf16_general_ci;
SET max_sort_length=4;
SET max_sort_length=DEFAULT;
SET NAMES latin1;
SET NAMES utf8, @@character_set_results=NULL;
SET NAMES latin1;
SET NAMES utf8;
SET NAMES utf8, @@character_set_connection=utf16;
set collation_connection=utf16_general_ci;
set collation_connection=utf16_bin;
SET NAMES utf8mb4;
SET @arg00=_binary 0xD800;
SET @arg00=_binary 0xD800DC00;
SET @arg00=_binary 0x00FF;
SET NAMES utf8;
set names utf8;
set collation_connection=utf16_unicode_ci;
SET NAMES utf8;
SET NAMES utf8;
SET @test_character_set='utf16';
SET @test_collation='utf16_swedish_ci';
SET collation_connection='utf16_unicode_ci';
set collation_connection=utf16_unicode_ci;
SET collation_connection=utf16_czech_ci;
set collation_connection=utf16_unicode_ci;
set @@collation_connection=utf16_czech_ci;
SET NAMES utf8;
SET collation_connection=utf16_german2_ci;
SET NAMES utf8mb4;
SET collation_connection=utf16_unicode_520_ci;
SET NAMES utf8;
SET collation_connection=utf16_myanmar_ci;
SET TIME_ZONE = '+03:00';
SET NAMES latin1;
SET character_set_connection=utf32;
SET NAMES latin1;
SET character_set_connection=utf32;
SET NAMES utf8;
SET character_set_connection=utf32;
SET NAMES latin1;
set @ivar= 1234;
set @str1 = 'select ?';
set @str2 = convert(@str1 using utf32);
set names utf8;
SET NAMES latin1;
SET collation_connection='utf32_general_ci';
SET NAMES latin1;
SET collation_connection='utf32_bin';
set @param1='%%';
set @param1='%%';
set names latin1;
set character_set_connection=utf32;
set names latin1;
set names latin1;
set collation_connection=utf32_general_ci;
set names latin1;
set names latin1;
set character_set_connection=utf32;
SET collation_connection=utf32_general_ci;
SET NAMES latin1;
set collation_connection=utf32_general_ci;
set names latin1;
SET collation_connection=utf32_general_ci;
SET max_sort_length=4;
SET max_sort_length=DEFAULT;
SET NAMES latin1;
SET NAMES utf8mb4, @@character_set_results=NULL;
SET NAMES latin1;
SET NAMES utf8mb4;
SET collation_connection=utf32_general_ci;
SET collation_connection=utf32_general_ci;
SET NAMES utf8, @@character_set_connection=utf32;
set collation_connection=utf32_general_ci;
set collation_connection=utf32_bin;
SET NAMES utf8mb4;
SET @arg00=_binary 0x20FFFF;
SET @arg00=_binary 0x010000;
SET @arg00=_binary 0x00FF;
SET NAMES utf8;
set names utf8;
set collation_connection=utf32_unicode_ci;
SET NAMES utf8;
SET NAMES utf8;
SET @test_character_set='utf32';
SET @test_collation='utf32_swedish_ci';
SET collation_connection='utf32_unicode_ci';
set collation_connection=utf32_unicode_ci;
SET collation_connection=utf32_czech_ci;
SET collation_connection=utf32_unicode_ci;
set collation_connection=utf32_unicode_ci;
set @@collation_connection=utf32_czech_ci;
SET NAMES utf8;
SET collation_connection=utf32_german2_ci;
SET NAMES utf8mb4;
SET collation_connection=utf32_unicode_520_ci;
SET NAMES utf8;
SET collation_connection=utf32_myanmar_ci;
set names utf8mb4;
set names utf8mb4;
set LC_TIME_NAMES='fr_FR';
set LC_TIME_NAMES='ru_RU';
set LC_TIME_NAMES='en_US';
set names koi8r;
set names utf8mb4;
set names utf8mb4;
SET NAMES utf8mb4;
SET NAMES latin1;
set names utf8mb4;
SET collation_connection='utf8mb4_general_ci';
SET collation_connection='utf8mb4_bin';
set names latin1;
set names utf8mb4;
SET NAMES UTF8;
set names utf8mb4;
set names utf8mb4;
set names 'latin1';
set names utf8mb4;
SET NAMES utf8mb4;
set names utf8mb4;
set names utf8mb4;
set names utf8mb4;
set names utf8mb4;
set names utf8mb4;
set names utf8mb4;
SET NAMES utf8mb4;
SET NAMES utf8mb4;
SET NAMES latin2;
SET CHARACTER SET utf8mb4;
SET CHARACTER SET default;
set names utf8mb4;
set sql_mode=traditional;
set names utf8mb4;
set names utf8mb4;
set @a:='bar';
set @a:='kostja';
set @a:=null;
set names utf8mb4;
set names utf8mb4;
set names utf8mb4;
set names utf8mb4;
set names utf8mb4;
set sql_mode=traditional;
set sql_mode=default;
set max_sort_length=5;
set max_sort_length=default;
SET NAMES utf8;
SET NAMES utf8mb4;
SET NAMES utf8mb4, @@character_set_results=NULL;
SET NAMES latin1;
SET NAMES utf8mb4;
SET NAMES utf8mb4;
set names utf8mb4;
set @@collation_connection=utf8mb4_bin;
SET NAMES utf8;
SET NAMES utf8mb4;
SET NAMES utf8mb4;
SET NAMES utf8mb4;
SET NAMES utf8mb4;
SET collation_connection=utf8mb4_czech_ci;
SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci;
SET TIME_ZONE='+03:00';
set names utf8;
set names utf8;
set LC_TIME_NAMES='fr_FR';
set LC_TIME_NAMES='ru_RU';
set LC_TIME_NAMES='en_US';
set names koi8r;
set names utf8;
set names utf8;
SET NAMES utf8;
SET NAMES latin1;
set names utf8;
SET collation_connection='utf8_general_ci';
SET collation_connection='utf8_bin';
set names latin1;
set names utf8;
SET NAMES UTF8;
set names utf8;
set names utf8;
set names 'latin1';
set names utf8;
SET NAMES utf8;
set names utf8;
set names utf8;
set names utf8;
set names utf8;
set names utf8;
set names utf8;
SET NAMES utf8;
SET NAMES utf8;
SET NAMES latin2;
SET CHARACTER SET utf8;
SET CHARACTER SET default;
set names utf8;
set sql_mode=traditional;
set names utf8;
set names utf8;
set @a:='bar';
set @a:='kostja';
set @a:=null;
set names utf8;
set names utf8;
set names utf8;
set names utf8;
set names utf8;
set sql_mode=traditional;
set sql_mode=default;
SET NAMES utf8mb3;
SET NAMES utf8 COLLATE utf8_sinhala_ci;
SET NAMES utf8, @@character_set_results=NULL;
SET NAMES latin1;
SET NAMES utf8;
SET NAMES utf8;
SET NAMES utf8;
SET NAMES latin1;
SET NAMES utf8;
SET NAMES utf8;
SET NAMES utf8 COLLATE utf8_general_ci;
SET NAMES utf8;
SET NAMES utf8;
set names utf8;
set @@collation_connection=utf8_bin;
set max_sort_length=5;
set max_sort_length=default;
SET NAMES utf8 COLLATE utf8_bin;
SET NAMES utf8;
SET @arg00=_binary 0xFF;
SET NAMES latin1;
SET NAMES utf8;
SET NAMES utf8, collation_connection=utf8_swedish_ci;
SET @arg='¢';
SET NAMES utf8, collation_connection=utf8_swedish_ci;
SET @arg='¢';
SET NAMES utf8;
SET @b='b';
SET @b='';
SET @b='я';
SET NAMES utf8;
SET NAMES utf8;
SET NAMES utf8;
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SET @@SQL_MODE=default;
set names latin1;
set lc_time_names=ru_RU;
set names koi8r;
set lc_time_names=de_DE;
set names latin1;
set names latin1;
set lc_time_names=en_US;
SET NAMES utf8;
SET NAMES latin1;
set sql_mode="";
set names koi8r;
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6           HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2           EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2           EXECUTE 2';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2                     HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
SET DEBUG_SYNC='p0 SIGNAL s1                       EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1                       EXECUTE 2';
SET DEBUG_SYNC='p0 SIGNAL s1                                 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1';
SET DEBUG_SYNC='p0           WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0           WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
SET DEBUG_SYNC='p0           WAIT_FOR s2 TIMEOUT 6           HIT_LIMIT 3';
SET DEBUG_SYNC='p0           WAIT_FOR s2 TIMEOUT 6';
SET DEBUG_SYNC='p0           WAIT_FOR s2           EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0           WAIT_FOR s2           EXECUTE 2';
SET DEBUG_SYNC='p0           WAIT_FOR s2                     HIT_LIMIT 3';
SET DEBUG_SYNC='p0           WAIT_FOR s2';
SET DEBUG_SYNC='p0                                           HIT_LIMIT 3';
SET DEBUG_SYNC='p0 CLEAR';
SET DEBUG_SYNC='p0 TEST';
SET DEBUG_SYNC='RESET';
set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2 hit_limit 3';
set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2';
set debug_sync='p0 signal s1 wait_for s2 timeout 6           hit_limit 3';
set debug_sync='p0 signal s1 wait_for s2 timeout 6';
set debug_sync='p0 signal s1 wait_for s2           execute 2 hit_limit 3';
set debug_sync='p0 signal s1 wait_for s2           execute 2';
set debug_sync='p0 signal s1 wait_for s2                     hit_limit 3';
set debug_sync='p0 signal s1 wait_for s2';
set debug_sync='p0 signal s1                       execute 2 hit_limit 3';
set debug_sync='p0 signal s1                       execute 2';
set debug_sync='p0 signal s1                                 hit_limit 3';
set debug_sync='p0 signal s1';
set debug_sync='p0           wait_for s2 timeout 6 execute 2 hit_limit 3';
set debug_sync='p0           wait_for s2 timeout 6 execute 2';
set debug_sync='p0           wait_for s2 timeout 6           hit_limit 3';
set debug_sync='p0           wait_for s2 timeout 6';
set debug_sync='p0           wait_for s2           execute 2 hit_limit 3';
set debug_sync='p0           wait_for s2           execute 2';
set debug_sync='p0           wait_for s2                     hit_limit 3';
set debug_sync='p0           wait_for s2';
set debug_sync='p0                                           hit_limit 3';
set debug_sync='p0 clear';
set debug_sync='p0 test';
set debug_sync='reset';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6
                EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='   p0 SIGNAL s1 WAIT_FOR s2';
SET DEBUG_SYNC='p0    SIGNAL    s1    WAIT_FOR    s2';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2   ';
SET DEBUG_SYNC='   p0 SIGNAL s1 WAIT_FOR s2   ';
SET DEBUG_SYNC='   p0    SIGNAL    s1    WAIT_FOR    s2   ';
SET DEBUG_SYNC='';
SET DEBUG_SYNC=' ';
SET DEBUG_SYNC='p0';
SET DEBUG_SYNC='p0                                          EXECUTE 2';
SET DEBUG_SYNC='p0                                TIMEOUT 6 EXECUTE 2';
SET DEBUG_SYNC='p0                                TIMEOUT 6';
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1';
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1           EXECUTE 2';
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6';
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1 EXECUTE 2';
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1';
SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2 EXECUTE 2';
SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2';
SET DEBUG_SYNC='p0                  SIGNAL s1 TIMEOUT 6 EXECUTE 2';
SET DEBUG_SYNC='p0                  SIGNAL s1 TIMEOUT 6';
SET DEBUG_SYNC='p0 EXECUTE 2 SIGNAL s1 TIMEOUT 6';
SET DEBUG_SYNC='p0 TIMEOUT 6 SIGNAL s1';
SET DEBUG_SYNC='p0 EXECUTE 2 TIMEOUT 6 SIGNAL s1';
SET DEBUG_SYNC='p0 CLEAR HIT_LIMIT 3';
SET DEBUG_SYNC='CLEAR';
SET DEBUG_SYNC='p0 CLEAR p0';
SET DEBUG_SYNC='TEST';
SET DEBUG_SYNC='p0 TEST p0';
SET DEBUG_SYNC='p0 RESET';
SET DEBUG_SYNC='RESET p0';
SET DEBUG_SYNC='p0 RESET p0';
SET DEBUG_SYNC='p0 SIGNAL ';
SET DEBUG_SYNC='p0 WAIT_FOR ';
SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE ';
SET DEBUG_SYNCx='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAx s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOx s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUx 0 EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTx 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIx 3';
SET DEBUG_SYNC='p0 CLEARx';
SET DEBUG_SYNC='p0 TESTx';
SET DEBUG_SYNC='RESETx';
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 0x6 EXECUTE 2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 0x2 HIT_LIMIT 3';
SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 7 EXECUTE 2 HIT_LIMIT 0x3';
SET DEBUG_SYNC= 7;
SET GLOBAL DEBUG_SYNC= 'p0 CLEAR';
SET @myvar= 'now SIGNAL from_myvar';
SET DEBUG_SYNC= @myvar;
SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24);
SET DEBUG_SYNC= 'now SIGNAL something';
SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
SET DEBUG_SYNC= 'now SIGNAL nothing';
SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0';
SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0';
SET DEBUG_SYNC= 'now HIT_LIMIT 1';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'p1abcd   SIGNAL s1 EXECUTE 2';
SET DEBUG_SYNC= 'p2abc    SIGNAL s2 EXECUTE 2';
SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2';
SET DEBUG_SYNC= 'p4a      SIGNAL s4 EXECUTE 2';
SET DEBUG_SYNC= 'p5abcde  SIGNAL s5 EXECUTE 2';
SET DEBUG_SYNC= 'p6ab     SIGNAL s6 EXECUTE 2';
SET DEBUG_SYNC= 'p7       SIGNAL s7 EXECUTE 2';
SET DEBUG_SYNC= 'p8abcdef SIGNAL s8 EXECUTE 2';
SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2';
SET DEBUG_SYNC= 'p4a      TEST';
SET DEBUG_SYNC= 'p1abcd   TEST';
SET DEBUG_SYNC= 'p7       TEST';
SET DEBUG_SYNC= 'p9abcdef TEST';
SET DEBUG_SYNC= 'p3abcdef TEST';
SET DEBUG_SYNC= 'p1abcd   CLEAR';
SET DEBUG_SYNC= 'p2abc    CLEAR';
SET DEBUG_SYNC= 'p5abcde  CLEAR';
SET DEBUG_SYNC= 'p6ab     CLEAR';
SET DEBUG_SYNC= 'p8abcdef CLEAR';
SET DEBUG_SYNC= 'p9abcdef CLEAR';
SET DEBUG_SYNC= 'p3abcdef CLEAR';
SET DEBUG_SYNC= 'p4a      CLEAR';
SET DEBUG_SYNC= 'p7       CLEAR';
SET DEBUG_SYNC= 'p1abcd   TEST';
SET DEBUG_SYNC= 'p7       TEST';
SET DEBUG_SYNC= 'p9abcdef TEST';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'RESET';
set sql_mode="";
set sql_mode=default;
SET sql_mode = 'ALLOW_INVALID_DATES';
SET sql_mode = 'STRICT_ALL_TABLES';
SET sql_mode = '';
SET @bug20627_old_auto_increment_offset=@@auto_increment_offset;
SET @bug20627_old_auto_increment_increment=@@auto_increment_increment;
SET @bug20627_old_session_auto_increment_offset=@@session.auto_increment_offset;
SET @bug20627_old_session_auto_increment_increment=@@session.auto_increment_increment;
SET @@auto_increment_offset= 2;
SET @@auto_increment_increment= 3;
SET @@session.auto_increment_offset= 4;
SET @@session.auto_increment_increment= 5;
SET             @@auto_increment_offset=@bug20627_old_auto_increment_offset;
SET             @@auto_increment_increment=@bug20627_old_auto_increment_increment;
SET             @@session.auto_increment_offset=@bug20627_old_session_auto_increment_offset;
SET             @@session.auto_increment_increment=@bug20627_old_session_auto_increment_increment;
SET @bug20830_old_auto_increment_offset=@@auto_increment_offset;
SET @bug20830_old_auto_increment_increment=@@auto_increment_increment;
SET @bug20830_old_session_auto_increment_offset=@@session.auto_increment_offset;
SET @bug20830_old_session_auto_increment_increment=@@session.auto_increment_increment;
SET @@auto_increment_offset= 2;
SET @@auto_increment_increment= 3;
SET @@session.auto_increment_offset= 4;
SET @@session.auto_increment_increment= 5;
SET insert_id= 14;
SET insert_id= 114;
SET insert_id= 114;
SET insert_id= 14;
SET insert_id= 114;
SET insert_id= 114;
SET             @@auto_increment_offset=@bug20830_old_auto_increment_offset;
SET             @@auto_increment_increment=@bug20830_old_auto_increment_increment;
SET             @@session.auto_increment_offset=@bug20830_old_session_auto_increment_offset;
SET             @@session.auto_increment_increment=@bug20830_old_session_auto_increment_increment;
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
SET SQL_MODE='PIPES_AS_CONCAT';
SET SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,STRICT_ALL_TABLES';
SET SQL_MODE='NO_ZERO_DATE,STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
set @old_delayed_updates = @@global.low_priority_updates;
set global low_priority_updates = 1;
set global low_priority_updates = @old_delayed_updates;
SET AUTOCOMMIT= 0;
SET AUTOCOMMIT= 1;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
set GLOBAL sql_mode=default;
SET AUTOCOMMIT=0;
SET AUTOCOMMIT=1;
SET SESSION SQL_BUFFER_RESULT=1;
SET SESSION SQL_BUFFER_RESULT=DEFAULT;
set global log_bin_trust_routine_creators=1;
set table_type='MyISAM';
set @exit_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=on,derived_with_keys=on';
set @save_optimizer_switch=@@optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @stmt= ' explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25 ' ;
set @@optimizer_switch=@save_optimizer_switch;
SET optimizer_switch='derived_merge=on';
set optimizer_switch=@save_optimizer_switch;
set @@tmp_table_size=8192;
set @tmp_jcl= @@join_cache_level;
set @tmp_os= @@optimizer_switch;
set join_cache_level=8;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
set join_cache_level=@tmp_jcl;
set optimizer_switch=@tmp_os;
set @tmp_jcl= @@join_cache_level;
set @tmp_os= @@optimizer_switch;
set join_cache_level=6;
set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on';
set join_cache_level=@tmp_jcl;
set optimizer_switch=@tmp_os;
set optimizer_switch=@exit_optimizer_switch;
set @save_derived_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set @save_derived_optimizer_switch_bug=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on,derived_with_keys=on,in_to_exists=on';
set optimizer_switch=@save_derived_optimizer_switch_bug;
set @save_derived_optimizer_switch_bug=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on';
set optimizer_switch=@save_derived_optimizer_switch_bug;
set optimizer_switch=@save_derived_optimizer_switch;
set @exit_optimizer_switch=@@optimizer_switch;
set @exit_join_cache_level=@@join_cache_level;
set optimizer_switch='derived_merge=on,derived_with_keys=on';
set @save_optimizer_switch=@@optimizer_switch;
set join_cache_level=1;
SET SESSION optimizer_switch='semijoin=off,derived_with_keys=on,materialization=off';
SET SESSION optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch='derived_with_keys=off';
SET SESSION optimizer_switch='derived_with_keys=on';
SET SESSION optimizer_switch=@save_optimizer_switch;
set optimizer_switch='derived_merge=off';
set optimizer_switch='derived_merge=on';
SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off,materialization=off';
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
SET SESSION optimizer_switch='derived_with_keys=off';
SET SESSION optimizer_switch='derived_with_keys=on';
SET optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch='derived_with_keys=on';
SET SESSION optimizer_switch = 'derived_with_keys=on';
SET SESSION join_cache_level = 1;
SET SESSION join_buffer_size = 512;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET SESSION optimizer_switch = 'derived_with_keys=on';
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = default;
SET optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch='semijoin=on';
set optimizer_switch= @save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=off';
set SESSION optimizer_switch= @save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_with_keys=on';
SET @@tmp_table_size=1024*4;
SET @@tmp_table_size=1024*1024*16;
SET @@tmp_table_size=default;
set SESSION optimizer_switch= @save_optimizer_switch;
set @tmp_882994= @@max_heap_table_size;
set max_heap_table_size=1;
set max_heap_table_size= @tmp_882994;
SET @save_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=on';
set SESSION optimizer_switch= @save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=on';
SET SESSION optimizer_switch='derived_with_keys=on';
SET SESSION optimizer_switch= @save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='derived_merge=off';
SET SESSION optimizer_switch='derived_with_keys=off';
SET SESSION optimizer_switch='derived_merge=on';
SET SESSION optimizer_switch='derived_with_keys=on';
SET SESSION optimizer_switch= @save_optimizer_switch;
SET @save968720_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on';
set optimizer_switch=@save968720_optimizer_switch;
SET @save978847_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on';
set optimizer_switch=@save978847_optimizer_switch;
SET @save3912_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
set optimizer_switch=@save3912_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_with_keys=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch5740=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on';
set optimizer_switch=@save_optimizer_switch5740;
set optimizer_switch='derived_merge=off,derived_with_keys=on';
SET @save_heap_size= @@max_heap_table_size;
SET @@max_heap_table_size= 16384;
SET @@max_heap_table_size= @save_heap_size;
SET optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=1;
set join_cache_level=@save_join_cache_level;
SET @old_max_heap_table_size = @@max_heap_table_size;
SET @@max_heap_table_size = 16384;
SET @old_sort_buffer_size = @@sort_buffer_size;
SET @@sort_buffer_size = 32804;
SET @@sort_buffer_size = @old_sort_buffer_size;
SET @@max_heap_table_size = @old_max_heap_table_size;
set join_buffer_size=1024;
set join_buffer_size=1024*16;
set join_buffer_size=default;
SET @tmp_table_size_save= @@tmp_table_size;
SET @@tmp_table_size= 1024;
SET @@tmp_table_size= @tmp_table_size_save;
set debug_dbug='+d,unstable_db_type';
set debug_dbug='-d,unstable_db_type';
SET SESSION debug_dbug= "+d,bug43138";
SET SESSION debug_dbug= "-d,bug43138";
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
set @@sql_mode="allow_invalid_dates";
set @@sql_mode="";
set @@sql_mode="allow_invalid_dates";
set @@sql_mode="";
set @@sql_mode="allow_invalid_dates";
set @@sql_mode="";
set @a=0x0102000200030004000F0D086B74697A6A7176746F6B687563726A746E7A746A666163726C6F7A6B62636B6B756B666779666977617369796F67756C726D62677A72756E63626D78636D7077706A6F736C6D636464696770786B6371637A6A6A6463737A6A676879716462637178646C666E6B6C726A637677696E7271746C616D646368687A6C707869786D666F666261797470616A63797673737A796D74747475666B717573687A79696E7276706F796A6E767361796A6F6D646F6378677A667074746363736A796D67746C786F697873686464616265616A7A6F7168707A6B776B6376737A6B72666C6F666C69636163686F6B666D627166786A71616F;
set @a=0x00020008000009000C2C010080;
set names utf8;
set names default;
set names utf8;
set names default;
set names utf8;
set names default;
set     impressions = column_add(impressions,
            'total', 12,
            '2014-10-28 16:00:00', 3,
            '2014-10-30 15:00:00', 3,
            '2014-11-04 09:00:00', 6
        );
set     impressions = column_add(impressions,
            'total', "a12",
            '2014-10-28 16:00:00', "a3",
            '2014-10-30 15:00:00', "a3",
            '2014-11-04 09:00:00', "a6"
        );
SET NAMES utf8;
SET SQL_MODE="";
set session sql_mode='no_engine_substitution';
set local sql_mode="";
set global sql_mode="";
SET SESSION enforce_storage_engine=MyISAM;
SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
SET SESSION sql_mode='';
SET SESSION enforce_storage_engine=MyISAM;
SET SESSION enforce_storage_engine=FooBar;
SET SESSION enforce_storage_engine=MyISAM;
SET SESSION enforce_storage_engine=NULL;
SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
SET GLOBAL enforce_storage_engine=Memory;
SET SESSION sql_mode='';
set global sql_mode=default;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;
SET SESSION enforce_storage_engine=Memory;
SET SESSION enforce_storage_engine=NULL;
SET SESSION enforce_storage_engine=Memory;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;
set debug_dbug='+d,external_lock_failure';
set debug_dbug='';
set tmp_table_size=1024;
set session debug_dbug="+d,raise_error";
set tmp_table_size=default;
SET SESSION debug_dbug='+d,alter_table_only_index_change';
SET SESSION debug_dbug=DEFAULT;
SET SESSION debug_dbug="+d,bug42064_simulate_oom";
SET SESSION debug_dbug=DEFAULT;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET SESSION debug_dbug= '+d,only_one_Unique_may_be_created';
SET SESSION debug_dbug= DEFAULT;
SET optimizer_switch=@save_optimizer_switch;
SET SESSION debug_dbug="+d,bug11747970_raise_error";
SET SESSION debug_dbug = DEFAULT;
set sql_mode='traditional';
set sql_mode=default;
SET NAMES utf8;
SET sql_quote_show_create= _binary x'5452C39C45';
SET sql_quote_show_create= _utf8 x'5452C39C45';
SET sql_quote_show_create=_latin1 x'5452DC45';
SET sql_quote_show_create='TRÜE';
SET sql_quote_show_create=TRÜE;
SET NAMES latin1;
SET sql_quote_show_create= _binary x'5452C39C45';
SET sql_quote_show_create= _utf8 x'5452C39C45';
SET sql_quote_show_create=_latin1 x'5452DC45';
SET sql_quote_show_create='TR�E';
SET sql_quote_show_create=TR�E;
SET NAMES binary;
SET sql_quote_show_create= _binary x'5452C39C45';
SET sql_quote_show_create= _utf8 x'5452C39C45';
SET sql_quote_show_create=_latin1 x'5452DC45';
SET NAMES utf8 COLLATE utf8_latvian_ci ;
set sql_mode="";
SET GLOBAL event_scheduler=1;
SET GLOBAL event_scheduler=off;
SET GLOBAL event_scheduler=off;
set global event_scheduler = on;
set global event_scheduler = off;
set names utf8;
set names cp1251;
set names latin1;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
set sql_mode="";
set names utf8;
set global event_scheduler=off;
set global event_scheduler=on;
set global event_scheduler=1;
set global event_scheduler=off;
set names utf8;
SET SQL_MODE="";
set @concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert = 0;
SET GLOBAL event_scheduler = 'OFF';
SET NAMES cp1251;
SET NAMES utf8;
SET NAMES latin1;
set @a=3;
set global event_scheduler=off;
set global event_scheduler= on;
set @old_sql_mode:=@@sql_mode;
set sql_mode=ansi;
set global event_scheduler= off;
set sql_mode='traditional';
set sql_mode="ansi";
set global event_scheduler= 1;
set sql_mode="traditional";
set global event_scheduler= off;
set sql_mode='ansi';
set global event_scheduler= on;
set sql_mode='traditional';
set global event_scheduler= off;
set sql_mode=@old_sql_mode;
set global event_scheduler=off;
set @a = null;
set @a= 6;
set global event_scheduler=on;
set global event_scheduler=off;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET @save_time_zone= @@TIME_ZONE;
SET TIME_ZONE= '+00:00';
SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59');
SET TIME_ZONE= '-01:00';
SET TIME_ZONE= '+02:00';
SET TIME_ZONE= '-03:00';
SET TIME_ZONE= '+04:00';
SET TIME_ZONE='+05:00';
SET TIMESTAMP= @@TIMESTAMP + 1;
SET TIME_ZONE='-05:00';
SET TIMESTAMP= @@TIMESTAMP + 1;
SET TIME_ZONE='+00:00';
SET TIME_ZONE=@save_time_zone;
SET TIMESTAMP=DEFAULT;
SET GLOBAL event_scheduler = ON;
SET autocommit=0;
SET PASSWORD FOR evtest1@localhost = password('ev1');
SET GLOBAL event_scheduler = OFF;
SET GLOBAL event_scheduler= ON;
SET GLOBAL event_scheduler= OFF;
SET GLOBAL READ_ONLY = 1;
SET GLOBAL READ_ONLY = 0;
SET GLOBAL READ_ONLY = 1;
SET GLOBAL EVENT_SCHEDULER = ON;
SET GLOBAL EVENT_SCHEDULER = OFF;
SET GLOBAL READ_ONLY = 0;
set @old_mode= @@sql_mode;
set @@sql_mode= cast(pow(2,32)-1 as unsigned integer);
set @@sql_mode= @old_mode;
SET @old_server_id = @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 32) - 1;
SET GLOBAL server_id = @old_server_id;
SET GLOBAL event_scheduler = ON;
SET GLOBAL EVENT_SCHEDULER = OFF;
SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert;
set global event_scheduler=ON;
set global event_scheduler=on;
set @@session.long_query_time=1;
set @@global.long_query_time=300;
set @@global.long_query_time=1;
set global event_scheduler=off;
set @@global.long_query_time=default;
set @@session.long_query_time=default;
set global event_scheduler=off;
set global event_scheduler=on;
set global event_scheduler=off;
set global event_scheduler=original;
set global event_scheduler=on;
# MXS Embedded parser is not aware of the 'global.event_scheduler' variable.
# MXS SET @event_scheduler=@@global.event_scheduler;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=1;
SET GLOBAL event_scheduler=0;
SET GLOBAL event_scheduler=ON;
SET GLOBAL event_scheduler=ON;
SET GLOBAL event_scheduler=DISABLED;
SET GLOBAL event_scheduler=-1;
SET GLOBAL event_scheduler=2;
SET GLOBAL event_scheduler=5;
SET GLOBAL event_scheduler=ON;
SET GLOBAL event_scheduler=@event_scheduler;
# MXS Embedded parser is not aware of the 'global.event_scheduler' variable.
# MXS SET @old_event_scheduler=@@event_scheduler;
SET GLOBAL event_scheduler=on;
SET GLOBAL event_scheduler=off;
SET GLOBAL event_scheduler=on;
SET GLOBAL event_scheduler=off;
SET GLOBAL event_scheduler=on;
SET GLOBAL event_scheduler=@old_event_scheduler;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET @save_time_zone= @@TIME_ZONE;
SET @step3= @step * 3;
SET @step6= @step * 6;
SET @unix_time= UNIX_TIMESTAMP() - 1;
SET @unix_time= @unix_time - @unix_time % @step6;
SET @tzid= LAST_INSERT_ID();
SET TIME_ZONE= '+00:00';
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET TIME_ZONE= @save_time_zone;
SET TIME_ZONE= '+00:00';
SET @tzid= LAST_INSERT_ID();
SET @now= UNIX_TIMESTAMP();
SET @offset_month_01= UNIX_TIMESTAMP('2030-01-31 12:00:00') - @now;
SET @offset_month_02= UNIX_TIMESTAMP('2030-02-28 12:00:00') - @now - 5*@step;
SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
SET @offset_month_04= UNIX_TIMESTAMP('2030-04-30 12:00:00') - @now - 13*@step;
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET TIME_ZONE= @save_time_zone;
set autocommit=off;
set sql_mode="";
set autocommit=off;
set @tmp= @@optimizer_switch;
set optimizer_switch='firstmatch=off';
set optimizer_switch=@tmp;
set @tmp= @@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
set optimizer_switch=@tmp;
set @tmp_optimizer_switch=@@optimizer_switch;
set @tmp_join_cache_level=@@join_cache_level;
set optimizer_switch='mrr=on';
set join_cache_level=6;
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=@tmp_join_cache_level;
set autocommit=1;
SET max_join_size = 10;
SET @save1= @@log_slow_rate_limit;
SET @save2= @@long_query_time;
SET log_slow_rate_limit=1000;
SET long_query_time=0.000001;
SET log_slow_rate_limit=@save1;
SET long_query_time=@save2;
set names koi8r;
set names latin1;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SET SESSION sql_mode=@old_sql_mode;
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
SET join_cache_level=@save_join_cache_level;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set global innodb_prefix_index_cluster_optimization = ON;
set global innodb_prefix_index_cluster_optimization = OFF;
set global innodb_prefix_index_cluster_optimization = OFF;
set sql_mode="";
set @a= COLUMN_CREATE(1, 1212 AS int);
set @b= column_add(@a, 2, 1212 as integer);
SET lc_messages=sr_RS;
SET lc_messages=en_US;
set time_zone="+03:00";
set time_zone= @@global.time_zone;
set @a:=0;
SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
SET sql_mode=STRICT_TRANS_TABLES;
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @old_debug= @@session.debug;
SET session debug_dbug= '+d,alloc_sort_buffer_fail';
SET session debug_dbug= @old_debug;
SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed';
SET DEBUG_SYNC='now WAIT_FOR filesort_started';
SET DEBUG_SYNC='now SIGNAL filesort_killed';
SET DEBUG_SYNC= "RESET";
set sql_mode="";
set global expire_logs_days = 3;
set global expire_logs_days = 0;
SET AUTOCOMMIT=0;
SET AUTOCOMMIT=1;
set sql_mode="";
# MXS Embedded parser is not aware of innodb.
# MXS SET @old_innodb_file_per_table= @@GLOBAL.innodb_file_per_table;
SET GLOBAL innodb_file_per_table= 1;
SET @export = 10;
SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table;
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
SET DEBUG_SYNC='now WAIT_FOR acquired';
SET DEBUG_SYNC='now SIGNAL go';
SET DEBUG_SYNC= 'RESET';
set global sql_mode="";
set local sql_mode="";
set debug_sync='RESET';
set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= "RESET";
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= "RESET";
set @id:= connection_id();
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='RESET';
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= "RESET";
set autocommit= 0;
set autocommit= 1;
set autocommit= 0;
set autocommit= 0;
set debug_sync='RESET';
set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= "RESET";
set debug_sync='RESET';
set debug_sync='trans_xa_commit_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= "RESET";
set autocommit= 0;
set autocommit= 1;
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= "RESET";
set global sql_mode=default;
set session low_priority_updates=1;
set session low_priority_updates=default;
set @old_general_log= @@general_log;
set @old_read_only= @@read_only;
set global general_log= on;
set global read_only=1;
set global general_log= @old_general_log;
set global read_only= @old_read_only;
set global read_only=1;
set global read_only=0;
set names utf8;
set names latin1;
SET NAMES utf8;
SET NAMES latin1;
SET NAMES utf8;
SET NAMES latin1;
set optimizer_switch = 'derived_merge=on';
SET NAMES latin1;
SET NAMES koi8r;
SET NAMES latin1;
SET NAMES latin1;
SET myisam_repair_threads=2;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=4;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET NAMES utf8;
set ft_boolean_syntax=' +-><()~*:""&|';
set global ft_boolean_syntax=' +-><()~*:""&|';
set global ft_boolean_syntax='@ -><()~*:""&|';
set global ft_boolean_syntax='@ -><()~*:""@|';
set global ft_boolean_syntax='+ -><()~*:""@!|';
set global max_allowed_packet=1048576;
set @@global.max_allowed_packet=1048576*100;
set @@global.max_allowed_packet=default;
set @@global.max_allowed_packet=default;
set global max_allowed_packet=default;
set @pass='my_pass';
set global old_passwords=on;
set old_passwords=on;
set global old_passwords=off;
set old_passwords=off;
set sql_mode='traditional';
set sql_mode='';
SET NAMES binary;
SET NAMES utf8;
SET NAMES latin1;
SET @a=des_decrypt(des_encrypt("hello"));
SET @a=des_decrypt(des_encrypt("hello"));
set group_concat_max_len = 4;
set group_concat_max_len = 1024;
set local group_concat_max_len=4;
set local group_concat_max_len=1024;
set local group_concat_max_len=400;
set names latin1;
set names default;
SET GROUP_CONCAT_MAX_LEN = 20000000;
SET GROUP_CONCAT_MAX_LEN = 1024;
set names utf8;
set group_concat_max_len=1024;
set names latin1;
SET group_concat_max_len = 20;
SET group_concat_max_len = DEFAULT;
SET group_concat_max_len= 65535;
SET group_concat_max_len= 10;
SET group_concat_max_len= 65535;
SET group_concat_max_len= DEFAULT;
set names latin1;
SET group_concat_max_len = 5;
SET @old_sql_mode = @@sql_mode, @@sql_mode = 'traditional';
SET group_concat_max_len = DEFAULT;
SET @@sql_mode = @old_sql_mode;
set storage_engine=innodb;
SET storage_engine=@old_engine;
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set div_precision_increment= @sav_dpi;
set @saved_div_precision_increment=@@div_precision_increment;
set div_precision_increment=19;
set div_precision_increment=20;
set @@div_precision_increment=@saved_div_precision_increment;
set @saved_div_precision_increment=@@div_precision_increment;
set div_precision_increment=19;
set div_precision_increment=20;
set @@div_precision_increment=@saved_div_precision_increment;
SET SQL_MODE=ONLY_FULL_GROUP_BY;
SET SQL_MODE=DEFAULT;
set SQL_MODE=ONLY_FULL_GROUP_BY;
SET SQL_MODE=DEFAULT;
SET SQL_MODE='ONLY_FULL_GROUP_BY';
SET SQL_MODE=default;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set @@optimizer_switch=@save_optimizer_switch;
set names utf8;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03');
SET timestamp=DEFAULT;
set time_zone="+03:00";
set time_zone= @@global.time_zone;
set names utf8;
set names latin1;
set @cnt= 1;
set @str="update t2 set b=1 where a not in (";
set @str:=concat(@str, "10000)");
set @str=NULL;
set @esc='#';
SET NAMES koi8r;
SET NAMES cp1250;
set names koi8r;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
set @var=2;
set sql_mode="";
set sql_mode=default;
set sql_mode='traditional';
set sql_mode='';
set names utf8;
set names default;
set SQL_MODE='NO_UNSIGNED_SUBTRACTION';
set SQL_MODE=default;
SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
set @a= uuid_short();
set @b= uuid_short();
set @invoked := 0;
set @invoked := 0;
SET INSERT_ID= NAME_CONST(a, a);
set @@session.time_zone='UTC';
set @@session.time_zone=@save_tz;
set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch=@optimizer_switch_save;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET debug_dbug='+d,pcre_exec_error_123';
SET debug_dbug='';
SET NAMES utf8;
SET default_regex_flags='DOTALL';
SET default_regex_flags=DEFAULT;
SET default_regex_flags='DUPNAMES';
SET default_regex_flags=DEFAULT;
SET default_regex_flags='EXTENDED';
SET default_regex_flags=DEFAULT;
SET default_regex_flags='EXTRA';
SET default_regex_flags=DEFAULT;
SET default_regex_flags='MULTILINE';
SET default_regex_flags=DEFAULT;
SET default_regex_flags='UNGREEDY';
SET default_regex_flags=DEFAULT;
SET NAMES latin1;
SET @regCheck= '\\xE0\\x01';
SET NAMES latin1;
SET @regCheck= X'E001';
SET NAMES latin1;
SET @regCheck= _binary '\\xE0\\x01';
SET NAMES latin1;
SET @regCheck= '\\xE0\\x01';
set names latin1;
set @a="^C.*";
set @a="^R.*";
SET SESSION AUTOCOMMIT=0;
SET SESSION sql_mode = '';
SET SESSION sql_mode = 'traditional';
SET SESSION sql_mode = '';
SET SESSION sql_mode = 'traditional';
SET SESSION sql_mode = '';
SET @@SQL_MODE="ALLOW_INVALID_DATES";
SET @@SQL_MODE="";
set global max_allowed_packet=1048576;
set names latin1;
set @password="password";
set @my_data="clear text to encode";
set @my_data="binary encoded data";
set @dec=5;
set @bench_count=10;
SET @orig_sql_mode = @@SQL_MODE;
SET SQL_MODE=traditional;
SET SQL_MODE=@orig_sql_mode;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
SET @user_at_host = 'root@mytinyhost-PC.local';
SET @@global.max_allowed_packet=1024*1024*1024;
SET @@global.max_allowed_packet:= @tmp_max;
SET @@global.max_allowed_packet=1024*1024*1024;
SET @@global.max_allowed_packet:= @tmp_max;
SET NAMES latin1;
SET NAMES latin2;
set global max_allowed_packet=default;
SET NAMES latin1;
set time_zone='+03:00';
set timestamp=unix_timestamp('2011-01-01 01:01:01.123456');
set @a=cast('2011-01-02 12:13:14' as datetime);
set @a='2011-01-02 12:13:14.123456';
set time_zone="+03:00";
set time_zone= @@global.time_zone;
set time_zone="+03:00";
set default_week_format = 6;
set default_week_format = 0;
set default_week_format = 2;
set default_week_format = 0;
SET @TMP='2007-08-01 12:22:49';
set time_zone='-6:00';
SET NAMES latin1;
SET character_set_results = NULL;
SET NAMES DEFAULT;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
SET GLOBAL log_bin_trust_function_creators = 0;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
set time_zone= @@global.time_zone;
set names latin1;
set names swe7;
set names latin1;
set lc_time_names=fr_FR;
set lc_time_names=en_US;
SET TIMESTAMP=-147490000; SELECT UTC_TIMESTAMP();
SET TIMESTAMP=2147483648; SELECT UTC_TIMESTAMP();
SET TIMESTAMP=2147483646; SELECT UTC_TIMESTAMP();
SET TIMESTAMP=2147483647; SELECT UTC_TIMESTAMP();
SET TIMESTAMP=0; SELECT UTC_TIMESTAMP();
SET TIMESTAMP=-1; SELECT UTC_TIMESTAMP();
SET TIMESTAMP=1; SELECT UTC_TIMESTAMP();
SET TIMESTAMP=0;
SET GLOBAL SQL_MODE='';
SET GLOBAL SQL_MODE=DEFAULT;
SET storage_engine=NULL;
SET time_zone='+03:00';
SET time_zone=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00');
SET timestamp=DEFAULT;
set sql_mode= 'TRADITIONAL';
set sql_mode= default;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2014-04-14 10:10:10');
SET timestamp=UNIX_TIMESTAMP('2014-04-14 22:22:22');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
SET timestamp=DEFAULT;
SET TIME_ZONE='+02:00';
SET TIME_ZONE=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
SET timestamp=DEFAULT;
SET TIME_ZONE='+00:00';
SET TIMESTAMP=UNIX_TIMESTAMP('2012-10-16 22:46:17');
SET TIMESTAMP=UNIX_TIMESTAMP('1970-01-02 03:04:05.123456');
SET TIME_ZONE=DEFAULT;
SET TIMESTAMP=DEFAULT;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
SET TIMESTAMP=UNIX_TIMESTAMP('2014-01-22 18:19:20');
SET TIMESTAMP=DEFAULT;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2014-04-15 01:02:03');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2010-01-01 00:00:00');
SET timestamp=DEFAULT;
set default_storage_engine=innodb;
set global max_allowed_packet=1048576;
set names latin1;
set global max_allowed_packet=default;
SET @cond = 1;
SET @cond = "invalid";
SET @var1 = 0;
SET @var2 = "message text";
SET @var1 = 9999;
SET @var1 = 9999, @var2 = 9999;
SET @tmp=ST_GIS_DEBUG(1);
set @geom=geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)');
set @buff=ST_buffer(@geom,1);
SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
SET @vert1   = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1  = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET NAMES binary;
set @@sql_mode='NO_AUTO_CREATE_USER';
set sql_log_off = 1;
set sql_log_bin = 0;
set sql_mode='maxdb';
set @@sql_mode='';
set password = password('changed');
set password = password('changed');
set password = password("changed");
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
SET GLOBAL keycache1.key_buffer_size = 128 * 1024;
SET @a := (SELECT COUNT(*) FROM t1);
SET GLOBAL keycache1.key_buffer_size = 0;
set GLOBAL sql_mode=default;
set global sql_mode="";
set local sql_mode="";
SET NAMES binary;
set global sql_mode=default;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
set GLOBAL sql_mode=default;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
set GLOBAL sql_mode=default;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
set GLOBAL sql_mode=default;
set LOCAL sql_mode=default;
set sql_mode="";
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
SET NAMES binary;
set sql_mode=ansi_quotes;
set sql_mode=default;
set sql_quote_show_create=0;
set sql_mode="ansi_quotes";
set sql_quote_show_create=1;
set sql_mode="";
SET NAMES koi8r;
SET NAMES latin1;
set @user123="non-existent";
set names koi8r;
set names latin1;
set password for mysqltest_7@ = password('systpass');
SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
set names utf8;
set names default;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
set GLOBAL sql_mode=default;
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=1;
set optimizer_search_depth=63;
set optimizer_prune_level=0;
set optimizer_search_depth=0;
set optimizer_search_depth=1;
set optimizer_search_depth=62;
set optimizer_prune_level=1;
set optimizer_search_depth=0;
set optimizer_search_depth=1;
set optimizer_search_depth=62;
SET optimizer_search_depth = 3;
SET optimizer_search_depth = DEFAULT;
set join_cache_level=@save_join_cache_level;
set @save_ext_key_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
set optimizer_switch=@save_ext_key_optimizer_switch;
SET BIG_TABLES=1;
SET BIG_TABLES=0;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set big_tables=1;
set big_tables=0;
set sql_mode=ANSI_QUOTES;
set sql_mode='';
SET SQL_MODE = 'ONLY_FULL_GROUP_BY';
SET SQL_MODE = '';
SET SQL_MODE = 'ONLY_FULL_GROUP_BY';
SET SQL_MODE = '';
SET @save_sql_mode=@@sql_mode;
SET @@sql_mode='ONLY_FULL_GROUP_BY';
SET sql_mode=@save_sql_mode;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET @old_sql_mode = @@sql_mode;
SET @@sql_mode='ONLY_FULL_GROUP_BY';
SET @@sql_mode = @old_sql_mode;
SET @old_sql_mode = @@sql_mode;
SET @@sql_mode='ONLY_FULL_GROUP_BY';
SET @@sql_mode = @old_sql_mode;
SET BIG_TABLES=1;
SET BIG_TABLES=0;
SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
SET SESSION SQL_MODE=default;
SET @save_optimizer_switch967242=@@optimizer_switch;
SET optimizer_switch = 'in_to_exists=on';
SET optimizer_switch=@save_optimizer_switch967242;
set join_cache_level=0;
set join_cache_level=default;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='outer_join_with_cache=off';
set optimizer_switch=@save_optimizer_switch;
SET sql_mode='ONLY_FULL_GROUP_BY';
SET sql_mode='';
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET NAMES latin1;
set session sql_mode='ONLY_FULL_GROUP_BY';
set session sql_mode='';
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=off,materialization=off';
set optimizer_switch=@save_optimizer_switch;
set sql_mode="";
set sql_mode=default;
set @Default_host_cache_size=279;
set @Default_host_cache_size=128;
SET @@GLOBAL.Host_Cache_Size=DEFAULT;
SET @@local.Host_Cache_Size=1;
SET @@session.Host_Cache_Size=1;
SET @@GLOBAL.Host_Cache_Size=1;
SET @@GLOBAL.Host_Cache_Size=DEFAULT;
SET @@GLOBAL.Host_Cache_Size=DEFAULT;
SET SQL_MODE="";
SET GLOBAL EVENT_SCHEDULER = OFF;
SET BINLOG_FORMAT = STATEMENT;
SET AUTOCOMMIT = FALSE;
set global keycache.key_buffer_size=128*1024;
set global keycache.key_buffer_size=0;
SET SESSION STORAGE_ENGINE='InnoDB';
SET SESSION STORAGE_ENGINE=DEFAULT;
set names utf8;
SET SESSION optimizer_switch='index_merge_sort_intersection=on';
SET SESSION sort_buffer_size = 2048;
SET SESSION sort_buffer_size = default;
SET SESSION optimizer_switch='index_merge_sort_intersection=on';
set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='index_merge_sort_intersection=off';
SET SESSION sort_buffer_size = 1024*36;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set optimizer_switch= @optimizer_switch_save;
set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='index_merge_sort_intersection=off';
set optimizer_switch='default,index_merge=off';
set optimizer_switch='default,index_merge_union=off';
set optimizer_switch=default;
set optimizer_switch='default,index_merge_sort_union=off';
set optimizer_switch='default,index_merge=off';
set optimizer_switch='default,index_merge_union=off';
set optimizer_switch=default;
set optimizer_switch='default,index_merge_sort_union=off';
set optimizer_switch=default;
set optimizer_switch='default,index_merge=off';
set optimizer_switch='default,index_merge_sort_intersection=off,index_merge_intersection=off';
set optimizer_switch='default,index_merge_union=off';
set optimizer_switch='default,index_merge_sort_union=off';
set optimizer_switch=default;
set optimizer_switch='default,index_merge_intersection=off';
set optimizer_switch='default,index_merge_union=off';
set optimizer_switch=default;
set optimizer_switch= @optimizer_switch_save;
set local sql_mode="";
set global sql_mode="";
set global sql_mode=default;
set foreign_key_checks = 0;
set foreign_key_checks = 1;
set sql_mode="";
set sql_mode="";
set global sql_mode="";
set local sql_mode="";
set names latin2;
set names latin1;
set @got_val= (select count(*) from information_schema.columns);
set @a:= '.';
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
SET max_heap_table_size = 16384;
SET max_heap_table_size = DEFAULT;
SET GLOBAL event_scheduler=1;
SET GLOBAL event_scheduler=0;
SET TIMESTAMP=@@TIMESTAMP + 10000000;
SET TIMESTAMP=DEFAULT;
set global sql_mode=default;
set GLOBAL query_cache_size=1355776;
set GLOBAL query_cache_size=default;
set global init_connect="set @a=2;set @b=3";
set GLOBAL init_connect=DEFAULT;
set GLOBAL init_connect="adsfsdfsdfs";
set global init_connect="create procedure p1() select * from t1";
set global init_connect="call p1(4711)";
set global init_connect="drop procedure if exists p1";
set global init_connect="call p1(@sum)";
set global init_connect="call p1('t1', 11)";
set global init_connect="set @x = f1()";
set global init_connect="create view v1 as select f1()";
set global init_connect="drop view v1";
set global init_connect="insert into t2 values (13), (17), (19)";
set global init_connect="set @a='a\\0c'";
set session optimizer_switch='mrr=on,mrr_sort_keys=on';
set session join_cache_level=6;
set session optimizer_switch=default;
set session join_cache_level=default;
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_ext_key_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=on';
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on,semijoin=on';
SET optimizer_switch='extended_keys=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_with_keys=on';
SET optimizer_switch = 'extended_keys=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'extended_keys=off';
SET optimizer_switch = 'extended_keys=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on';
SET optimizer_switch='join_cache_bka=on';
SET optimizer_switch='extended_keys=on';
set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set session optimizer_switch='extended_keys=off';
set session optimizer_switch='extended_keys=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_ext_key_optimizer_switch;
SET SESSION STORAGE_ENGINE=DEFAULT;
set @save_storage_engine= @@storage_engine;
set storage_engine=InnoDB;
set @innodb_icp_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set optimizer_switch=@innodb_icp_tmp;
set storage_engine= @save_storage_engine;
set @innodb_mrr_cpk_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=6;
set @save_storage_engine=@@storage_engine;
set storage_engine=innodb;
set join_cache_level=0;
set join_cache_level=6;
set optimizer_switch='index_condition_pushdown=off';
set optimizer_switch='index_condition_pushdown=on';
set join_cache_level=8;
set optimizer_switch='mrr=on,mrr_sort_keys=on';
set @tmp_mdev3817=@@optimizer_switch;
SET optimizer_switch='index_merge=on,index_merge_intersection=on';
set optimizer_switch=@tmp_mdev3817;
set @tmp_mdev5037=@@join_cache_level;
set join_cache_level=3;
set join_cache_level= @tmp_mdev5037;
set @@join_cache_level= @save_join_cache_level;
set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;
# MXS Embedded parser is not aware of innodb.
# MXS SET set @old_innodb_lock_wait_timeout=@@global.innodb_lock_wait_timeout;
set global innodb_lock_wait_timeout=300;
set session innodb_lock_wait_timeout=300;
set @@autocommit=0;
set @@autocommit=0;
set @@autocommit=0;
set @@autocommit=1;
set @@autocommit=1;
set @@autocommit=1;
SET lock_wait_timeout=1;
set global innodb_lock_wait_timeout=@old_innodb_lock_wait_timeout;
SET DEBUG_SYNC='ha_admin_try_alter SIGNAL optimize_started WAIT_FOR table_altered';
SET DEBUG_SYNC='now WAIT_FOR optimize_started';
SET DEBUG_SYNC='now SIGNAL table_altered';
SET DEBUG_SYNC='RESET';
SET DEBUG_SYNC= "ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped";
SET DEBUG_SYNC= "now WAIT_FOR opening";
SET DEBUG_SYNC= "now SIGNAL dropped";
SET DEBUG_SYNC= "RESET";
SET DEBUG_SYNC= "open_and_process_table SIGNAL opening WAIT_FOR killed";
SET DEBUG_SYNC= "now WAIT_FOR opening";
SET DEBUG_SYNC= "now SIGNAL killed";
SET DEBUG_SYNC= "RESET";
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
SET DEBUG_SYNC= 'now WAIT_FOR waiting';
SET DEBUG_SYNC= 'now SIGNAL killed';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "now WAIT_FOR manage";
SET DEBUG_SYNC= "now SIGNAL query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "now WAIT_FOR manage";
SET DEBUG_SYNC= "now SIGNAL query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "now WAIT_FOR manage";
SET DEBUG_SYNC= "now SIGNAL query";
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
SET DEBUG_SYNC= "now WAIT_FOR manage";
SET DEBUG_SYNC= "now SIGNAL query";
SET DEBUG_SYNC= "RESET";
SET SESSION debug_dbug= "+d,alter_table_rollback_new_index";
SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET SESSION lock_wait_timeout= 1;
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
SET DEBUG_SYNC= 'now SIGNAL continue4';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue3';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue4';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue5';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
SET DEBUG_SYNC= 'now SIGNAL continue4';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
SET DEBUG_SYNC= 'now SIGNAL continue5';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL continue1';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
SET DEBUG_SYNC= 'now SIGNAL continue2';
SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
SET DEBUG_SYNC= 'now SIGNAL continue3';
SET DEBUG_SYNC= 'now WAIT_FOR binlog';
SET DEBUG_SYNC= 'now SIGNAL continue4';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
SET SESSION old_alter_table= TRUE;
SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
SET DEBUG_SYNC= 'RESET';
SET SESSION old_alter_table= FALSE;
SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded';
SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild';
SET DEBUG_SYNC= 'now WAIT_FOR rebuild';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild';
SET DEBUG_SYNC= 'now WAIT_FOR rebuild';
SET DEBUG_SYNC= 'RESET';
set local sql_mode="";
set global sql_mode="";
set low_priority_updates=1;
set low_priority_updates=1;
set low_priority_updates=default;
set local sql_mode=default;
set global sql_mode=default;
SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
SET max_heap_table_size = 16384;
SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
SET GLOBAL myisam_data_pointer_size = 2;
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
set @value= "aa";
set @value= "1aa";
set @value= "aa1";
set @value= "1e+1111111111a";
set @value= "-1e+1111111111a";
# MXS ERROR 1367 (22007): Illegal double '1e+1111111111' value found during parsing
# MXS set @value= 1e+1111111111;
# MXS ERROR 1367 (22007): Illegal double '1e+1111111111' value found during parsing
# MXS set @value= -1e+1111111111;
set @value= 1e+111;
set @value= -1e+111;
set @value= 1;
set @value= -1;
SET @a= 0;
set sql_mode='error_for_division_by_zero';
set sql_mode=default;
set @@old_mode="NO_DUP_KEY_WARNINGS_WITH_IGNORE";
set @@old_mode="";
SET SQL_MODE = 'TRADITIONAL';
SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
SET SQL_MODE='';
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='optimize_join_buffer_size=on';
set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set @local_join_cache_test_optimizer_switch_default=@@optimizer_switch;
set names utf8;
set join_cache_level=1;
set join_cache_level=2;
set join_cache_level=3;
set join_cache_level=4;
set join_cache_level=1;
set join_buffer_size=256;
set join_cache_level=2;
set join_cache_level=3;
set join_cache_level=4;
set join_cache_level=default;
set join_buffer_size=default;
set join_cache_level=3;
set join_cache_level=4;
set join_cache_level=5;
set join_cache_level=6;
set join_cache_level=7;
set join_cache_level=8;
set join_buffer_size=256;
set join_cache_level=3;
set join_cache_level=4;
set join_cache_level=5;
set join_cache_level=6;
set join_cache_level=7;
set join_cache_level=8;
set join_cache_level=default;
set join_buffer_size=default;
set join_cache_level=1;
set join_cache_level=8;
set join_buffer_size=384;
set join_buffer_size=default;
set join_cache_level=6;
set join_buffer_size=256;
set join_cache_level=default;
set join_buffer_size=default;
set join_cache_level=6;
set join_cache_level=1;
set join_cache_level=5;
set join_buffer_size=512;
set join_buffer_size=32;
set join_cache_level=8;  
set join_cache_level=default;
set join_buffer_size=default;
SET join_cache_level=6;
set join_cache_level=default;
set join_buffer_size=default;
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=6;
set join_cache_level=@save_join_cache_level;
set join_cache_level=6;
set join_cache_level=default;
set join_cache_level=6;
set join_cache_level=default;
set join_cache_level=6;
set join_cache_level=0;
set join_cache_level=default;
set join_cache_level=6;
set join_buffer_size=1024;
set join_buffer_size=default;
set join_cache_level=default;
set join_cache_level=7;
set join_buffer_size=1024*1024;
set join_buffer_size=default;
set join_cache_level=default;
set join_cache_level=0;
set join_cache_level=6;
set join_buffer_size=256;
set join_cache_level=2;
set join_buffer_size=default;
set join_cache_level=default;
set join_cache_level=5;
set join_cache_level=6;
set join_cache_level=7;
set join_cache_level=8;
set join_cache_level=default;
set join_cache_level=6;
set join_cache_level=default;
set join_cache_level=1;
set join_cache_level=6;
set join_cache_level=default;
set join_cache_level=8;
set join_buffer_size=2048;
set join_buffer_size=default;
set join_cache_level=default;
SET join_cache_level=default;
set join_cache_level=6;
set join_cache_level=default;
set join_cache_level=1;
set join_cache_level=2;
set join_cache_level=default;
set join_cache_level=6;
set join_cache_level=default;
SET join_cache_level=8;
SET join_cache_level=default;
set join_cache_level = 5;
set join_cache_level = 8;
set join_cache_level = 5;
set join_cache_level = 5;
set join_cache_level = 8;
set join_cache_level = default;
set join_cache_level = 8;
set join_cache_level = default;
set join_cache_level = 6;
set join_cache_level = default;
SET SESSION join_cache_level=3;
SET SESSION join_buffer_size=100;
SET SESSION join_cache_level=DEFAULT;
SET SESSION join_buffer_size=DEFAULT;
SET SESSION join_cache_level=1;
SET SESSION join_cache_level=6;
SET SESSION join_cache_level=4;
SET SESSION join_cache_level=DEFAULT;
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_cache_level = 4;
SET SESSION join_buffer_size = 256;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = 256;
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = 'outer_join_with_cache=on';
SET SESSION join_cache_level = 7;
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = 'outer_join_with_cache=on';
SET SESSION join_cache_level = 3;
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = 'outer_join_with_cache=on';
SET SESSION join_cache_level = 0;
SET SESSION join_cache_level = 1;
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = 'outer_join_with_cache=on';
SET SESSION join_cache_level = 0;
SET SESSION join_cache_level = 2;
SET SESSION join_cache_level = 1;
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = 'outer_join_with_cache=on';
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = 0;
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = 'outer_join_with_cache=on';
SET SESSION join_cache_level = 6;
SET SESSION join_cache_level = 5;
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = 'outer_join_with_cache=on';
SET SESSION join_cache_level = 0;
SET SESSION join_cache_level = 6;
SET SESSION optimizer_switch = 'outer_join_with_cache=off';
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_cache_level = 1;
SET SESSION optimizer_switch = 'index_condition_pushdown=off';
SET SESSION optimizer_switch = 'index_condition_pushdown=on';
SET SESSION join_cache_level = DEFAULT;
SET SESSION optimizer_switch = @local_join_cache_test_optimizer_switch_default;
SET SESSION optimizer_switch='index_merge_sort_intersection=off';
SET SESSION optimizer_switch = 'index_condition_pushdown=off';
SET SESSION optimizer_switch = @local_join_cache_test_optimizer_switch_default;
SET SESSION optimizer_switch = 'index_condition_pushdown=on';
SET SESSION optimizer_switch = @local_join_cache_test_optimizer_switch_default;
SET SESSION join_cache_level = 1;
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_cache_level=3;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = 256;
SET SESSION join_cache_level = 4;
SET SESSION join_cache_level = 1;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
SET SESSION optimizer_switch=
  'semijoin=on,materialization=off,firstmatch=off,loosescan=off,derived_with_keys=on';
SET SESSION join_cache_level = 0;
SET SESSION join_cache_level = 1;
SET SESSION join_cache_level = DEFAULT;
SET @tmp887479_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='semijoin=on';
SET SESSION optimizer_switch='semijoin_with_cache=on';
SET SESSION join_cache_level=1;
SET SESSION join_cache_level=3;
SET SESSION join_cache_level = DEFAULT;
SET optimizer_switch=@tmp887479_optimizer_switch;
SET @tmp_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='semijoin=on';
SET SESSION optimizer_switch='semijoin_with_cache=on';
SET SESSION join_cache_level=1;
SET SESSION join_cache_level=4;
SET SESSION join_cache_level = DEFAULT;
SET optimizer_switch=@tmp_optimizer_switch;
SET @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch=default;
set @@optimizer_switch='semijoin_with_cache=off';
set @@optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch='derived_merge=off,derived_with_keys=off';
SET join_cache_level=0;
SET SESSION join_cache_level = DEFAULT;
SET optimizer_switch=@tmp_optimizer_switch;
SET @tmp_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='semijoin_with_cache=on';
SET join_cache_level=1;
SET join_cache_level=3;
SET join_cache_level=3;
SET SESSION join_cache_level = DEFAULT;
SET optimizer_switch=@tmp_optimizer_switch;
SET @tmp_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch='semijoin=on';
SET @@optimizer_switch='firstmatch=off';
SET @@optimizer_switch='mrr=off';
SET @@optimizer_switch='semijoin_with_cache=off';
set join_cache_level=1;
set join_cache_level=4;
SET @@optimizer_switch='semijoin_with_cache=on';
set join_cache_level=6;
SET join_cache_level = DEFAULT;
SET optimizer_switch=@tmp_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set  @@optimizer_switch='semijoin=on';
set optimizer_switch='materialization=off';
set optimizer_switch='loosescan=off,firstmatch=off';
set optimizer_switch='mrr_sort_keys=off';
set join_cache_level=7;
set join_cache_level = default;
set optimizer_switch=@tmp_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set  @@optimizer_switch='semijoin=on';
set optimizer_switch='materialization=on';
set join_cache_level=0;
set join_cache_level=2;
set join_cache_level = default;
set optimizer_switch=@tmp_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=off';
set optimizer_switch='materialization=off';
set join_cache_level=0;
set join_cache_level=2;
set join_cache_level = default;
set optimizer_switch=@tmp_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='optimize_join_buffer_size=off';
set join_buffer_space_limit=4096;
set join_buffer_size=4096*2;
set join_cache_level=2;
set optimizer_switch='outer_join_with_cache=on';
set join_buffer_space_limit=default;
set join_buffer_size=default;
set join_cache_level=default;
set optimizer_switch=@tmp_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch = 'outer_join_with_cache=on,join_cache_incremental=on';
set join_buffer_size=128;
set join_buffer_size=default;
set optimizer_switch=@tmp_optimizer_switch;
set join_buffer_size= default;
set @@optimizer_switch=@save_optimizer_switch;
set join_buffer_size=8192;
set join_cache_level=0;
set @init_time:=now();
set join_cache_level=2;
set @init_time:=now();
set join_buffer_size=default;
set join_cache_level = default;
set join_cache_level=default;
set expensive_subquery_limit=0;
set @counter=0;
set @counter=0;
set expensive_subquery_limit=default;
set join_buffer_space_limit=1024*8;
set join_buffer_space_limit=default;
SET join_cache_level = 3;
set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='optimize_join_buffer_size=on';
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set @@optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=6;
set @optimizer_switch_for_join_nested_test=@@optimizer_switch;
set @join_cache_level_for_join_nested_test=@@join_cache_level;
set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch_jcl6;
set @optimizer_switch_for_join_nested_test=NULL;
set @join_cache_level_for_join_nested_test=NULL;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_join_nested_test,'outer_join_with_cache=off');
SET optimizer_switch=@save_optimizer_switch;
set @tmp_mdev621= @@optimizer_search_depth;
SET SESSION optimizer_search_depth = 4;
set optimizer_search_depth= @tmp_mdev621;
set @domain='system';
set @pk=0;
set @mdev4270_opl= @@optimizer_prune_level;
set @mdev4270_osd= @@optimizer_search_depth;
set optimizer_prune_level=0;
set optimizer_search_depth=2;
set optimizer_prune_level=@mdev4270_opl;
set optimizer_search_depth=@mdev4270_osd;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='optimize_join_buffer_size=on';
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=6;
set @optimizer_switch_for_join_outer_test=@@optimizer_switch;
set @join_cache_level_for_join_outer_test=@@join_cache_level;
set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch_jcl6;
set @optimizer_switch_for_join_outer_test=NULL;
set @join_cache_level_for_join_outer_test=NULL;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_join_outer_test,'outer_join_with_cache=off');
set group_concat_max_len=5;
set group_concat_max_len=default;
SET optimizer_search_depth = 0;
SET optimizer_search_depth = DEFAULT;
SET SESSION join_cache_level=4;
SET SESSION join_cache_level=default;
SET optimizer_switch=@save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET @tmp_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='index_condition_pushdown=off';
SET optimizer_switch=@tmp_optimizer_switch;
SET optimizer_switch=@save_optimizer_switch;
SET @save_key_buffer_size=@@key_buffer_size;
SET @save_key_cache_block_size=@@key_cache_block_size;
SET @save_key_cache_segments=@@key_cache_segments;
SET @save_key_cache_file_hash_size=@@key_cache_file_hash_size;
SET @@global.key_buffer_size=16*1024*1024;
SET @@global.default.key_buffer_size=16*1024*1024;
SET @@global.default.key_buffer_size=16*1024*1024;
SET @@global.small.key_buffer_size=1*1024*1024;
SET @@global.medium.key_buffer_size=4*1024*1024;
SET @@global.medium.key_buffer_size=0;
SET @@global.medium.key_buffer_size=0;
SET @@global.key_buffer_size=@save_key_buffer_size;
set global keycache1.key_cache_block_size=2048;
set global keycache1.key_buffer_size=1*1024*1024;
set global keycache2.key_buffer_size=4*1024*1024;
set global keycache1.key_buffer_size=0;
set global keycache1.key_buffer_size=1024*1024;
set global keycache2.key_buffer_size=0;
set global keycache2.key_buffer_size=1024*1024;
set global keycache1.key_buffer_size=0;
set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0;
set @my_key_cache_block_size= @@global.key_cache_block_size;
set GLOBAL key_cache_block_size=2048;
set global key_cache_block_size= @my_key_cache_block_size;
SET @my_key_cache_block_size= @@global.key_cache_block_size;
SET GLOBAL key_cache_block_size=1536;
SET GLOBAL key_cache_block_size=1536;
set global key_cache_block_size= @my_key_cache_block_size;
set @@global.key_buffer_size=0;
SET @bug28478_key_cache_block_size= @@global.key_cache_block_size;
SET GLOBAL key_cache_block_size= 1536;
SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
SET GLOBAL key_cache_none.key_cache_block_size = 1024;
set global key_buffer_size=@save_key_buffer_size;
set global key_cache_block_size=@save_key_cache_block_size;
set global key_cache_segments=2;
set global key_cache_segments=1;
set global key_buffer_size=32*1024;
set global key_cache_file_hash_size=128;
set global key_cache_segments=2;
set global keycache1.key_buffer_size=256*1024;
set global keycache1.key_cache_segments=7;
set global keycache2.key_buffer_size=1024*1024;
set global keycache1.key_cache_block_size=2*1024;
set global keycache1.key_cache_block_size=8*1024;
set global keycache1.key_buffer_size=64*1024;
set global keycache1.key_cache_block_size=2*1024;
set global keycache1.key_cache_block_size=8*1024;
set global keycache1.key_buffer_size=0;
set global keycache1.key_cache_block_size=8*1024;
set global keycache1.key_buffer_size=0;
set global keycache1.key_buffer_size=128*1024;
set global keycache1.key_cache_block_size=1024;
set global keycache1.key_buffer_size=0;
set global keycache2.key_buffer_size=0;
set global key_buffer_size=@save_key_buffer_size;
set global key_cache_segments=@save_key_cache_segments;
set global key_cache_file_hash_size=@save_key_cache_file_hash_size;
SET SQL_WARNINGS=1;
set option=1;
SET DEBUG_SYNC='before_execute_sql_command SIGNAL ready WAIT_FOR go';
SET DEBUG_SYNC='now WAIT_FOR ready';
SET DEBUG_SYNC='now SIGNAL go';
SET DEBUG_SYNC='reset';
set local sql_mode="";
set global sql_mode="";
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read';
SET DEBUG_SYNC='now WAIT_FOR con1_read';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC = 'RESET';
SET SESSION optimizer_search_depth=0;
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'RESET';
set global sql_mode=default;
set @save_join_cache_level = @@join_cache_level;
set @@join_cache_level=0;
set @@join_cache_level=1;
set @@join_cache_level=6;
set @@join_cache_level=0;
set @@join_cache_level = @save_join_cache_level;
set @@join_cache_level=0;
set @l = 2;
set @@join_cache_level = @save_join_cache_level;
set @@optimizer_switch='semijoin=off,in_to_exists=on,materialization=off';
set @@optimizer_switch='subquery_cache=off';
set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,subquery_cache=on';
set @@optimizer_switch='default';
SET @@optimizer_switch='in_to_exists=on,outer_join_with_cache=on';
set @@optimizer_switch='default';
set @a='qwe';
set @a=-1;
set @a=14632475938453979136;
set @a=-14632475938453979136;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
SET @@SQL_MODE=@OLD_SQL_MODE;
set @c:=123;
set @@secure_file_priv= 0;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
SET @@SQL_MODE=@OLD_SQL_MODE;
SET SESSION character_set_client=latin1;
SET SESSION character_set_server=latin1;
SET SESSION character_set_connection=latin1;
SET @OLD_SQL_MODE=@@SESSION.SQL_MODE;
SET sql_mode = '';
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SET sql_mode='';
SET sql_mode = '';
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SET sql_mode = '';
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
SET sql_mode = '';
SET sql_mode = 'NO_BACKSLASH_ESCAPES';
set session sql_mode=@OLD_SQL_MODE;
SET NAMES latin1;
SET character_set_filesystem=filename;
SET character_set_filesystem=latin1;
SET character_set_filesystem=default;
SET @old_mode= @@sql_mode;
SET sql_mode='strict_all_tables';
SET @@sql_mode= @old_mode;
SET NAMES utf8;
SET @@lc_time_names=109;
SET lc_messages=sr_YU;
SET lc_messages=sr_RS;
SET lc_time_names=sr_RS;
SET NAMES utf8;
SET lc_time_names=ro_RO;
SET NAMES utf8;
SET @old_50915_lc_time_names := @@lc_time_names;
SET lc_time_names=en_US;
SET lc_time_names=rm_CH;
SET lc_time_names=de_CH;
SET lc_messages=rm_CH;
SET lc_time_names=@old_50915_lc_time_names;
SET @odl_sync_frm = @@global.sync_frm;
SET @@global.sync_frm = OFF;
SET @@global.sync_frm = @odl_sync_frm;
SET @odl_sync_frm = @@global.sync_frm;
SET @@global.sync_frm = OFF;
SET @@global.sync_frm = @odl_sync_frm;
set sql_mode="";
set sql_mode=default;
SET SESSION lock_wait_timeout= 1;
set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 2;
set @@global.concurrent_insert= @old_concurrent_insert;
set debug_sync= 'RESET';
set @old_general_log = @@global.general_log;
set @@global.general_log= OFF;
set debug_sync='thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go';
set debug_sync= 'now WAIT_FOR parked';
set debug_sync= 'now SIGNAL go';
set debug_sync= 'RESET';
set @@global.general_log= @old_general_log;
SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
SET DEBUG_SYNC="now WAIT_FOR drop";
SET DEBUG_SYNC="now SIGNAL query";
SET DEBUG_SYNC="RESET";
SET SESSION lock_wait_timeout= 1;
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL opti_recreate WAIT_FOR opti_analyze';
SET DEBUG_SYNC= 'now WAIT_FOR opti_recreate';
SET DEBUG_SYNC= 'after_lock_tables_takes_lock SIGNAL thrlock WAIT_FOR release_thrlock';
SET DEBUG_SYNC= 'now WAIT_FOR thrlock';
SET DEBUG_SYNC= 'now SIGNAL opti_analyze';
SET DEBUG_SYNC= 'now SIGNAL release_thrlock';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL dropped';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL dropped';
SET DEBUG_SYNC= 'RESET';
set autocommit= 0;
set @org_slow_query_log= @@global.slow_query_log;
set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
set @@log_slow_filter="admin,admin";
set @@log_slow_filter=7;
set @@log_slow_filter= "filesort,impossible,impossible2,admin";
set @@log_slow_filter= "filesort, admin";
set @@log_slow_filter= 1<<31;
set @@log_slow_verbosity= "query_plan,innodb";
set @@log_slow_verbosity=1;
set long_query_time=0.1;
set log_slow_filter='';
set global slow_query_log=1;
set global log_output='TABLE';
set @@long_query_time=default;
set global slow_query_log= @org_slow_query_log;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
set global log_output= default;
SET @old_general_log= @@global.general_log;
SET @old_general_log_file= @@global.general_log_file;
SET @old_slow_query_log= @@global.slow_query_log;
SET @old_slow_query_log_file= @@global.slow_query_log_file;
set global general_log= OFF;
set global general_log= ON;
set global general_log= OFF;
set global general_log= ON;
set @long_query_time = 2;
set session long_query_time = @long_query_time;
set global slow_query_log= ON;
set local slow_query_log= ON;
set session long_query_time = @long_query_time;
set local slow_query_log= ON;
set global general_log= ON;
set global general_log= OFF;
set global general_log= OFF;
set global slow_query_log= ON;
set global slow_query_log= OFF;
set global slow_query_log= OFF;
set local slow_query_log= ON;
set global general_log= ON;
set global general_log= OFF;
set global general_log= ON;
set global general_log_file='/not existing path/log.master';
set global general_log_file='';
set global general_log= OFF;
set global general_log= ON;
set global general_log= OFF;
set global general_log_file=default;
set global general_log= ON;
set global general_log= default;
set global slow_query_log= default;
set global general_log_file= default;
set global slow_query_log_file= default;
set global general_log=ON;
set global log_output=default;
set global general_log=OFF;
set global log_output=FILE;
set global general_log=ON;
set global general_log=OFF;
set global log_output="FILE,TABLE";
set global general_log=ON;
SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log;
SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r');
SET GLOBAL general_log_file= NULL;
SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r');
SET GLOBAL slow_query_log_file= NULL;
SET GLOBAL general_log_file= @old_general_log_file;
SET GLOBAL slow_query_log_file= @old_slow_query_log_file;
SET GLOBAL general_log_file = 'bug32748.query.log';
SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
SET GLOBAL general_log_file = @old_general_log_file;
SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
SET @old_log_output = @@global.log_output;
SET GLOBAL log_output = "TABLE";
SET GLOBAL slow_query_log = ON;
SET GLOBAL long_query_time = 0.001;
SET GLOBAL general_log_file = DEFAULT;
SET GLOBAL general_log_file = 'BUG38124.LOG';
SET GLOBAL general_log_file = concat('BUG38124-2.LOG');
SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6);
SET GLOBAL general_log_file = DEFAULT;
SET GLOBAL general_log_file = @old_general_log_file;
SET GLOBAL long_query_time = DEFAULT;
SET GLOBAL log_output = @old_log_output;
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
SET global slow_query_log_file = @old_slow_query_log_file;
set session long_query_time=10;
set session long_query_time=1;
SET @old_general_log= @@global.general_log;
SET @old_general_log_file= @@global.general_log_file;
SET @old_slow_query_log= @@global.slow_query_log;
SET @old_slow_query_log_file= @@global.slow_query_log_file;
SET @@global.general_log = ON;
SET @@global.general_log_file = 'bug45387_general.log';
SET SESSION debug_dbug='+d,reset_log_last_time';
SET @@global.general_log = @old_general_log;
SET @@global.general_log_file = @old_general_log_file;
SET SESSION debug_dbug='-d';
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
SET global slow_query_log_file = @old_slow_query_log_file;
SET SQL_MODE="";
SET @old_general_log_state = @@global.general_log;
SET @old_log_output=       @@global.log_output;
SET @old_slow_query_log=   @@global.slow_query_log;
SET @old_general_log=      @@global.general_log;
SET @old_long_query_time=  @@session.long_query_time;
SET @saved_long_query_time = @@long_query_time;
SET @saved_log_output = @@log_output;
SET @saved_general_log = @@GLOBAL.general_log;
SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
SET GLOBAL GENERAL_LOG=ON;
SET GLOBAL SLOW_QUERY_LOG=ON;
SET GLOBAL GENERAL_LOG=OFF;
SET GLOBAL SLOW_QUERY_LOG=OFF;
SET GLOBAL GENERAL_LOG=ON;
SET GLOBAL SLOW_QUERY_LOG=ON;
set names binary;
set names utf8;
set names utf8;
set session long_query_time=1;
set @@session.long_query_time = @saved_long_query_time;
set global general_log='OFF';
set global slow_query_log='OFF';
set global general_log='ON';
set global slow_query_log='ON';
set global general_log='OFF';
set global slow_query_log='OFF';
set @save_storage_engine= @@session.storage_engine;
set storage_engine= MEMORY;
set storage_engine= @save_storage_engine;
set global general_log='ON';
set global slow_query_log='ON';
SET SESSION long_query_time = 1000;
set global general_log='OFF';
set global slow_query_log='OFF';
set global general_log='ON';
set global slow_query_log='ON';
SET SESSION long_query_time = @saved_long_query_time;
set global general_log='ON';
set global slow_query_log='ON';
SET GLOBAL LOG_OUTPUT = 'TABLE';
SET GLOBAL general_log = 0;
SET GLOBAL general_log = 1;
SET GLOBAL general_log = 0;
SET GLOBAL slow_query_log = 0;
SET SESSION long_query_time = 1;
SET GLOBAL slow_query_log = 1;
SET GLOBAL slow_query_log = 0;
SET SESSION long_query_time =@saved_long_query_time;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log;
set @iterations=100;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log;
set global general_log = on;
set @lparam = "000 001 002 003 004 005 006 007 008 009";
set global general_log = off;
set global general_log = @old_general_log;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
SET GLOBAL general_log = @saved_general_log;
SET GLOBAL slow_query_log = @saved_slow_query_log;
SET SESSION long_query_time = 0;
SET GLOBAL slow_query_log = ON;
SET @@session.long_query_time= @old_long_query_time;
SET @@global.log_output=       @old_log_output;
SET @@global.slow_query_log=   @old_slow_query_log;
SET @@global.general_log=      @old_general_log;
SET @saved_general_log = @@GLOBAL.general_log;
SET GLOBAL general_log = OFF;
SET GLOBAL general_log = @saved_general_log;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
set GLOBAL sql_mode=default;
set @old_table_open_cache=@@table_open_cache;
set global table_open_cache = 512;
set global table_open_cache = @old_table_open_cache;
set sql_mode="";
set GLOBAL query_cache_size=1355776;
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=default;
set GLOBAL query_cache_type=default;
set names utf8;
set names latin1;
set names utf8;
SET @@MAX_STATEMENT_TIME=2;
SET @@MAX_STATEMENT_TIME=0;
SET @@MAX_STATEMENT_TIME=2;
SET @@MAX_STATEMENT_TIME=0.1;
SET @@MAX_STATEMENT_TIME=0;
SET @@MAX_STATEMENT_TIME=0;
set @global.userstat=1;
set @global.userstat=0;
SET @@max_statement_time=0;
SET @@max_statement_time=0.5;
SET @@max_statement_time=0;
SET @@SESSION.max_statement_time = 0.5;
SET @@SESSION.max_statement_time= 0.5;
set max_statement_time = 0.001;
set max_statement_time = 0;
set max_statement_time = 0.001;
set max_statement_time = 0;
set names swe7;
SET GLOBAL log_warnings=4;
SET GLOBAL max_connections=2;
SET GLOBAL log_warnings=default;
SET GLOBAL max_connections=default;
SET GLOBAL net_write_timeout = 900;
SET GLOBAL use_stat_tables = PREFERABLY;  
SET GLOBAL use_stat_tables = DEFAULT;
SET GLOBAL net_write_timeout = DEFAULT;
SET DEBUG_SYNC= 'RESET';
set debug_sync='mdl_upgrade_lock SIGNAL parked WAIT_FOR go';
set debug_sync= 'now WAIT_FOR parked';
set debug_sync='mdl_acquire_lock_wait SIGNAL go';
SET DEBUG_SYNC= 'RESET';
set debug_sync= 'RESET';
set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync= 'RESET';
set debug_sync= 'RESET';
set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
set debug_sync= 'now WAIT_FOR locked';
set debug_sync= 'now SIGNAL finish';
set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL parked1 WAIT_FOR go1';
set debug_sync='now WAIT_FOR parked1';
set debug_sync='mdl_acquire_lock_wait SIGNAL parked2 WAIT_FOR go2';
set debug_sync='now WAIT_FOR parked2';
set debug_sync='now SIGNAL go1';
set debug_sync='now SIGNAL go2';
set debug_sync= 'RESET';
set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= 'RESET';
set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= 'RESET';
set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= 'RESET';
set debug_sync= 'RESET';
set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
set debug_sync='now WAIT_FOR parked';
set debug_sync='now SIGNAL go';
set debug_sync= 'RESET';
set @save_log_output=@@global.log_output;
set global log_output=file;
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish';
SET DEBUG_SYNC= 'RESET';
set global log_output=@save_log_output;
set debug_sync= 'RESET';
set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL alter_table_locked WAIT_FOR alter_go';
set debug_sync='now WAIT_FOR alter_table_locked';
set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go';
set debug_sync= 'RESET';
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait';
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait';
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
SET DEBUG_SYNC= 'RESET';
SET @old_general_log= @@global.general_log;
SET @@global.general_log= 1;
SET @old_log_output= @@global.log_output;
SET @@global.log_output= 'TABLE';
SET @old_sql_log_off= @@session.sql_log_off;
SET @@session.sql_log_off= 1;
SET @@session.sql_log_off= 1;
SET DEBUG_SYNC= 'thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go';
SET DEBUG_SYNC= 'now WAIT_FOR parked';
SET DEBUG_SYNC= 'now SIGNAL go';
SET DEBUG_SYNC= 'RESET';
SET @@global.general_log= @old_general_log;
SET @@global.log_output= @old_log_output;
SET @@session.sql_log_off= @old_sql_log_off;
set debug_sync= 'RESET';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go';
set debug_sync= 'now WAIT_FOR parked';
set debug_sync= 'now SIGNAL go';
set debug_sync= 'RESET';
set debug_sync= 'RESET';
set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go';
set debug_sync= 'now WAIT_FOR parked';
set debug_sync= 'now SIGNAL go';
set debug_sync= 'RESET';
SET debug_sync='upgrade_lock_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate';
SET debug_sync='now WAIT_FOR parked_truncate';
SET debug_sync='after_open_table_ignore_flush SIGNAL parked_show WAIT_FOR go_show';
SET debug_sync='now WAIT_FOR parked_show';
SET debug_sync='after_flush_unlock SIGNAL parked_flush WAIT_FOR go_flush';
SET debug_sync='now WAIT_FOR parked_flush';
SET debug_sync='now SIGNAL go_truncate';
SET debug_sync= 'now SIGNAL go_show';
SET debug_sync= 'now SIGNAL go_flush';
SET debug_sync= 'RESET';
SET DEBUG_SYNC= "get_schema_column SIGNAL waiting WAIT_FOR completed";
SET DEBUG_SYNC= "now WAIT_FOR waiting";
SET DEBUG_SYNC= "now SIGNAL completed";
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL blocked';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'mdl_upgrade_lock SIGNAL upgrade WAIT_FOR continue EXECUTE 2';
SET DEBUG_SYNC= 'now WAIT_FOR upgrade';
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'now WAIT_FOR upgrade';
SET DEBUG_SYNC= 'now SIGNAL continue';
SET DEBUG_SYNC= 'RESET';
set @default_storage_engine= @@global.storage_engine;
set global storage_engine=myisam;
set session storage_engine=myisam;
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @orig_debug=@@debug;
SET GLOBAL debug_dbug="+d,myisam_pretend_crashed_table_on_open";
SET GLOBAL debug_dbug=@orig_debug;
set global storage_engine=@default_storage_engine;
SET GLOBAL storage_engine = MyISAM;
SET SESSION storage_engine = MyISAM;
set global storage_engine=myisam;
set session storage_engine=myisam;
SET @a=0;
SET @a=0;
SET @a=0;
SET @a=0;
SET @rnd_max= 2147483647;
set @@read_buffer_size=2*1024*1024;
set @save_table_open_cache=@@global.table_open_cache;
set @@global.table_open_cache=400;
set @a=null;
set @a=concat("create table t_parent (a int) union(", @a,
              ") insert_method=first engine=mrg_myisam");
set @@global.table_open_cache=@save_table_open_cache;
set @arg00=1 ;
set @mrr_icp_extra_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET NAMES latin1;
set autocommit=0;
set autocommit=1;
set @mrr_icp_extra_tmp=@@optimizer_switch;
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @aux = @@session.debug;
set @d=4;
set sql_safe_updates=1;
set sql_safe_updates=0;
set timestamp=1038401397;
set timestamp=1038000000;
set timestamp=0;
set sql_safe_updates=0;
set @sav_binlog_format=  @@session.binlog_format;
set @@session.binlog_format= mixed;
set @@session.binlog_format= @sav_binlog_format;
SET SESSION sql_safe_updates = 1;
SET SESSION sql_safe_updates = 0;
SET t3.a = 0;
SET SESSION sql_safe_updates = DEFAULT;
SET GLOBAL delay_key_write=ALL;
SET SESSION debug_dbug="d,crash_before_flush_keys";
SET SESSION debug_dbug='+d,wait_in_enable_indexes';
set @save_storage_engine= @@session.default_storage_engine;
set session default_storage_engine = MyISAM;
set default_storage_engine= @save_storage_engine;
set optimizer_switch=default;
set @myisam_icp_notembedded_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set optimizer_switch=@myisam_icp_notembedded_tmp;
set @myisam_icp_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET SESSION optimizer_switch='index_condition_pushdown=off';
SET SESSION optimizer_switch='index_condition_pushdown=on';
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set @tmp_10000051= @@optimizer_switch;
set optimizer_switch='mrr=off';
set optimizer_switch= @tmp_10000051;
set optimizer_switch=@myisam_icp_tmp;
set @myisam_mrr_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set @mrr_buffer_size_save= @@mrr_buffer_size;
set mrr_buffer_size=79;
set @@mrr_buffer_size= @mrr_buffer_size_save;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_condition_pushdown=off';
set optimizer_switch='index_condition_pushdown=on';
set optimizer_switch=@save_optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
set @@join_cache_level=6;
set @@join_cache_level=@save_join_cache_level;
set @save_join_cache_level = @@join_cache_level;
set join_cache_level = 6;
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size = 136;
set join_cache_level= @save_join_cache_level;
set join_buffer_size= @save_join_buffer_size;
set @tmp_730133_jcl= @@join_cache_level;
set join_cache_level = 7;
set @tmp_730133_os= @@optimizer_switch;
set optimizer_switch= 'join_cache_hashed=off,join_cache_bka=on,index_condition_pushdown=on,optimize_join_buffer_size=on';
set @@join_cache_level= @tmp_730133_jcl;
set @@optimizer_switch= @tmp_730133_os;
set @mrr_buffer_size_save= @@mrr_buffer_size;
set mrr_buffer_size=128;
set @@mrr_buffer_size= @mrr_buffer_size_save;
set @join_cache_level_save= @@join_cache_level;
set @join_buffer_size_save= @@join_buffer_size;
set join_cache_level=6;
set join_buffer_size=10;
set join_cache_level= @join_cache_level_save;
set join_buffer_size= @join_buffer_size_save;
set optimizer_switch= @myisam_mrr_tmp;
set debug_sync='myisam_before_repair_by_sort wait_for go';
set debug_sync='now signal go';
set debug_sync='reset';
set global table_open_cache=256;
set global table_definition_cache=400;
set @@global.table_definition_cache=default;
set @@global.table_open_cache=default;
set autocommit = 0;
SET autocommit = 1;
SET SQL_WARNINGS=1;
SET SQL_WARNINGS=0;
SET SQL_WARNINGS=1;
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
set myisam_stats_method=nulls_equal;
set myisam_stats_method=DEFAULT;
set myisam_stats_method=nulls_ignored;
set myisam_stats_method=DEFAULT;
SET @@myisam_repair_threads=2;
SET @@myisam_repair_threads=1;
set storage_engine=MyISAM;
set @save_concurrent_insert=@@concurrent_insert;
set global concurrent_insert=1;
set global concurrent_insert=2;
set global concurrent_insert=2;
set global concurrent_insert=@save_concurrent_insert;
SET @@myisam_repair_threads=2;
SET @@myisam_repair_threads=1;
SET GLOBAL table_open_cache=3;
SET GLOBAL table_open_cache=DEFAULT;
SET myisam_sort_buffer_size=4;
SET myisam_repair_threads=2;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET myisam_sort_buffer_size=4;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET myisam_repair_threads=2;
SET myisam_sort_buffer_size=4096;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET GLOBAL myisam_use_mmap=1;
SET GLOBAL myisam_use_mmap=default;
SET @before:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
SET @after:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
SET TIMESTAMP=1000000000;
SET timestamp=1000000000;
SET @@global.max_allowed_packet= 1024*1024*1024;
set timestamp=1000000000;
set names latin1;
set lc_time_names=de_DE;
set lc_time_names=en_US;
set character_set_database=koi8r;
set character_set_database=latin1;
set character_set_database=koi8r;
set character_set_database=latin1;
SET BINLOG_FORMAT=ROW;
SET BINLOG_FORMAT = STATEMENT;
SET @a_real = rand(20) * 1000;
SET @an_int = 1000;
SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
SET @a_string = 'Just a test';
SET GLOBAL SERVER_ID = 2;
SET @old_max_allowed_packet= @@global.max_allowed_packet;
SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
SET @old_general_log = @@global.general_log;
SET @@global.general_log = 0;
SET @@global.general_log = @old_general_log;
SET @@global.max_allowed_packet = @old_max_allowed_packet;
SET @old_max_allowed_packet= @@global.max_allowed_packet;
SET @@global.max_allowed_packet = 1024 * 1024 + 1024;
SET @@global.max_allowed_packet = @old_max_allowed_packet;
SET NAMES utf8;
SET NAMES DEFAULT;
SET NAMES utf8;
SET NAMES DEFAULT;
SET NAMES utf8;
SET NAMES DEFAULT;
SET @old_slow_query_log= @@global.slow_query_log;
SET @@global.slow_query_log= @old_slow_query_log;
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
SET @@global.general_log= @old_general_log;
SET @@global.slow_query_log= @old_slow_query_log;
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
SET @@global.general_log= @old_general_log;
SET @@global.slow_query_log= @old_slow_query_log;
set global sql_mode="";
set global sql_mode=default;
SET GLOBAL storage_engine=InnoDB;
SET GLOBAL storage_engine=@old_engine;
SET binlog_format= mixed;
SET @c= 0;
SET binlog_format="row";
SET @d= 10;
SET @old_concurrent_insert = @@global.concurrent_insert;
SET @@global.concurrent_insert = 0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
SET SQL_MODE=@OLD_SQL_MODE;
SET @@global.concurrent_insert = @old_concurrent_insert;
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
SET SQL_MODE=@OLD_SQL_MODE;
set global sql_mode='ANSI_QUOTES';
set global sql_mode=default;
set sql_mode="traditional";
set sql_mode=default;
set sql_mode='ansi';
set sql_mode='';
set time_zone='+00:00';
set time_zone='Europe/Moscow';
set global time_zone='Europe/Moscow';
set global time_zone=default;
set time_zone=default;
SET @old_sql_mode = @@SQL_MODE;
SET SQL_MODE = IGNORE_SPACE;
SET SQL_MODE = @old_sql_mode;
SET @TMP_SQL_MODE = @@SQL_MODE;
SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
SET SQL_MODE = @TMP_SQL_MODE;
SET NAMES utf8;
SET NAMES latin1;
set time_zone = 'UTC';
set time_zone = 'SYSTEM';
set names koi8r;
set names latin1;
set names utf8;
set names latin1;
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
SET NAMES utf8;
SET NAMES default;
SET NAMES utf8;
SET @old_log_output_state=       @@global.log_output;
SET @old_general_log_state=      @@global.general_log;
SET @old_slow_query_log_state=   @@global.slow_query_log;
SET @@global.log_output="TABLE";
SET @@global.general_log='OFF';
SET @@global.slow_query_log='OFF';
SET @@global.log_output=       @old_log_output_state;
SET @@global.slow_query_log=   @old_slow_query_log_state;
SET @@global.general_log=      @old_general_log_state;
SET @file=REPLACE(LOAD_FILE('../../tmp/locale_a.output'), '-', '');
SET NAMES utf8;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET NAMES utf8;
set GLOBAL sql_mode=default;
SET GLOBAL max_connections = 1000;
set @my_var= 'abc' ;
set global event_scheduler=OFF;
set sql_mode="";
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
set sql_mode=default;
SET GLOBAL enforce_storage_engine=InnoDB;
SET GLOBAL enforce_storage_engine=NULL;
set sql_log_bin=0;
set sql_log_bin=1;
set sql_log_bin=0;
SET @org_mode=@@sql_mode;
SET @@sql_mode='';
SET @@sql_mode='NO_BACKSLASH_ESCAPES';
SET @@sql_mode= @org_mode;
set GLOBAL thread_handling='one-thread';
set names latin2;
set names latin1;
SET @a=0;
SET @a=0;
set @@session.sql_auto_is_null=1;
set @@session.sql_auto_is_null=default;
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
set div_precision_increment= @sav_dpi;
set @@old_mode=zero_date_time_cast;
SET @@global.mysql56_temporal_format=true;
SET @@old_mode=zero_date_time_cast;
SET @@global.mysql56_temporal_format=false;
SET @@old_mode=zero_date_time_cast;
SET @@global.mysql56_temporal_format=DEFAULT;
set local sql_mode="";
set global sql_mode="";
SET GLOBAL event_scheduler=1;
SET GLOBAL event_scheduler=0;
set global sql_mode=default;
set @a=-1;
set sort_buffer_size= 32768;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET @id=0;
set @row=10;
set max_sort_length=20;
set session sort_buffer_size= 1000;
set session max_sort_length= 2180;
set session sort_buffer_size= 30000;
set sort_buffer_size= 32768;
set sort_buffer_size= 32768;
set sort_buffer_size= 327680;
set @save_sort_buffer_size= @@sort_buffer_size;
set sort_buffer_size= 2000;
set sort_buffer_size= @save_sort_buffer_size;
set sort_buffer_size=default;
set max_sort_length=default;
set @@sort_buffer_size=32804;
SET NAMES utf8;
SET NAMES default;
set @max_allowed_packet=@@global.max_allowed_packet;
set @net_buffer_length=@@global.net_buffer_length;
set global max_allowed_packet=100;
set global net_buffer_length=100;
set global max_allowed_packet=default;
set global net_buffer_length=default;
set global max_allowed_packet=@max_allowed_packet;
set global net_buffer_length=@net_buffer_length;
set sql_mode=NO_UNSIGNED_SUBTRACTION;
SET @save_sql_mode=@@sql_mode;
set SQL_MODE='';
set SQL_MODE='IGNORE_SPACE';
SET SQL_MODE = 'ANSI_QUOTES';
SET @@sql_mode=@save_sql_mode;
set @bar="bar";
set @foobar="foobar";
SET default_storage_engine=a.myisam;
SET default_storage_engine = .a.MyISAM;
SET default_storage_engine = a.b.MyISAM;
SET default_storage_engine = `a`.MyISAM;
SET default_storage_engine = `a`.`MyISAM`;
set default_storage_engine = "a.MYISAM";
set default_storage_engine = 'a.MYISAM';
set default_storage_engine = `a.MYISAM`;
SET default_storage_engine = NEW.INNODB;
set names utf8;
set names latin1;
set @@sql_mode=allow_invalid_dates;
set @@sql_mode='';
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
SET GLOBAL general_log = @old_general_log_state;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
SET GLOBAL log_output='table';
SET GLOBAL general_log =1;
SET GLOBAL general_log =0;
SET GLOBAL log_output = @old_glo;
SET GLOBAL general_log = 1;
SET GLOBAL general_log = @old_general_log_state;
SET @old_time_zone= @@session.time_zone;
SET @@session.time_zone = 'UTC';
SET @@session.time_zone = 'Europe/Moscow';
SET @@session.time_zone = 'UTC';
SET @@session.time_zone = 'Europe/Moscow';
SET @@session.time_zone= @old_time_zone;
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_upgrade';
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR waiting_for_upgrade';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC="wait_for_lock SIGNAL locking";
SET DEBUG_SYNC="now WAIT_FOR locking";
SET DEBUG_SYNC = 'RESET';
SET @old_default_week_format := @@default_week_format;
SET default_week_format = 0;
SET default_week_format = 1;
SET default_week_format = 2;
SET default_week_format = 3;
SET default_week_format = 4;
SET default_week_format = 5;
SET default_week_format = 6;
SET default_week_format = 7;
SET default_week_format = @old_default_week_format;
SET @org_mode=@@sql_mode;
SET @@sql_mode='NO_DIR_IN_CREATE';
SET @@sql_mode= @org_mode;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
SET @@global.general_log = @old_general_log_state;
SET @old_default_storage_engine = @@default_storage_engine;
SET @@default_storage_engine = 'InnoDB';
# MXS Embedded parser is not aware of innodb.
# MXS SET SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata;
SET @@global.innodb_stats_on_metadata=ON;
SET @@global.innodb_stats_on_metadata=@save_innodb_stats_on_metadata;
SET @@default_storage_engine = @old_default_storage_engine;
set sql_mode="";
set sql_mode=default;
# MXS Embedded parser is not aware of innodb.
# MXS SET SET @old_innodb_file_format = @@global.innodb_file_format;
# MXS Embedded parser is not aware of innodb.
# MXS SET SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
# MXS Embedded parser is not aware of innodb.
# MXS SET SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
SET @@global.innodb_file_format = Barracuda,
@@global.innodb_file_per_table = ON,
@@global.innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table = OFF;
SET innodb_strict_mode = OFF;
SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
SET @@global.innodb_file_format = @old_innodb_file_format;
SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
SET NAMES utf8;
SET NAMES utf8;
set @old_sql_mode = @@sql_mode;
set sql_mode = 'ANSI_QUOTES';
set @@sql_mode = @old_sql_mode;
set @old_sql_mode = @@sql_mode;
set sql_mode = 'ANSI_QUOTES';
set @@sql_mode = @old_sql_mode;
SET NAMES DEFAULT;
set binlog_format=mixed;
set session transaction isolation level repeatable read;
set autocommit=0;
set binlog_format=mixed;
set session transaction isolation level repeatable read;
set autocommit=0;
set session transaction isolation level read committed;
SET SESSION AUTOCOMMIT = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
set binlog_format=mixed;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
set global default_storage_engine='innodb';
set session default_storage_engine='innodb';
# MXS Embedded parser is not aware of innodb.
# MXS SET SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency;
# MXS Embedded parser is not aware of innodb.
# MXS SET SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay;
SET GLOBAL innodb_thread_concurrency = 1;
SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay;
SET AUTOCOMMIT=0;
SET lock_wait_timeout = 1;
SET @old_tx_isolation := @@session.tx_isolation;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET autocommit = 0;
SET @@session.tx_isolation = @old_tx_isolation;
SET SQL_MODE="";
SET SQL_MODE=default;
SET @old_mode = @@sql_mode;
SET SESSION sql_mode = 'NO_ZERO_DATE';
SET SESSION sql_mode = @old_mode;
set global default_storage_engine=default;
SET @@global.default.key_buffer_size = 4096;
SET @a:=1167602400;
SET GLOBAL key_buffer_size = 1024*1024;
SET GLOBAL hot_cache.key_buffer_size = 1024*1024;
SET GLOBAL warm_cache.key_buffer_size = 1024*1024;
SET @@global.cold_cache.key_buffer_size = 1024*1024;
SET @a:=1167602400;
SET GLOBAL key_cache_none.key_cache_block_size = 1024;
SET GLOBAL hot_cache.key_buffer_size = 0;
SET GLOBAL warm_cache.key_buffer_size = 0;
SET @@global.cold_cache.key_buffer_size = 0;
SET @@global.default.key_buffer_size = @org_key_cache_buffer_size;
SET INSERT_ID= 13;
SET INSERT_ID= 12;
SET INSERT_ID= 13;
SET INSERT_ID= 12;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
set @@sql_mode=@org_mode;
set @org_mode=@@sql_mode;
set @@sql_mode='NO_DIR_IN_CREATE';
set @@sql_mode=@org_mode;
SET AUTOCOMMIT = 0;
set session debug_dbug="+d,abort_copy_table";
SET sql_mode=no_engine_substitution;
SET sql_mode='';
SET sql_mode=DEFAULT;
set session default_storage_engine= 'memory';
set session default_storage_engine='myisam';
set session sql_mode='no_table_options';
set session sql_mode='';
set @f_date='2006-09-28';
set @t_date='2006-10-02';
SET @orig_sql_mode = @@SQL_MODE;
SET SQL_MODE='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';
SET SQL_MODE= @orig_sql_mode;
SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
SET SESSION SQL_MODE=DEFAULT;
SET GLOBAL myisam_use_mmap=1;
SET GLOBAL myisam_use_mmap=default;
set names utf8;
set sql_mode="";
SET NAMES utf8;
SET NAMES ascii;
SET NAMES latin1;
SET NAMES utf8;
SET @auth_name= 'test_plugin_server';
SET @auth_string= 'plug_dest';
set @save_sql_mode= @@sql_mode;
SET @@sql_mode=no_auto_create_user;
set @@sql_mode= @save_sql_mode;
SET GLOBAL SQL_MODE="";
SET LOCAL SQL_MODE="";
SET PASSWORD = PASSWORD('plug_dest');
SET @@sql_mode=no_auto_create_user;
SET @@sql_mode="";
SET GLOBAL proxy_user = 'test';
SET LOCAL proxy_user = 'test';
SET GLOBAL external_user = 'test';
SET LOCAL external_user = 'test';
SET PASSWORD FOR bug12610784@localhost = PASSWORD('secret');
SET PASSWORD = PASSWORD('bruhaha');
SET GLOBAL SQL_MODE=default;
set global example_ulong_var=500;
set global example_enum_var= e1;
set session example_int_var= -1;
SET GLOBAL example_enum_var= e1;
SET GLOBAL example_enum_var= e2;
SET GLOBAL example_enum_var= impossible;
set session sql_mode='';
set global example_ulong_var=500;
set global example_ulong_var=1111;
set session sql_mode='STRICT_ALL_TABLES';
set global example_ulong_var=500;
set global example_ulong_var=1111;
set session sql_mode=@old_sql_mode;
set session old=bla;
SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
SET SQL_MODE='';
SET example_varopt_default=33; # does not affect varopt of t1
SET @@SQL_MODE=@OLD_SQL_MODE;
SET GLOBAL example_double_var = -0.1;
SET GLOBAL example_double_var = 0.000001;
SET GLOBAL example_double_var = 0.4;
SET GLOBAL example_double_var = 123.456789;
SET GLOBAL example_double_var = 500;
SET GLOBAL example_double_var = 999.999999;
SET GLOBAL example_double_var = 1000.51;
SET SESSION example_double_thdvar = -0.1;
SET SESSION example_double_thdvar = 0.000001;
SET SESSION example_double_thdvar = 0.4;
SET SESSION example_double_thdvar = 123.456789;
SET SESSION example_double_thdvar = 500;
SET SESSION example_double_thdvar = 999.999999;
SET SESSION example_double_thdvar = 1000.51;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set session preload_buffer_size=256*1024;
set session preload_buffer_size=1*1024;
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
set debug_sync='reset';
SET debug_dbug="+d,sleep_inject_query_done_debug_sync";
SET DEBUG_SYNC = 'now WAIT_FOR query_done';
set debug_sync='reset';
SET NAMES utf8;
set @start_value= @@global.profiling_history_size;
set global profiling_history_size=100;
set session profiling = ON;
set session profiling_history_size=30;  # small enough to overflow
set session profiling = OFF;
set session profiling = ON;
set session profiling = OFF;
set session profiling = OFF;
set session profiling = OFF;
set session profiling = ON;
set session profiling = ON;
set autocommit=0;
set session profiling = OFF;
set global profiling_history_size= @start_value;
set @arg_nam= 'Jerry'; set @arg_sal= 1000; set @arg_l= 1; set @arg_r= 12;
set @arg_nam= 'Bert';  set @arg_sal=  900; set @arg_l= 2; set @arg_r=  3;
set @arg_nam= 'Chuck'; set @arg_sal=  900; set @arg_l= 4; set @arg_r= 11;
set @arg_nam= 'Donna'; set @arg_sal=  800; set @arg_l= 5; set @arg_r=  6;
set @arg_nam= 'Eddie'; set @arg_sal=  700; set @arg_l= 7; set @arg_r=  8;
set @arg_nam= 'Fred';  set @arg_sal=  600; set @arg_l= 9; set @arg_r= 10;
set @arg_percent= .10;
set @arg_amount= 100;
set @arg_round= 50;
set @arg1= 'abc';
set @arg1= '1111';
set @arg1= 'abc';
set @arg01= 'row_1'; set @arg02= 1; set @arg03= 1.1; set @arg04= 111; set @arg05= 'row_one';
set @arg06= '2004-10-12'; set @arg07= '1'; set @arg08= 1.1; set @arg09= '100100100'; set @arg10= '12:34:56';
set @arg11= 'row_1'; set @arg12= 1; set @arg13= 1.1; set @arg14= 111; set @arg15= 'row_one';
set @arg16= '2004-10-12'; set @arg17= '1'; set @arg18= 1.1; set @arg19= '100100100'; set @arg20= '12:34:56';
set @arg01= NULL; set @arg02= NULL; set @arg03= NULL; set @arg04= NULL; set @arg05= NULL;
set @arg06= NULL; set @arg07= NULL; set @arg08= NULL; set @arg09= NULL; set @arg10= NULL;
set @arg11= NULL; set @arg12= NULL; set @arg13= NULL; set @arg14= NULL; set @arg15= NULL;
set @arg16= NULL; set @arg17= NULL; set @arg18= NULL; set @arg19= NULL; set @arg20= NULL;
set @arg01= 'row_3'; set @arg02= 3; set @arg03= 3.3; set @arg04= 333; set @arg05= 'row_three';
set @arg06= '2004-10-12'; set @arg07= '3'; set @arg08= 3.3; set @arg09= '300300300'; set @arg10= '12:34:56';
set @arg11= 'row_3'; set @arg12= 3; set @arg13= 3.3; set @arg14= 333; set @arg15= 'row_three';
set @arg16= '2004-10-12'; set @arg17= '3'; set @arg18= 3.3; set @arg19= '300300300'; set @arg20= '12:34:56';
set @arg0= "aaaa";
set @arg1= "yyyy";
set @arg2= "R";
set @intarg= 11;
set @varchararg= '2222';
set @intarg= 12;
set @intarg= 13;
set @intarg= 14;
set @nullarg= Null;
SET @@sort_buffer_size=400000;
SET @@sort_buffer_size=DEFAULT;
SET @var= 2 ;
set @arg00='select 1 as my_col';
set @arg00='';
set @arg00=NULL;
set @arg00=1 ;
set @arg01='two' ;
SET @arg00="a";
SET @arg00="b";
SET @arg00=1;
SET sql_mode=ansi;
SET sql_mode="";
SET @arg00=1 ;
set @id= 9876 ;
set @arg00= 'MySQL - Open Source Database' ;
set @arg01= "'" ;
set @arg02= '"' ;
set @arg03= "my'sql'" ;
set @arg04= 'my"sql"' ;
set @arg00=1;
set @arg00= 1;
set @arg01= 1;
set @arg02= 1;
set @arg03= 1;
set @arg04= 1;
set @arg05= 1;
set @arg06= 1;
set @arg07= 1;
set @arg10= 1;
set @arg11= 1;
set @arg12= 1;
set @arg13= 1;
set @arg14= 1;
set @arg15= 1;
set @arg16= 1;
set @arg17= 1;
set @arg20= 1;
set @arg21= 1;
set @arg22= 1;
set @arg23= 1;
set @arg24= 1;
set @arg25= 1;
set @arg26= 1;
set @arg27= 1;
set @arg30= 1;
set @arg31= 1;
set @arg32= 1;
set @arg33= 1;
set @arg34= 1;
set @arg35= 1;
set @arg36= 1;
set @arg37= 1;
set @arg40= 1;
set @arg41= 1;
set @arg42= 1;
set @arg43= 1;
set @arg44= 1;
set @arg45= 1;
set @arg46= 1;
set @arg47= 1;
set @arg50= 1;
set @arg51= 1;
set @arg52= 1;
set @arg53= 1;
set @arg54= 1;
set @arg55= 1;
set @arg56= 1;
set @arg57= 1;
set @arg60= 1;
set @arg61= 1;
set @col_num= 1000 ;
set @string= 'create table t5( ' ;
set @string= concat(@string, 'c0 int)' );
set @string= 'insert into t5 values(' ;
set @arg00='Dogs' ;
set @arg00='Grave' ;
SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
set @reprepare_count= 0;
set @reprepare_count= 0;
set @val=1;
set @val=2;
set @val=3;
set @val=4;
set @val=5;
set @val=6;
set @val=7;
set @val=8;
set @val=9;
set @val=10;
set @val=11;
set @val=12;
set @val=13;
set @val=14;
set @var= 1;
set @var= 2;
set @var=3;
set @var=7;
set @var=8;
set @var=9;
set @var=1;
set @var=2;
set @var=3;
set @var=4;
set @var= 7;
set @var=8;
set @message=null;
set @var=9;
set @var= 10;
set @a=2;
set @a=3;
set @arg1=5, @arg2='five';
set @arg1=55, @arg2='five';
set @a=1;
set @nullvar=1;
set @nullvar=NULL;
set @nullvar2=NULL;
set @arg00=NULL ;
set @ivar= 1234;
set @fvar= 123.4567;
set @var='A';
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set @stmt= ' explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25 ' ;
set optimizer_switch=@tmp_optimizer_switch;
set @@optimizer_switch=@save_optimizer_switch;
set @arg00=1;
set @id1=1,@id2=6;
set names utf8;
set names latin1;
set names default;
set character_set_connection=latin1;
set @var='google';
set @var=null;
set @a=1;
set @v=5;
set @v=0;
set @v=5;
set @precision=10000000000;
set @var=1;
set @var=2;
set @var=3;
set @var='abc';
set @var=null;
set @a=200887, @b=860;
set @a=1;
set @user_id = 'nicke';
set @id = '2';
set @a='CHRISTINE           ';
set @b='CHRISTINE';
set @a=1, @b=2;
set @a='CHRISTINE           ';
set @b='CHRISTINE';
set @@time_zone:='Japan';
set transaction isolation level read committed;
set transaction isolation level serializable;
set @@tx_isolation=default;
set names latin1;
set names default;
set @like="%NDAN%";
set @like="%ER";
set @like="%NDAN%";
set @like="%ER";
set @a=100, @b=100;
set @a=101, @b=101;
set @a=102, @b=102;
set @a=102, @b=103;
set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
set global max_prepared_stmt_count=-1;
set global max_prepared_stmt_count=10000000000000000;
set global max_prepared_stmt_count=default;
set @@max_prepared_stmt_count=1;
set max_prepared_stmt_count=1;
set local max_prepared_stmt_count=1;
set global max_prepared_stmt_count=1;
set global max_prepared_stmt_count=0;
set global max_prepared_stmt_count=1;
set global max_prepared_stmt_count=0;
set global max_prepared_stmt_count=3;
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
SET @id='111111';
SET @id='222222';
SET @a = 0;
SET @a = 1;
SET @a = 0;
SET @a = 0;
SET @a = 1;
SET @a = 0;
SET @a = 0;
SET @a = 1;
SET @a = 0;
SET @a = 0;
SET @a = 1;
SET @a = 0;
SET @a = 0;
SET @a = 1;
SET @a = 0;
SET @a = 0;
SET @a = 1;
SET @a = 0;
SET @a = 0;
SET @a = 1;
SET @a = 0;
set @a:=1, @b:=1, @c:=1;
set @offset=0, @limit=1;
set @offset=3, @limit=2;
set @offset=9;
set @limit=2;
set @a=NULL;
set @a=1;
set @a=2;
set @a=0;
set @a=1;
SET @a= 1;
SET @arg= 1;
SET @arg= 2;
SET @arg= 1;
SET @arg=1;
set @old_character_set_server= @@character_set_server;
set @@character_set_server= latin1;
set @@character_set_server= utf8;
set @@character_set_server= @old_character_set_server;
set @a=1.0;
set @a= 9999999999999999;
set @b= 14632475938453979136;
set @arg= 123456789.987654321;
set @arg= "string";
set @arg= 123456;
set @arg= cast(-12345.54321 as decimal(20, 10));
SET GLOBAL new_cache.key_buffer_size=128*1024;
SET GLOBAL second_cache.key_buffer_size=128*1024;
set @my_password="password";
set @my_data="clear text to encode";
set @my_data="more text to encode";
set @my_password="new password";
set @to_format="123456789.123456789";
set @dec=0;
set @dec=4;
set @dec=6;
set @dec=2;
set @to_format="100";
set @to_format="1000000";
set @to_format="10000";
set @str="abc", @key="cba";
set @str="bcd", @key="dcb";
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET @x_str_1 = NULL;
SET @x_str_2 = NULL;
SET @x_str_3 = NULL;
SET @x_dbl_1 = NULL;
SET @x_dbl_2 = NULL;
SET @x_dbl_3 = NULL;
SET @x_int_1 = NULL;
SET @x_int_2 = NULL;
SET @x_int_3 = NULL;
SET @x_dec_1 = NULL;
SET @x_dec_2 = NULL;
SET @x_dec_3 = NULL;
SET @x = 1;
SET @x = 2;
SET @x = 1;
set @a='2010-11-11';
set @a='2010-08-08';
SET @save_sql_mode= @@sql_mode;
SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
SET SESSION sql_mode = @save_sql_mode;
SET @query_cache_type=         @@global.query_cache_type;
SET @query_cache_limit=        @@global.query_cache_limit;
SET @query_cache_min_res_unit= @@global.query_cache_min_res_unit;
SET @query_cache_size=         @@global.query_cache_size;
SET GLOBAL query_cache_type=1;
SET GLOBAL query_cache_limit=10000;
SET GLOBAL query_cache_min_res_unit=0;
SET GLOBAL query_cache_size= 102400;
SET GLOBAL query_cache_type=         @query_cache_type;
SET GLOBAL query_cache_limit=        @query_cache_limit;
SET GLOBAL query_cache_min_res_unit= @query_cache_min_res_unit;
SET GLOBAL query_cache_size=         @query_cache_size;
set global query_cache_type= ON;
set query_cache_type=DEMAND;
set global query_cache_size= 1024*768;
set debug_sync="wait_in_query_cache_insert SIGNAL parked WAIT_FOR go";
set debug_sync="now WAIT_FOR parked";
set global query_cache_size= 0;
set debug_sync="now SIGNAL go";
set debug_sync= 'RESET';
set global query_cache_size= 0;
SET @old_concurrent_insert= @@GLOBAL.concurrent_insert;
SET @old_query_cache_size= @@GLOBAL.query_cache_size;
SET GLOBAL concurrent_insert= 1;
SET GLOBAL query_cache_size= 1024*512;
SET GLOBAL query_cache_type= ON;
SET DEBUG_SYNC = "wait_after_query_cache_invalidate SIGNAL parked WAIT_FOR go";
SET DEBUG_SYNC = "now WAIT_FOR parked";
SET DEBUG_SYNC = "now SIGNAL go";
SET DEBUG_SYNC= 'RESET';
SET GLOBAL concurrent_insert= DEFAULT;
SET GLOBAL query_cache_size= DEFAULT;
SET GLOBAL query_cache_type= DEFAULT;
SET GLOBAL query_cache_type=DEMAND;
SET GLOBAL query_cache_size= 1024*768;
SET DEBUG_SYNC="wait_in_query_cache_invalidate1 SIGNAL parked1_1 WAIT_FOR go1_1";
SET DEBUG_SYNC="wait_in_query_cache_invalidate2 SIGNAL parked1_2 WAIT_FOR go1_2";
SET DEBUG_SYNC="now WAIT_FOR parked1_1";
SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2 EXECUTE 1";
SET DEBUG_SYNC="now WAIT_FOR parked2";
SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3 EXECUTE 1";
SET DEBUG_SYNC="now WAIT_FOR parked3";
SET DEBUG_SYNC="now SIGNAL go1_1";
SET DEBUG_SYNC="now WAIT_FOR parked1_2";
SET DEBUG_SYNC="now SIGNAL go2";
SET DEBUG_SYNC="now SIGNAL go3";
SET DEBUG_SYNC="now SIGNAL go1_2";
SET DEBUG_SYNC= 'RESET';
SET GLOBAL query_cache_size= 0;
SET GLOBAL query_cache_size= DEFAULT;
SET GLOBAL query_cache_type= DEFAULT;
SET @old_query_cache_size= @@GLOBAL.query_cache_size;
SET GLOBAL concurrent_insert= 1;
SET GLOBAL query_cache_size= 1024*512;
SET GLOBAL query_cache_type= ON;
SET DEBUG_SYNC = "wait_in_query_cache_invalidate2 SIGNAL parked WAIT_FOR go";
SET DEBUG_SYNC = "now WAIT_FOR parked";
SET DEBUG_SYNC="now SIGNAL go";
SET DEBUG_SYNC= 'RESET';
SET GLOBAL query_cache_size= DEFAULT;
SET GLOBAL query_cache_type= DEFAULT;
SET GLOBAL query_cache_type=ON;
SET LOCAL query_cache_type=ON;
SET @@global.query_cache_size=1355776;
set @save_table_definition_cache= @@global.table_definition_cache;
set @@global.table_definition_cache=512;
SET @@global.query_cache_size=0;
set @@global.table_definition_cache=@save_table_definition_cache;
SET @save_table_definition_cache = @@global.table_definition_cache;
SET @@global.table_definition_cache = 512;
SET GLOBAL query_cache_size = 1048576;
SET @@global.query_cache_size = default;
SET @@global.table_definition_cache = @save_table_definition_cache;
SET GLOBAL query_cache_type=default;
set @sql_mode_save=@@global.sql_mode;
set @query_cache_type_save=@@global.query_cache_type;
set @query_cache_size_save=@@global.query_cache_size;
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
set GLOBAL query_cache_size=0;
SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
set global query_cache_size= 81920;
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
set @x = @@query_cache_size;
set global query_cache_size = 10*1024*1024;
set global query_cache_size = @x;
SET GLOBAL query_cache_size=@query_cache_size_save;
SET GLOBAL query_cache_type=@query_cache_type_save;
set GLOBAL sql_mode=@sql_mode_save;
SET GLOBAL query_cache_type= Off;
SET LOCAL query_cache_type= Off;
SET LOCAL query_cache_type= 0;
SET LOCAL query_cache_type= on;
SET LOCAL query_cache_type= 1;
set GLOBAL query_cache_size=1355776;
SET GLOBAL query_cache_type= ON;
SET LOCAL query_cache_type= ON;
set query_cache_type=demand;
set query_cache_type=2;
set query_cache_type=on;
set CHARACTER SET koi8r;
set CHARACTER SET cp1251_koi8;
set CHARACTER SET DEFAULT;
set GLOBAL query_cache_min_res_unit=1001;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=1000;
set GLOBAL query_cache_size=1024;
set GLOBAL query_cache_size=10240;
set GLOBAL query_cache_size=20480;
set GLOBAL query_cache_size=40960;
set GLOBAL query_cache_size=51200;
set GLOBAL query_cache_size=61440;
set GLOBAL query_cache_size=81920;
set GLOBAL query_cache_size=102400;
set GLOBAL query_cache_size=1048576;
SET SQL_SELECT_LIMIT=1;
SET SQL_SELECT_LIMIT=DEFAULT;
set GLOBAL query_cache_size=1048576;
set query_cache_wlock_invalidate=1;
set query_cache_wlock_invalidate=default;
SET NAMES koi8r;
set collation_connection=koi8r_bin;
set character_set_client=cp1251;
set character_set_results=cp1251;
SET NAMES default;
set character_set_results=null;
set character_set_results=default;
set GLOBAL query_cache_size=1355776;
set max_sort_length=200;
set max_sort_length=20;
set max_sort_length=200;
set max_sort_length=default;
set SQL_MODE=oracle;
set SQL_MODE=default;
set group_concat_max_len=10;
set group_concat_max_len=1024;
set group_concat_max_len=default;
SET GLOBAL query_cache_size=0;
SET SESSION query_cache_type = 2;
SET SESSION query_cache_type = 1;
set global query_cache_size=1024*1024;
set GLOBAL query_cache_size=64*1024;
set GLOBAL query_cache_size=1355776;
set query_cache_strip_comments=1;
set query_cache_strip_comments=0;
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
set GLOBAL query_cache_size=0;
SET GLOBAL query_cache_size=102400;
SET GLOBAL query_cache_size=0;
set global query_cache_size=1024*1024;
set global query_cache_size=0;
set GLOBAL query_cache_type=1;
set GLOBAL query_cache_limit=10240;
set GLOBAL query_cache_min_res_unit=0;
set GLOBAL query_cache_size= 102400;
set LOCAL default_week_format = 0;
set LOCAL default_week_format = 2;
set LOCAL div_precision_increment=2;
set LOCAL div_precision_increment=4;
set GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
set GLOBAL ft_boolean_syntax='- +><()~*:""&|';
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size= default;
set GLOBAL query_cache_size=1024000;
set GLOBAL query_cache_size= default;
SET GLOBAL query_cache_size=64*1024*1024;
SET GLOBAL query_cache_size= default;
set global query_cache_size=102400;
set global query_cache_size=0;
set global query_cache_type=0;
set global query_cache_size=102400;
set global query_cache_type=on;
set session query_cache_type=on;
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
set local query_cache_type=default;
set GLOBAL query_cache_type=on;
set local query_cache_type=on;
SET GLOBAL query_cache_size=10*1024*1024;
SET @save_concurrent_insert= @@concurrent_insert;
SET GLOBAL concurrent_insert= 0;
SET GLOBAL concurrent_insert= @save_concurrent_insert;
SET GLOBAL query_cache_size= default;
SET GLOBAL query_cache_size=1048576;
SET GLOBAL query_cache_size= default;
SET @row_count = 4;
SET @sleep_time_per_result_row = 1;
SET @max_acceptable_delay = 2;
SET @@global.query_cache_size = 1024 * 64;
SET @@global.query_cache_size = default;
SET GLOBAL query_cache_size=1024*1024*512;
SET GLOBAL query_cache_size= default;
# MXS: SET @v = ( SELECT SQL_CACHE    1 );
# MXS: qc_get_affected_fields   : ERR: SQL_CACHE !=
# MXS: SQL_CACHE is not part of the select_expr.
# MXS: SET @v = ( SELECT SQL_NO_CACHE 1 );
# MXS: qc_get_affected_fields   : ERR: SQL_NO_CACHE !=
# MXS: SQL_NO_CACHE is not part of the select_expr.
set global query_cache_size=1024*1024*20;
set global query_cache_type=on;
set global query_cache_size=0;
set global query_cache_size=1024*1024*20;
set global query_cache_type=off;
set global query_cache_type=on;
set local query_cache_type= on;
SET GLOBAL userstat=1;
set GLOBAL query_cache_size=1355776;
SET GLOBAL query_cache_size= 0;
set GLOBAL query_cache_size=1355776;
SET GLOBAL userstat=default;
SET @qc= @@query_cache_size;
SET GLOBAL query_cache_size=1355776;
SET GLOBAL query_cache_size= @qc;
SET GLOBAL query_cache_type= default;
SET GLOBAL query_cache_size= default;
SET LOCAL query_cache_type= default;
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
set GLOBAL query_cache_size=1355776;
set query_cache_type=demand;
set query_cache_type=default;
set query_cache_wlock_invalidate=1;
set query_cache_wlock_invalidate=default;
SET AUTOCOMMIT=OFF;
SET AUTOCOMMIT=DEFAULT;
set GLOBAL query_cache_size=default;
set GLOBAL query_cache_type=default;
set debug_sync='inside_make_join_statistics signal killme wait_for done';
set debug_sync='now wait_for killme';
set debug_sync='now signal done';
set debug_sync='reset';
set @mrr_icp_extra_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set optimizer_switch=@mrr_icp_extra_tmp;
set names latin1;
set @a="select * from t2 force index (a) where a NOT IN(0";
set @a=concat(@a, ')');
set @b= concat("explain ", @a);
SET NAMES utf8;
set names default;
SET NAMES utf8;
SET SESSION STORAGE_ENGINE='InnoDB';
SET SESSION STORAGE_ENGINE=DEFAULT;
set names utf8;
set session optimizer_switch='index_merge_sort_intersection=off';
set @tmp_range_vs_index_merge=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
set optimizer_switch=@tmp_range_vs_index_merge;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_merge=off';
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch='index_merge=off';
set optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch='index_merge_intersection=off';
SET SESSION optimizer_switch='index_merge_sort_union=off';
SET SESSION optimizer_switch='index_merge_union=off';
SET SESSION optimizer_switch='index_merge_union=on';
SET SESSION optimizer_switch='index_merge_union=off';
SET SESSION optimizer_switch='index_merge_union=on';
SET SESSION optimizer_switch=DEFAULT;
SET SESSION optimizer_switch='index_merge_sort_union=off';
SET SESSION optimizer_switch='index_merge_sort_union=on';
SET SESSION optimizer_switch=DEFAULT;
set session optimizer_switch='index_merge_sort_intersection=default';
set global read_only=0;
set global read_only=1;
set global read_only=0;
SET GLOBAL read_only=1;
SET GLOBAL read_only=0;
set global read_only=1;
SET GLOBAL read_only=0;
SET GLOBAL READ_ONLY = ON;
SET GLOBAL READ_ONLY = OFF;
set @start_read_only= @@global.read_only;
set global read_only=0;
set global read_only=1;
set global read_only=0;
set global read_only=1;
set global read_only=0;
set global read_only=1;
set global read_only=1;
set global read_only=0;
set global read_only=1;
set global read_only=1;
set global read_only=0;
set global read_only=1;
set global read_only=0;
set global read_only=1;
set global read_only=0;
set global read_only= 1;
set global read_only= @start_read_only;
SET GLOBAL read_only= 1;
SET GLOBAL read_only= 0;
SET myisam_repair_threads=2;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=4096;
SET myisam_repair_threads=2;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
SET myisam_sort_buffer_size=4496;
SET myisam_repair_threads=2;
SET myisam_repair_threads=@@global.myisam_repair_threads;
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
set @@autocommit= 0;
set @@autocommit= default;
# MXSTODO: SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
SET gtid_seq_no = 1000;
SET autocommit= FALSE;
SET autocommit= TRUE;
set session join_cache_level=3;
set @@debug_dbug= 'd:t:O,/tmp/trace.out';
set session join_cache_level=default;
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
set @tmp_ust= @@use_stat_tables;
set @tmp_oucs= @@optimizer_use_condition_selectivity;
set @tmp_mdev6808= @@optimizer_use_condition_selectivity;
SET optimizer_use_condition_selectivity = 2;
set optimizer_use_condition_selectivity=@tmp_mdev6808;
SET use_stat_tables = PREFERABLY;
SET optimizer_use_condition_selectivity = 3;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
set use_stat_tables = PREFERABLY, optimizer_use_condition_selectivity = 3;
set use_stat_tables= @tmp_ust;
set optimizer_use_condition_selectivity= @tmp_oucs;
SET SESSION STORAGE_ENGINE=DEFAULT;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set @save_histogram_size=@@histogram_size;
set @save_histogram_type=@@histogram_type;
set histogram_type='SINGLE_PREC_HB';
set histogram_size=100;
set optimizer_use_condition_selectivity=4;
set histogram_size=20;
set histogram_type='single_prec_hb';
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
set @a=-1;
set histogram_size=100;
set histogram_size=100;
set optimizer_use_condition_selectivity=4;
set use_stat_tables='preferably';
set histogram_size=100;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
set histogram_size=100;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
SET optimizer_use_condition_selectivity = 2;
set optimizer_use_condition_selectivity=2;
set histogram_size=100;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=4;
set @tmp_mdev8779=@@optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=5;
set optimizer_use_condition_selectivity= @tmp_mdev8779;
set use_stat_tables= @save_use_stat_tables;
set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set @save_histogram_size=@@histogram_size;
set @save_histogram_type=@@histogram_type;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=5;
set optimizer_use_condition_selectivity=4;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_condition_pushdown=off';
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set optimizer_switch=@save_optimizer_switch;
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=4;
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set histogram_size=127;
set optimizer_use_condition_selectivity=4;
set histogram_type='DOUBLE_PREC_HB';
set histogram_size=126;
set histogram_type='SINGLE_PREC_HB';
set histogram_size=24;
set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @tmp_use_stat_tables=@@use_stat_tables;
set use_stat_tables='never';
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@tmp_use_stat_tables;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables='preferably';
set histogram_size=127;
set histogram_type='SINGLE_PREC_HB';
set optimizer_use_condition_selectivity=4;
set histogram_size=@save_histogram_size;
set histogram_type=@save_histogram_type;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=PREFERABLY;
set histogram_size=10;
set histogram_type='SINGLE_PREC_HB';
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set histogram_type=@save_histogram_type;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=PREFERABLY;
set optimizer_use_condition_selectivity=3;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_condition_pushdown=off';
set optimizer_switch=@save_optimizer_switch;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=PREFERABLY;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables = PREFERABLY;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables = PREFERABLY;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=PREFERABLY;
set histogram_size=50;
set histogram_type=SINGLE_PREC_HB;
set  optimizer_use_condition_selectivity=4;
set histogram_size=@save_histogram_size;
set histogram_type=@save_histogram_type;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set  use_stat_tables=PREFERABLY;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables=PREFERABLY;
SET optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables = 'preferably';
set optimizer_use_condition_selectivity = 2;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity = 3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables = 'preferably';
set optimizer_use_condition_selectivity = 3;
SET use_stat_tables=PREFERABLY;
SET optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables = 'preferably';
set @@RAND_SEED1=810763568, @@RAND_SEED2=600681772;
set TIMESTAMP=1394806993;
set optimizer_use_condition_selectivity=1;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables='preferably';
set histogram_size=100;
set optimizer_use_condition_selectivity=4;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables='preferably';
set histogram_size=100;
set optimizer_use_condition_selectivity=4;
set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables='preferably';
set optimizer_use_condition_selectivity=3;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='optimize_join_buffer_size=on';
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set @@optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=6;
set @optimizer_switch_for_select_test=@@optimizer_switch;
set @join_cache_level_for_select_test=@@join_cache_level;
set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch_jcl6;
set @optimizer_switch_for_select_test=NULL;
set @join_cache_level_for_select_test=NULL;
SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, MAX_JOIN_SIZE=9;
SET MAX_JOIN_SIZE=2;
SET SQL_BIG_SELECTS=1;
SET MAX_JOIN_SIZE=2;
SET MAX_JOIN_SIZE=DEFAULT;
set MAX_SEEKS_FOR_KEY=1;
SET MAX_SEEKS_FOR_KEY=DEFAULT;
set local  max_join_size=8;
set local  max_join_size=1;
set local  max_join_size=1;
SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, MAX_JOIN_SIZE=DEFAULT;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch=ifnull(@optimizer_switch_for_select_test,'outer_join_with_cache=off');
SET BIG_TABLES=1;
SET BIG_TABLES=0;
SET BIG_TABLES=1; # Force use of MyISAM
SET BIG_TABLES=0;
SET @OLD_SQL_MODE12595=@@SQL_MODE, @@SQL_MODE='';
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SET @@SQL_MODE=@OLD_SQL_MODE12595;
SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
SET SQL_MODE=default;
set SQL_MODE=TRADITIONAL;
set SQL_MODE=DEFAULT;
SET @old_sort_buffer_size= @@session.sort_buffer_size;
SET @@sort_buffer_size= 40000;
SET @@sort_buffer_size= @old_sort_buffer_size;
SET @cnt := 0;
SET SESSION join_buffer_size = 2176;
SET SESSION join_buffer_size = DEFAULT;
set @tmp= @@optimizer_switch;
SET SESSION optimizer_switch='index_condition_pushdown=off';
SET SESSION optimizer_switch=@tmp;
set sql_buffer_result=0;
set sql_buffer_result=1;
set sql_buffer_result= 0;
SET optimizer_switch=@save_optimizer_switch;
SET @pass='my_pw';
SET @wrong='incorrect';
set sql_mode="";
# MXS ERROR 1193 (HY000): Unknown system variable 'debug_dbug'
# MXS set @save_debug_dbug= @@debug_dbug;
set @@debug_dbug= @save_debug_dbug;
set @@debug_dbug= @save_debug_dbug;
set gtid_domain_id = 10;
SET @a=11;
SET @a=11;
SET @save_binlog_format           = @@binlog_format;
SET @save_keep_files_on_create    = @@keep_files_on_create;
SET @save_max_join_size           = @@max_join_size;
SET @save_myisam_repair_threads   = @@myisam_repair_threads;
SET @save_myisam_sort_buffer_size = @@myisam_sort_buffer_size;
SET @save_sort_buffer_size        = @@sort_buffer_size;
SET SESSION sort_buffer_size=100000;
SET SESSION binlog_format=mixed;
SET SESSION sort_buffer_size=100000;
SET SESSION binlog_format=row;
SET SESSION binlog_format=mixed;
SET SESSION myisam_sort_buffer_size=500000, myisam_repair_threads=1;
SET SESSION sort_buffer_size=100000;
SET SESSION  keep_files_on_create=ON;
SET SESSION  max_join_size=2222220000000;
SET SESSION myisam_sort_buffer_size=500000,
            myisam_repair_threads=1,
            sort_buffer_size = 200000,
            max_join_size=2222220000000,
            keep_files_on_create=ON;
SET SESSION myisam_sort_buffer_size=500000,
            myisam_repair_threads=1,
            sort_buffer_size=100000,
            binlog_format=mixed,
            keep_files_on_create=ON,
            max_join_size=2222220000000;
SET sql_mode='ansi';
SET sql_mode=default;
SET sql_mode='ansi';
SET sql_mode=default;
SET sql_mode='ansi';
SET sql_mode=default;
SET SESSION myisam_sort_buffer_size=500000,
            myisam_repair_threads=1,
            sort_buffer_size=100000,
            binlog_format=mixed,
            keep_files_on_create=ON,
            max_join_size=2222220000000;
SET SESSION myisam_sort_buffer_size=500000,
            myisam_repair_threads=1,
            sort_buffer_size=100000,
            binlog_format=mixed,
            keep_files_on_create=ON,
            max_join_size=2222220000000;
set session binlog_format=mixed;
set session binlog_format=default;
set session binlog_format=mixed;
SET @@binlog_format           = @save_binlog_format;
SET @@keep_files_on_create    = @save_keep_files_on_create;
SET @@max_join_size           = @save_max_join_size;
SET @@myisam_repair_threads   = @save_myisam_repair_threads;
SET @@myisam_sort_buffer_size = @save_myisam_sort_buffer_size;
SET @@sort_buffer_size        = @save_sort_buffer_size;
set session timestamp=4646464;
set session timestamp=default;
set @save_tm=@@timestamp;
set @save_dfs=@@default_storage_engine;
SET @@default_storage_engine=MyISAM;
SET @@default_storage_engine=@save_dfs;
set @save_general_log=@@global.general_log;
set global general_log=0;
set global general_log=@save_general_log;
set @save_long_query_time= @@long_query_time;
set @save_slow_query_log= @@slow_query_log;
set @save_log_output= @@log_output;
set slow_query_log= 1;
set global log_output='TABLE';
set @@long_query_time=0.01;
set @@long_query_time=@save_long_query_time;
set @@long_query_time=0.01;
set @@long_query_time=@save_long_query_time;
set global log_output= @save_log_output;
set @@slow_query_log= @save_slow_query_log;
set @@long_query_time= @save_long_query_time;
set @save_week_format=@@default_week_format;
set @@default_week_format=0;
set default_week_format = 2;
set @@default_week_format=@save_week_format;
set @save_old_passwords=@@old_passwords;
set @@old_passwords=0;
set old_passwords=1;
set @@old_passwords=@save_old_passwords;
set @rnd=1;
SET @max_allowed_packet= @@global.max_allowed_packet;
SET @net_buffer_length= @@global.net_buffer_length;
SET GLOBAL max_allowed_packet= 1024;
SET GLOBAL net_buffer_length= 1024;
SET GLOBAL max_allowed_packet= @max_allowed_packet;
SET GLOBAL net_buffer_length= @net_buffer_length;
set sql_quote_show_create=0;
set sql_quote_show_create=1;
SET @old_sql_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
SET sql_mode= 'ANSI_QUOTES';
SET sql_mode= '';
SET sql_quote_show_create= OFF;
SET sql_quote_show_create= @old_sql_quote_show_create;
SET sql_mode= @old_sql_mode;
set names binary;
set names utf8;
set names koi8r;
set global log_queries_not_using_indexes=OFF;
set global log_queries_not_using_indexes=ON;
set names utf8;
set names latin1;
SET NAMES latin1;
set names koi8r;
set names utf8;
SET NAMES latin1;
SET NAMES latin1;
SET NAMES utf8;
SET NAMES latin1;
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @old_debug= @@session.debug;
set debug_sync='RESET';
set debug_dbug='+d,show_explain_probe_delete_exec_start';
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
set debug_dbug='+d,show_explain_probe_update_exec_start';
set debug_dbug=@old_debug;
set debug_sync='RESET';
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='';
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @old_debug= @@session.debug;
set debug_sync='RESET';
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @old_debug= @@session.debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_expl_tmp= @@optimizer_switch;
set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
set optimizer_switch= @show_expl_tmp;
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2; # <---
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
set debug_dbug=@old_debug;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
set debug_dbug=@old_debug;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
set debug_dbug=@old_debug;
set debug_dbug='+d,show_explain_in_find_all_keys';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_join_exec_end';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_end';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @tmp_mdev299_jcl= @@join_cache_level;
set join_cache_level=0;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_test_if_quick_select';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set debug_dbug='+d,show_explain_probe_join_tab_preread';
set @show_explain_probe_select_id=1;
set debug_dbug=@old_debug;
set debug_dbug='+d,show_explain_probe_union_read';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set autocommit=0;
set autocommit=0;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set names cp1251;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set names utf8;
set names default;
set debug_dbug=@old_debug;
set names default;
set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_join_exec_start';
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=2;
set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
set debug_sync='RESET';
set password for u1 = PASSWORD('SOMETHINGELSE');
set password for u1 = '';
SET profiling = 1;
SET profiling = 0;
set @my_po = 0;
SET @start_global_value = @@global.max_error_count;
SET @start_session_value = @@session.max_error_count;
SET @@session.max_error_count = 5;
SET @@session.max_error_count = 7;
SET @@session.max_error_count = 9;
SET @@global.max_error_count = @start_global_value;
SET @@session.max_error_count = @start_session_value;
SET @save_sql_mode=@@sql_mode;
SET sql_mode='';
SET sql_mode='STRICT_ALL_TABLES';
SET @@sql_mode=@save_sql_mode;
set @sqlcode= 12;
set @message_text= "User variable";
set global event_scheduler=1;
set global event_scheduler=0;
set @@session.binlog_format=row;
SET @@skip_name_resolve=0;
SET @@LOCAL.skip_name_resolve=0;
SET @@GLOBAL.skip_name_resolve=0;
SET @a = 2;
SET @@SQL_MODE = 'STRICT_ALL_TABLES';
SET @@SQL_MODE = '';
set @a=1;
set @b=1;
set @a=1;
set @b=1;
set @c=1;
SET SESSION debug_dbug="+d,bug23032_emit_warning";
SET SESSION debug_dbug="-d,bug23032_emit_warning";
SET @@SQL_MODE = '';
set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth;
set @@max_sp_recursion_depth=100;
set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS;
set @a=1;
set @a:=0;
set @tmp_x = 42;
set @tmp_y = 3;
set @tmp_z = 0;
set @x = 0;
set @@max_sp_recursion_depth=10;
set @@max_sp_recursion_depth=default;
set @au = @@autocommit;
set session autocommit = @au;
set @x = bug12712();
set names='foo2';
set @in_func := 0;
set @in_func := 0;
set @in_func := 0;
set @in_func := 0;
set @old_recursion_depth = @@max_sp_recursion_depth;
set @@max_sp_recursion_depth = 255;
set @@max_sp_recursion_depth = @old_recursion_depth;
SET @sql_mode_saved = @@sql_mode;
SET sql_mode = traditional;
SET sql_mode = @sql_mode_saved;
SET @old_max_error_count=  @@session.max_error_count;
SET SESSION max_error_count= 0;
SET SESSION max_error_count= @old_max_error_count;
SET @msg = '';
set @@max_sp_recursion_depth= 20;
set @@max_sp_recursion_depth= 0;
SET sql_mode=ONLY_FULL_GROUP_BY;
SET @lock_wait_timeout_saved= @@lock_wait_timeout;
# MXS Embedded parser is not aware of innodb.
# MXS SET SET @innodb_lock_wait_timeout_saved= @@innodb_lock_wait_timeout;
SET @@lock_wait_timeout= 1;
SET @@innodb_lock_wait_timeout= 1;
SET AUTOCOMMIT= 0;
SET AUTOCOMMIT= 0;
SET @@lock_wait_timeout= @lock_wait_timeout_saved;
SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
set @@session.autocommit=0;
set @@session.autocommit=default;
set @exec_count=0;
set @@session.max_sp_recursion_depth=5;
set @exec_count=0;
set @@session.max_sp_recursion_depth=default;
set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
set @@max_sp_recursion_depth=255;
set @var=1;
set @@max_sp_recursion_depth=0;
set session low_priority_updates=on;
set session low_priority_updates=default;
SET @@SQL_MODE = '';
set @@global.concurrent_insert= @old_concurrent_insert;
set sql_mode='';
set sql_mode=default;
set password=password('foobar');
set password='';
set @body="";
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL before WAIT_FOR changed';
SET DEBUG_SYNC= 'now WAIT_FOR before';
SET DEBUG_SYNC= 'now SIGNAL changed';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'after_wait_locked_pname SIGNAL locked WAIT_FOR issued';
SET DEBUG_SYNC= 'now WAIT_FOR locked';
SET DEBUG_SYNC= 'now SIGNAL issued';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked_t1 WAIT_FOR go_for_t0';
SET DEBUG_SYNC= 'now WAIT_FOR locked_t1';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL go_for_t0';
SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
SET DEBUG_SYNC='now WAIT_FOR check_db';
SET DEBUG_SYNC='now SIGNAL dropped_schema';
SET DEBUG_SYNC = 'RESET';
set @e = e();
set @@sql_mode = 'ANSI';
set @@sql_mode = '';
set sql_select_limit = 1;
set sql_select_limit = default;
set @osbs = @@sort_buffer_size;
set @@sort_buffer_size = 262000;
set @@sort_buffer_size = @osbs;
set @x = 1;
set time_zone='+03:00';
set @@sql_mode = '';
set @@sql_mode = 'ANSI_QUOTES';
set @@sql_mode = '';
set @@sql_mode = 'ANSI';
set @@sql_mode = '';
set @n = 0;
set @x = 42;
set @old_mode= @@sql_mode;
set @@sql_mode= "ERROR_FOR_DIVISION_BY_ZERO";
set @@sql_mode= "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO";
set @@sql_mode= "NO_ZERO_IN_DATE";
set @@sql_mode=@old_mode;
set @x = 1;
set @x = bug8861(05);
set character set utf8;
set character set default;
set @x = @@sort_buffer_size;
set @@sort_buffer_size = 2000000;
set @@sort_buffer_size = @x;
set @var='a';
set @var='abcd';
set @bug12979_user_var = NULL;
set internal_var= internal_var / 2;
set @sm=@@sql_mode;
set sql_mode='traditional';
set sql_mode=@sm;
set @@max_sp_recursion_depth=4;
set @@max_sp_recursion_depth=0;
set @x = 2;
SET @bug18589_v1 = "";
SET @a = _latin2"aaaaaaaaaa" ;
SET @v2 = 'b';
SET @v3 = 'c';
set names utf8;
SET @save_sql_mode=@@sql_mode;
SET sql_mode='';
SET sql_mode='TRADITIONAL';
SET @@sql_mode=@save_sql_mode;
SET @save_sql_mode=@@sql_mode;
SET SQL_MODE='IGNORE_SPACE';
SET SQL_MODE='';
SET @@sql_mode=@save_sql_mode;
SET @save_sql_mode=@@sql_mode;
SET SQL_MODE='IGNORE_SPACE';
SET SQL_MODE='';
SET SQL_MODE='IGNORE_SPACE';
SET SQL_MODE='';
SET @@sql_mode=@save_sql_mode;
SET @save_max_sp_recursion= @@max_sp_recursion_depth;
SET max_sp_recursion_depth= 5;
SET max_sp_recursion_depth= @save_max_sp_recursion;
set @a=0;
set @a=@a+1;
SET @p1_p2_cnt= 2;
SET NAMES latin1;
SET NAMES default;
set @old_mode= @@sql_mode;
set @@sql_mode= cast(pow(2,32)-1 as unsigned integer);
set @@sql_mode= @old_mode;
SET @old_init_connect= @@GLOBAL.init_connect;
SET @@GLOBAL.init_connect= @old_init_connect;
SET @save_max_sp_recursion= @@max_sp_recursion_depth;
SET @@max_sp_recursion_depth= 5;
SET @@max_sp_recursion_depth= @save_max_sp_recursion;
SET iLimit=1;
set @tmp_toc= @@table_open_cache;
set @tmp_tdc= @@table_definition_cache;
set global table_open_cache=1;
set global table_definition_cache=1;
set global table_open_cache= @tmp_toc;
set global table_definition_cache= @tmp_tdc;
set SQL_MODE="";
set autocommit=0;
set autocommit=1;
set @error_in_func:= 0;
set autocommit= 0;
set @a:= bug13825_0();
set @a:= bug13825_1();
set @a:= bug13825_2();
set @a:= bug13825_2();
set autocommit= 1;
set autocommit= 0;
set @a:= bug13825_4();
set autocommit= 1;
set @@session.max_heap_table_size=16384;
set @@session.max_heap_table_size=default;
SET @@GLOBAL.storage_engine=InnoDB;
SET @@SESSION.storage_engine=InnoDB;
SET @@GLOBAL.storage_engine=@old_engine;
SET NAMES utf8;
SET @@sql_mode = 'ansi';
SET @@sql_mode = 'traditional';
SET @@sql_mode = 'ansi';
SET @@sql_mode = 'traditional';
SET @@sql_mode = 'ansi';
SET @@sql_mode = 'traditional';
SET @@sql_mode = 'ansi';
SET @@sql_mode = 'traditional';
SET @@sql_mode = 'ansi';
set @b=1;
set @a=0;
set @b:='test';
set @a=0;
set @@sql_mode="";
set @@sql_mode="ansi_quotes";
set @@sql_mode="no_table_options";
set @@sql_mode="no_key_options";
set @@sql_mode="no_field_options,mysql323,mysql40";
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
set @@sql_mode="";
set @@sql_mode="mysql323";
set @@sql_mode="mysql40";
set session sql_mode = '';
set session sql_mode = 'IGNORE_SPACE';
set @@SQL_MODE=NULL;
set session sql_mode=ansi;
set session sql_mode=no_field_options;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
SET @@SQL_MODE='';
SET @@SQL_MODE='';
SET @@SQL_MODE='ANSI_QUOTES';
SET @@SQL_MODE='';
SET @@SQL_MODE='';
SET @@SQL_MODE='ANSI_QUOTES';
set sql_mode=2097152;
set sql_mode=4194304;
set sql_mode=16384+(65536*4);
set sql_mode=2147483648*2; # that mode does not exist
set sql_mode=PAD_CHAR_TO_FULL_LENGTH;
set sql_mode=0;
SET @@SQL_MODE=@OLD_SQL_MODE;
set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
set session sql_mode='PAD_CHAR_TO_FULL_LENGTH';
set session sql_mode=@OLD_SQL_MODE;
SET @org_mode=@@sql_mode;
SET @@sql_mode='traditional';
SET sql_mode=@org_mode;
SET @OLD_SQL_MODE = @@SESSION.SQL_MODE;
SET SESSION SQL_MODE = 'PAD_CHAR_TO_FULL_LENGTH';
SET SESSION SQL_MODE = @OLD_SQL_MODE;
SET @org_mode=@@sql_mode;
SET @@sql_mode='';
SET @var1='abcd\'ef';
SET @var2='abcd\"ef';
SET @var3='abcd\bef';
SET @var4='abcd\nef';
SET @var5='abcd\ref';
SET @var6='abcd\tef';
SET @var7='abcd\\ef';
SET @var8='abcd\%ef';
SET @var9='abcd\_ef';
SET @to_var1='wxyz\'ef';
SET @to_var2='wxyz\"ef';
SET @to_var3='wxyz\bef';
SET @to_var4='wxyz\nef';
SET @to_var5='wxyz\ref';
SET @to_var6='wxyz\tef';
SET @to_var7='wxyz\\ef';
SET @to_var8='wxyz\%ef';
SET @to_var9='wxyz\_ef';
SET @@sql_mode='NO_BACKSLASH_ESCAPES';
SET @@sql_mode= @org_mode;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set histogram_size=4;
set histogram_size=8;
set histogram_type='DOUBLE_PREC_HB';
set histogram_size= 0;
set histogram_type=default;
set optimizer_switch='extended_keys=off';
set optimizer_switch='extended_keys=on';
set optimizer_switch='extended_keys=off';
set use_stat_tables='never';  
set names utf8;
set use_stat_tables='preferably';
set use_stat_tables='never';
set use_stat_tables='preferably';
set use_stat_tables='preferably';
set histogram_size=100;
set histogram_type='SINGLE_PREC_HB';
set histogram_size=254;
set histogram_type='DOUBLE_PREC_HB';
set histogram_type=default;
set histogram_size=default;
set histogram_size=10;
set histogram_size=default;
set histogram_size=10;
set histogram_type='double_prec_hb';
set histogram_size=default;
set histogram_type=default;
set @@tmp_table_size=1024*16;
set @@max_heap_table_size=1024*16;
set histogram_size=63;
set histogram_size=default;
set use_stat_tables=@save_use_stat_tables;
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
set use_stat_tables='never';
set use_stat_tables='preferably';
set optimizer_switch=@save_optimizer_switch;
set use_stat_tables=@save_use_stat_tables;
SET SESSION STORAGE_ENGINE=DEFAULT;
set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3;
set debug_dbug='+d,simulate_file_write_error';
set debug_dbug='';
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
set use_stat_tables='never';
set debug_sync='statistics_mem_alloc_start1  WAIT_FOR second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2  SIGNAL first_thread_working';
set use_stat_tables='preferably';
set debug_sync='statistics_mem_alloc_start1  SIGNAL second_thread_started_too';
set debug_sync='statistics_mem_alloc_start2  WAIT_FOR first_thread_working';
set use_stat_tables='preferably';
set use_stat_tables='preferably';
set debug_sync='RESET';
set debug_sync='statistics_collection_start1  WAIT_FOR second_thread_started_too';
set debug_sync='statistics_collection_start2  SIGNAL first_thread_working';
set use_stat_tables='preferably';
set debug_sync='statistics_collection_start1  SIGNAL second_thread_started_too';
set debug_sync='statistics_collection_start2  WAIT_FOR first_thread_working';
set use_stat_tables='preferably';
set debug_sync='RESET';
set debug_sync='RESET';
set debug_sync='statistics_collection_start SIGNAL parked WAIT_FOR finish';
set use_stat_tables='preferably';
set debug_sync='now WAIT_FOR parked';
set use_stat_tables='never';
set debug_sync='now SIGNAL finish';
set debug_sync='RESET';
set @save_global_use_stat_tables=@@global.use_stat_tables;
set global use_stat_tables='preferably';
set debug_sync='RESET';
set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1';
set debug_sync='thr_multi_lock_after_thr_lock SIGNAL go2 EXECUTE 2';
set debug_sync='open_and_process_table WAIT_FOR parker';
set debug_sync='statistics_read_start SIGNAL go1 WAIT_FOR go2';
set debug_sync='RESET';
set global use_stat_tables=@save_global_use_stat_tables;
set @save_global_use_stat_tables=@@global.use_stat_tables;
set global use_stat_tables='preferably';
set debug_sync='RESET';
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
SET DEBUG_SYNC= "now SIGNAL go";
set debug_sync='RESET';
set global use_stat_tables=@save_global_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
SET use_stat_tables = 'preferably';
SET use_stat_tables = DEFAULT;
SET GLOBAL use_stat_tables = PREFERABLY;
SET GLOBAL use_stat_tables = DEFAULT;
SET use_stat_tables = PREFERABLY;
SET use_stat_tables = DEFAULT;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_condition_pushdown=off';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='index_condition_pushdown=off';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
set optimizer_switch=@save_optimizer_switch;
set use_stat_tables='complementary';
SET  use_stat_tables = 'preferably';
SET use_stat_tables='never';
SET use_stat_tables='preferably';
set use_stat_tables=@save_use_stat_tables;
set use_stat_tables = 'preferably';
set use_stat_tables=@save_use_stat_tables;
set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
SET @old_log_output = @@global.log_output;
SET GLOBAL LOG_OUTPUT = 'FILE';
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
set @old_concurrent_insert= @@global.concurrent_insert;
set @@global.concurrent_insert= 0;
SET @old_log_output = @@global.log_output;
SET GLOBAL LOG_OUTPUT = 'FILE';
set sql_log_bin=0;
set @old_general_log = @@global.general_log;
set global general_log = 'OFF';
set global general_log = @old_general_log;
SET @save_thread_cache_size=@@thread_cache_size;
SET GLOBAL thread_cache_size=3;
SET GLOBAL thread_cache_size=@save_thread_cache_size;
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
set @org_mode=@@sql_mode;
set @@sql_mode='ansi,traditional';
set @@sql_mode='STRICT_ALL_TABLES';
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
set @@sql_mode='ansi,traditional';
set @@sql_mode='strict_trans_tables';
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
set @@sql_mode='strict_trans_tables';
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
set @@sql_mode='ansi,traditional';
set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
set @@sql_mode='ansi,traditional';
set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
set @@sql_mode='ansi,traditional';
set @@sql_mode='ansi';
set @@sql_mode='ansi,traditional';
set sql_mode='traditional';
set sql_mode='traditional';
set sql_mode='';
set sql_mode='traditional';
set sql_mode='no_zero_date';
set sql_mode='traditional';
set sql_mode=@org_mode;
SET @@sql_mode = 'traditional';
SET @@sql_mode = '';
set @@sql_mode='traditional';
set @@sql_mode='traditional';
set @@sql_mode='traditional';
set @@sql_mode='traditional';
set @@sql_mode='traditional';
set sql_mode='traditional';
set @@sql_mode= @org_mode;
set @@sql_mode='traditional';
set @@sql_mode= @org_mode;
set names utf8;
set sql_mode= 'traditional';
set sql_mode='traditional';
set sql_mode='traditional';
set @@sql_mode='NO_ZERO_DATE';
SET sql_mode='NO_ZERO_DATE';
SET sql_mode='NO_ZERO_IN_DATE';
set @subselect2_test_tmp=@@optimizer_switch;
set optimizer_switch='semijoin=on,firstmatch=on,mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET @tmp_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on,in_to_exists=on';
SET optimizer_switch=@tmp_optimizer_switch;
set @tmp_mdev567=@@optimizer_switch;
set optimizer_switch='mrr=off';
set optimizer_switch=@tmp_mdev567;
set @tmp_mdev614=@@optimizer_switch;
set optimizer_switch='mrr=off';
set optimizer_switch=@tmp_mdev614;
set optimizer_switch=@subselect2_test_tmp;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='optimize_join_buffer_size=on';
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=6;
set @join_cache_level_for_subselect3_test=@@join_cache_level;
set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch;
set @join_cache_level_for_subselect3_test=NULL;
set @subselect3_tmp= @@optimizer_switch;
set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on';
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @@optimizer_switch=@save_optimizer_switch;
set optimizer_switch='subquery_cache=off';
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch2=@@optimizer_switch;
set optimizer_switch='subquery_cache=off';
set @@optimizer_switch=@save_optimizer_switch2;
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='firstmatch=off,materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='firstmatch=off,materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='materialization=off';
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set @@optimizer_switch=@save_optimizer_switch;
set @save_max_heap_table_size=@@max_heap_table_size;
set @@optimizer_switch='firstmatch=off,materialization=off';
set @@max_heap_table_size= 16384;
set @save_max_heap_table_size=@@max_heap_table_size;
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='firstmatch=off,materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='firstmatch=off,materialization=off';
set @save_optimizer_search_depth=@@optimizer_search_depth;
set @@optimizer_search_depth=63;
set @@optimizer_search_depth=@save_optimizer_search_depth;
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=6;
set join_cache_level=@save_join_cache_level;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch = 'semijoin=off';
SET SESSION optimizer_switch = 'semijoin=on';
set @optimizer_switch_save=@@optimizer_switch;
SET SESSION optimizer_switch='semijoin=OFF,in_to_exists=OFF,materialization=ON,partial_match_rowid_merge=ON,partial_match_table_scan=OFF';
set optimizer_switch=@optimizer_switch_save;
set @@optimizer_switch=@subselect3_tmp;
set @subselect4_tmp= @@optimizer_switch;
set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
set optimizer_switch='semijoin_with_cache=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET @old_optimizer_switch = @@session.optimizer_switch;
SET SESSION optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
SET SESSION optimizer_switch = @old_optimizer_switch;
set @old_optimizer_switch          = @@session.optimizer_switch;
SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,mrr=on,engine_condition_pushdown=on';
set @@session.optimizer_switch          = @old_optimizer_switch;
SET @old_optimizer_switch = @@session.optimizer_switch;
SET @old_join_cache_level = @@session.join_cache_level;
SET SESSION optimizer_switch = 'firstmatch=on,loosescan=on,materialization=on,in_to_exists=off,semijoin=on';
SET SESSION join_cache_level = 1;
SET SESSION optimizer_switch = @old_optimizer_switch;
SET SESSION join_cache_level = @old_join_cache_level;
set @old_icp=@@optimizer_switch;
SET SESSION optimizer_switch="engine_condition_pushdown=on";
SET SESSION optimizer_switch=@old_icp;
SET @old_optimizer_switch = @@session.optimizer_switch;
SET SESSION optimizer_switch = 'materialization=on,in_to_exists=off';
SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
SET SESSION optimizer_switch = @old_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='materialization=off,in_to_exists=on,subquery_cache=off';
set @@optimizer_switch='materialization=on,in_to_exists=off,subquery_cache=off';
set @@optimizer_switch='materialization=off,in_to_exists=on,subquery_cache=off';
set @@optimizer_switch=@save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch='semijoin_with_cache=off';
SET optimizer_switch='materialization=off';
SET optimizer_switch='materialization=on';
SET optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='in_to_exists=on,materialization=off,semijoin=off';
set @@optimizer_switch='semijoin=off';
set @save_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch = 'in_to_exists=off,semijoin=off,materialization=on';
SET @@optimizer_switch = 'in_to_exists=on,semijoin=off,materialization=off';
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
set @@optimizer_switch = 'in_to_exists=on,materialization=off,semijoin=off';
set @@optimizer_switch = 'in_to_exists=off,materialization=on,semijoin=off';
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch = 'in_to_exists=on,materialization=off,semijoin=off';
set @@optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch='in_to_exists=on,materialization=off';
set @old_optimizer_switch = @@optimizer_switch;
set @@optimizer_switch='subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
set @@optimizer_switch='subquery_cache=off,materialization=off,in_to_exists=on,semijoin=off';
set @@optimizer_switch = @old_optimizer_switch;
set @old_optimizer_switch = @@optimizer_switch;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off,subquery_cache=off';
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off,subquery_cache=off';
set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off,subquery_cache=off';
set @@optimizer_switch = @old_optimizer_switch;
set @old_optimizer_switch = @@optimizer_switch;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set @@optimizer_switch = @old_optimizer_switch;
set @old_optimizer_switch = @@optimizer_switch;
set @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
set @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
set @@optimizer_switch = @old_optimizer_switch;
set optimizer_switch=@subselect4_tmp;
set @@optimizer_switch='semijoin=off,in_to_exists=on,materialization=off,subquery_cache=off';
set @@optimizer_switch='semijoin=on,in_to_exists=on,materialization=off';
set optimizer_switch=@subselect4_tmp;
set @optimizer_switch_MDEV4056 = @@optimizer_switch;
SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
set @@optimizer_switch = @optimizer_switch_MDEV4056;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch='semijoin_with_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set big_tables=1;
set big_tables=0;
set local group_concat_max_len=400;
set local group_concat_max_len=default;
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on';
set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=off';
set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=on';
set optimizer_switch='default,semijoin=off,materialization=on,subquery_cache=on';
set optimizer_switch='default';
set @@optimizer_switch='subquery_cache=off';
set @@optimizer_switch='subquery_cache=on';
set @@optimizer_switch= default;
SET @@optimizer_switch='subquery_cache=off';
SET @@optimizer_switch='subquery_cache=on';
set @@optimizer_switch= default;
SET @@optimizer_switch = 'subquery_cache=off';
SET @@optimizer_switch = 'subquery_cache=on';
set @@optimizer_switch= default;
SET @@optimizer_switch='subquery_cache=off';
SET @@optimizer_switch='subquery_cache=on';
set @@optimizer_switch= default;
SET @@optimizer_switch = 'subquery_cache=off';
SET @@optimizer_switch = 'subquery_cache=on';
set @@optimizer_switch= default;
set optimizer_switch='subquery_cache=off';
set optimizer_switch='subquery_cache=on';
set @@optimizer_switch= default;
set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=on';
set @@optimizer_switch= default;
SET SESSION optimizer_switch = 'index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_condition_pushdown=off,firstmatch=off,loosescan=off,materialization=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=on';
set @@optimizer_switch= default;
set optimizer_switch='subquery_cache=on';
set optimizer_switch='subquery_cache=on,in_to_exists=on';
set @@optimizer_switch= default;
set optimizer_switch='subquery_cache=on';
SET optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch= default;
# MXS Embedded parser is not aware of the 'debug' variable.
# MXS SET @orig_debug=@@debug;
SET GLOBAL debug_dbug="d,subselect_exec_fail";
SET GLOBAL debug_dbug=@orig_debug;
set @subselect_mat_cost=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set long_query_time=0.1;
set names utf8;
set @@optimizer_switch = 'exists_to_in=on,in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
set optimizer_switch=@subselect_mat_cost;
set optimizer_switch='exists_to_in=on';
set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
set optimizer_switch='exists_to_in=off,subquery_cache=off';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
SET optimizer_switch='exists_to_in=on,subquery_cache=off';
SET optimizer_switch='exists_to_in=off,subquery_cache=off';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
set optimizer_switch='exists_to_in=off,subquery_cache=off';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch='in_to_exists=on,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch='materialization=off,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch='index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=on';
SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch = 'exists_to_in=off,in_to_exists=on';
SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch = 'in_to_exists=on,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch = 'exists_to_in=on';
SET optimizer_switch = 'exists_to_in=on';
SET optimizer_switch = 'exists_to_in=on';
SET optimizer_switch='exists_to_in=on';
SET optimizer_switch='in_to_exists=on,semijoin=on,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
set optimizer_switch=default;
set optimizer_switch='exists_to_in=on';
set optimizer_switch=default;
set @subselect_extra_no_sj_tmp=@@optimizer_switch;
set  @optimizer_switch_for_subselect_extra_test='semijoin=off,firstmatch=off,loosescan=off,semijoin_with_cache=off';
set optimizer_switch= @subselect_extra_no_sj_tmp;
set @optimizer_switch_for_subselect_extra_test=null;
set @subselect_extra_tmp=@@optimizer_switch;
set @@optimizer_switch=ifnull(@optimizer_switch_for_subselect_extra_test,
                              "semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on,partial_match_rowid_merge=off,partial_match_table_scan=off");
set @tmp_subselect_extra_derived=@@optimizer_switch;
set optimizer_switch='derived_merge=on,derived_with_keys=on';
SET SESSION optimizer_switch='derived_with_keys=off';
SET SESSION optimizer_switch='derived_with_keys=on';
SET SESSION optimizer_switch='derived_with_keys=on';
set optimizer_switch= @tmp_subselect_extra_derived;
set @subselect_innodb_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set optimizer_switch=@subselect_innodb_tmp;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off';
set session optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off';
set session optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off';
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch = 'semijoin=off';
set @@optimizer_switch=@save_optimizer_switch;
SET @@optimizer_switch='materialization=off,semijoin=off,in_to_exists=on';
set @@optimizer_switch='default';
SET @@optimizer_switch='materialization=on,semijoin=off';
set @@optimizer_switch='default';
SET @@optimizer_switch='semijoin=ON,loosescan=ON,firstmatch=OFF,materialization=OFF';
set @@optimizer_switch='default';
set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
set @subselect_mat_cost=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set long_query_time=0.1;
set names utf8;
set @@optimizer_switch = 'in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
set @@optimizer_switch='default';
set optimizer_switch=@subselect_mat_cost;
set @subselect_mat_test_optimizer_switch_value='materialization=on,in_to_exists=off,semijoin=off';
set @subselect_mat_test_optimizer_switch_value=null;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set @@optimizer_switch='semijoin=off';
set @@optimizer_switch='semijoin=off';
SET @@optimizer_switch='default,semijoin=on,materialization=on';
SET @_save_join_cache_level = @@join_cache_level;
SET @_save_optimizer_switch = @@optimizer_switch;
SET join_cache_level = 1;
SET optimizer_switch='materialization=on';
SET @@join_cache_level = @_save_join_cache_level;
SET @@optimizer_switch = @_save_optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
set optimizer_switch='exists_to_in=off';
set optimizer_switch=default;
set optimizer_switch='materialization=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
set optimizer_switch=default;
set @join_cache_level_for_subselect_test=NULL;
set @optimizer_switch_for_subselect_test='materialization=off,semijoin=off,subquery_cache=off,mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
set @optimizer_switch_for_subselect_test=null;
set optimizer_switch='subquery_cache=off';
set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
set optimizer_switch=default;
set @join_cache_level_for_subselect_test=NULL;
set @optimizer_switch_for_subselect_test='semijoin=off,mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=1;
set @join_cache_level_for_subselect_test=@@join_cache_level;
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;
set @tmp_subselect_nulls=@@optimizer_switch;
set optimizer_switch='semijoin=off';
set optimizer_switch= @tmp_subselect_nulls;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch = "materialization=on,in_to_exists=off,semijoin=off,subquery_cache=off";
set @test_default_opt_switch = @@optimizer_switch;
set @in_exists = "materialization=off,in_to_exists=on,semijoin=off,subquery_cache=off";
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch = @test_default_opt_switch;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch = @test_default_opt_switch;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch = @test_default_opt_switch;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch=@in_exists;
set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
set @save_rowid_merge_buff_size = @@rowid_merge_buff_size;
set @@rowid_merge_buff_size = 0;
set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@rowid_merge_buff_size = @save_rowid_merge_buff_size;
set @@optimizer_switch="materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=off";
set @@optimizer_switch='materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on';
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set @@optimizer_switch='materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,semijoin=off';
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
set @@optimizer_switch='materialization=off,in_to_exists=on';
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
set @@optimizer_switch='materialization=off,in_to_exists=on';
set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='in_to_exists=on,materialization=off';
set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=off,partial_match_table_scan=on';
set @@optimizer_switch='in_to_exists=on,materialization=off';
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
set @@optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='optimize_join_buffer_size=on';
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=6;
set @optimizer_switch_for_subselect_sj2_test=@@optimizer_switch;
set @join_cache_level_for_subselect_sj2_test=@@join_cache_level;
set @tmp_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='semijoin_with_cache=on';
SET SESSION join_cache_level=2;
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=default;
set @tmp_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'semijoin_with_cache=on';
SET join_cache_level = 2;
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=default;
set @tmp_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'semijoin_with_cache=on';
SET join_cache_level = 3;
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=default;
set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch_jcl6;
set @optimizer_switch_for_subselect_sj2_test=NULL;
set @join_cache_level_subselect_sj2_test=NULL;
set optimizer_switch='materialization=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set optimizer_switch=default;
set @tmp_906385=@@max_join_size;
SET max_join_size = 80;
set max_join_size= @tmp_906385;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch='materialization=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch='materialization=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch='materialization=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=3;
set optimizer_switch='materialization=off,semijoin=off';
set optimizer_switch='materialization=on,semijoin=on';
set join_cache_level= @save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
set @subselect_sj2_tmp= @@optimizer_switch;
set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj2_test,'outer_join_with_cache=off');
SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj2_test,'semijoin_with_cache=off');
set @save_max_heap_table_size= @@max_heap_table_size;
set max_heap_table_size=16384;
set @save_join_buffer_size = @@join_buffer_size;
set join_buffer_size= 8192;
set join_buffer_size= @save_join_buffer_size;
set max_heap_table_size= @save_max_heap_table_size;
set @save_join_buffer_size = @@join_buffer_size;
set join_buffer_size= 8192;
set @bug35674_save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch=@bug35674_save_optimizer_switch;
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size=1;
set join_buffer_size=default;
set @a=0;
set @tmp_869012=@@optimizer_switch;
SET optimizer_switch='semijoin=on,materialization=on';
set optimizer_switch= @tmp_869012;
set @tmp869001_jcl= @@join_cache_level;
set @tmp869001_os= @@optimizer_switch;
SET join_cache_level=0;
SET optimizer_switch='materialization=on,semijoin=on,firstmatch=on,loosescan=off';
set join_cache_level= @tmp869001_jcl;
set optimizer_switch= @tmp869001_os;
set @tmp_951283=@@optimizer_prune_level;
SET optimizer_prune_level=0;
set optimizer_prune_level=@tmp_951283;
set @tmp7474= @@optimizer_search_depth;
SET SESSION optimizer_search_depth = 1;
set optimizer_search_depth=@tmp7474;
set optimizer_switch=@subselect_sj2_tmp;
set @save_optimizer_switch_jcl6=@@optimizer_switch;
set @@optimizer_switch='optimize_join_buffer_size=on';
set @@optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
set @@optimizer_switch='semijoin_with_cache=on';
set @@optimizer_switch='outer_join_with_cache=on';
set @@optimizer_switch='join_cache_hashed=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set join_cache_level=6;
set @optimizer_switch_for_subselect_sj_test=@@optimizer_switch;
set @join_cache_level_for_subselect_sj_test=@@join_cache_level;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='firstmatch=off';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
SET SESSION optimizer_switch='semijoin=on';
SET SESSION optimizer_switch='join_cache_hashed=on';
SET SESSION join_cache_level=3;
SET SESSION optimizer_switch='mrr=on';
SET SESSION join_cache_level=6;
set optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;
set @os_912513= @@optimizer_switch;
set @jcl_912513= @@join_cache_level;
SET optimizer_switch = 'semijoin=on,materialization=on,join_cache_hashed=on';
SET join_cache_level = 3;
set @@optimizer_switch= @os_912513;
set @@join_cache_level= @jcl_912513;
set @tmp_otimizer_switch= @@optimizer_switch;
set @tmp_join_cache_level=@@join_cache_level;
set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
set join_cache_level=0;
set join_cache_level=6;
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=@tmp_join_cache_level;
set @tmp_otimizer_switch= @@optimizer_switch;
set @tmp_join_cache_level=@@join_cache_level;
set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
set join_cache_level=0;
set join_cache_level=6;
set optimizer_switch=@tmp_optimizer_switch;
set join_cache_level=@tmp_join_cache_level;
set join_cache_level=default;
set @@optimizer_switch=@save_optimizer_switch_jcl6;
set @optimizer_switch_for_subselect_sj_test=NULL;
set @join_cache_level_subselect_sj_test=NULL;
set @subselect_sj_mat_tmp= @@optimizer_switch;
set optimizer_switch=ifnull(@subselect_mat_test_optimizer_switch_value, 'semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on');
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set @optimizer_switch_local_default= @@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
set join_cache_level=1;
set @@optimizer_switch='materialization=on,in_to_exists=off,firstmatch=off';
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='semijoin=off';
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='materialization=off,in_to_exists=on';
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='semijoin=off';
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='materialization=off,in_to_exists=on';
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='semijoin=off';
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='materialization=off,in_to_exists=on';
set @@optimizer_switch=@save_optimizer_switch;
set @prefix_len = 6;
set @blob_len = 16;
set @suffix_len = @blob_len - @prefix_len;
set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 512)
set @blob_len = 512;
set @suffix_len = @blob_len - @prefix_len;
set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 512)
set @blob_len = 1024;
set @suffix_len = @blob_len - @prefix_len;
set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 1024)
set @blob_len = 1025;
set @suffix_len = @blob_len - @prefix_len;
set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 1025)
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='materialization=off,in_to_exists=on';
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='semijoin=off';
set @@optimizer_switch=@optimizer_switch_local_default;
set @@optimizer_switch='materialization=off,in_to_exists=on';
set @@optimizer_switch= @save_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch=@optimizer_switch_local_default;
SET @@optimizer_switch='semijoin=on,materialization=on';
set @@optimizer_switch= @save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set @@optimizer_switch=@optimizer_switch_local_default;
SET @@optimizer_switch='semijoin=on,materialization=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set session optimizer_switch='materialization=off,in_to_exists=on';
set session optimizer_switch=@save_optimizer_switch;
set optimizer_switch='firstmatch=on';
set @blob_len = 1024;
set @suffix_len = @blob_len - @prefix_len;
set @tmp_860300=@@optimizer_switch;
set optimizer_switch='semijoin=on,materialization=on,loosescan=off,firstmatch=off';
set optimizer_switch=@tmp_860300;
set @tmp_860535=@@optimizer_switch;
set optimizer_switch='semijoin=on,materialization=on,loosescan=off,firstmatch=off';
set optimizer_switch=@tmp_860535;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on,semijoin=on';
SET optimizer_switch=@save_optimizer_switch;
SET @save_optimizer_switch=@@optimizer_switch;
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=2;
SET optimizer_switch='join_cache_hashed=on';
SET join_cache_level=4;
SET optimizer_switch=@save_optimizer_switch;
SET join_cache_level=@save_join_cache_level;
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'materialization=on,semijoin=on';
SET optimizer_switch=@save_optimizer_switch;
SET @tmp_mdev5811= @@big_tables;
SET big_tables = ON;
SET big_tables=@tmp_mdev5811;
set @tmp_mdev5056=@@join_cache_level;
SET join_cache_level = 2;
set join_cache_level=@tmp_mdev5056;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=on,materialization=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_optimizer_switch;
set @subselect_sj_tmp= @@optimizer_switch;
set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj_test,'outer_join_with_cache=off');
SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj_test,'semijoin_with_cache=off');
set @save_optimizer_switch=@@optimizer_switch;
set join_buffer_size=8*1024;
set join_buffer_size=default;
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch = 'semijoin=on';
SET SESSION optimizer_switch = 'semijoin=off';
set SESSION optimizer_switch=@save_optimizer_switch;
SET SESSION optimizer_switch ='semijoin=on';
set SESSION optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=on,materialization=off';
set optimizer_switch='firstmatch=off,loosescan=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='materialization=off';
set optimizer_switch='semijoin=off';
set optimizer_switch='semijoin=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=off,materialization=off';
set optimizer_switch='semijoin=off,materialization=on';
set optimizer_switch='semijoin=on,materialization=off';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=off,materialization=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=on';
set optimizer_switch='materialization=off';
set optimizer_switch='materialization=on';
set optimizer_switch=@save_optimizer_switch;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin=off,materialization=on';
set optimizer_switch='semijoin=on,materialization=on';
set optimizer_switch=@save_optimizer_switch;
set @tmp_751484= @@optimizer_switch;
set optimizer_switch='materialization=on';
set optimizer_switch='materialization=off';
set optimizer_switch=@tmp_751484;
set @tmp_20110622= @@optimizer_switch;
set optimizer_switch='firstmatch=off,loosescan=off,materialization=off';
set @tmp_jcl_20110622= @@join_cache_level;
set join_cache_level= 0;
set optimizer_switch='firstmatch=on';
set optimizer_switch='firstmatch=off';
set join_cache_level= 0;
set @@join_cache_level=@tmp_jcl_20110622;
set @@optimizer_switch=@tmp_20110622;
set @save_802965= @@optimizer_switch;
set optimizer_switch='semijoin=on,materialization=off,firstmatch=off,loosescan=off';
set optimizer_switch=@save_802965;
set @tmp803303= @@optimizer_switch;
set optimizer_switch = 'semijoin=on,materialization=off,firstmatch=off,loosescan=off';
set optimizer_switch= @tmp803303;
set @tmp803457=@@optimizer_switch;
set optimizer_switch='materialization=off';
set @tmp803457=@@optimizer_switch;
set @tmp835758=@@optimizer_switch;
set optimizer_switch='semijoin=on,loosescan=on,materialization=off,firstmatch=off';
set @@optimizer_switch= @tmp835758;
set @tmp834739=@@optimizer_switch;
set optimizer_switch='semijoin=on,loosescan=on,materialization=off,firstmatch=off';
set @@optimizer_switch=@tmp834739;
set @tmp_830993=@@optimizer_switch;
set optimizer_switch='semijoin=on,loosescan=off,materialization=off,firstmatch=off';
set @tmp_830993_jbs= @@join_buffer_size;
set join_buffer_size=160;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set optimizer_switch=@tmp_830993;
set join_buffer_size= @tmp_830993_jbs;
set @tmp_mjs_861147= @@max_join_size;
SET max_join_size=10;
set @tmp_os_861147= @@optimizer_switch;
set @@optimizer_switch='semijoin=on,materialization=on';
set max_join_size= @tmp_mjs_861147;
set optimizer_switch= @tmp_os_861147;
set @tmp_877288=@@optimizer_switch;
set optimizer_switch='semijoin=ON,materialization=ON';
set optimizer_switch=@tmp_877288;
set @tmp878753= @@optimizer_switch;
set optimizer_switch= 'semijoin=on,derived_merge=on';
set optimizer_switch=@tmp878753;
set @tmp_otimizer_switch= @@optimizer_switch;
set optimizer_switch='semijoin=on';
set optimizer_switch='firstmatch=off';
set optimizer_switch='semijoin_with_cache=on';
set optimizer_switch='semijoin_with_cache=off';
set optimizer_switch= @tmp_otimizer_switch;
set @tmp_otimizer_switch= @@optimizer_switch;
SET SESSION optimizer_switch='semijoin=on,firstmatch=on';
SET SESSION optimizer_switch='loosescan=off';
SET SESSION optimizer_switch='loosescan=on';
set optimizer_switch= @tmp_otimizer_switch;
set @tmp_otimizer_switch= @@optimizer_switch;
SET SESSION optimizer_switch='semijoin=on,materialization=on';
set optimizer_switch= @tmp_otimizer_switch;
SET @tmp_optimizer_switch=@@optimizer_switch;
SET @@optimizer_switch='semijoin=on';
SET @@optimizer_switch='materialization=on';
SET @@optimizer_switch='firstmatch=on';
SET optimizer_switch='semijoin_with_cache=on';
SET optimizer_prune_level=0;
SET optimizer_prune_level=DEFAULT;
SET optimizer_switch=@tmp_optimizer_switch;
set @opl_901399= @@optimizer_prune_level;
set @os_091399= @@optimizer_switch;
SET optimizer_prune_level=0;
SET optimizer_switch = 'materialization=off';
set optimizer_prune_level= @opl_901399;
set optimizer_switch= @os_091399;
set @tmp_923246= @@optimizer_switch;
set optimizer_switch='mrr=on,materialization=off';
set optimizer_switch= @tmp_923246;
set @tmp_jcl_978479= @@join_cache_level;
set join_cache_level=0;
set @tmp_os_978479= @@optimizer_switch;
set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off';
set @@join_cache_level= @tmp_jcl_978479;
set @@optimizer_switch= @tmp_os_978479;
SET join_cache_level = 5;
SET optimizer_switch = 'semijoin=on';
set max_heap_table_size=16*1024;
set join_buffer_size = @tmp_join_buffer_size;
set max_heap_table_size = @tmp_max_heap_table_size;
SET @tmp_mdev5059=@@join_cache_level;
SET join_cache_level = 3;
set @tmp_os_mdev5059= @@optimizer_switch;
set optimizer_switch=default;
SET join_cache_level=@tmp_mdev5059;
set optimizer_switch=@tmp_os_mdev5059;
set @tmp_mdev7823=@@optimizer_switch;
set optimizer_switch=default;
set optimizer_switch= @tmp_mdev7823;
set @tmp_mdev6859=@@optimizer_switch;
set optimizer_switch=default;
set optimizer_switch= @tmp_mdev6859;
set optimizer_switch=@subselect_sj_tmp;
set @subselect_tmp=@@optimizer_switch;
set @@optimizer_switch=ifnull(@optimizer_switch_for_subselect_test,
                              "semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on,partial_match_rowid_merge=off,partial_match_table_scan=off");
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
set @a:=2;
set @a:=(SELECT a from t1);
set @a:=(SELECT a from t1);
set sort_buffer_size = (select s1 from t1);
SET SQL_SELECT_LIMIT=1;
SET SQL_SELECT_LIMIT=default;
set @b:= 0;
# MXS: set @a:= (select sum(a) from t1 where b > @b);
# MXS: qc_get_type : ERR: QUERY_TYPE_GSYSVAR_WRITE != QUERY_TYPE_USERVAR_READ|QUERY_TYPE_GSYSVAR_WRITE
set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
set @tmp11867_optimizer_switch=@@optimizer_switch;
set optimizer_switch='semijoin_with_cache=off';
set optimizer_switch=@tmp11867_optimizer_switch;
SET SESSION sort_buffer_size = 32 * 1024;
SET SESSION sort_buffer_size = 8 * 1024 * 1024;
SET @@sql_mode='ansi';
SET @@sql_mode=default;
SET session sort_buffer_size=8192;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
SET optimizer_switch='materialization=off';
SET optimizer_switch= @save_optimizer_switch;
set session sort_buffer_size= 33*1024;
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
SET join_cache_level=@save_join_cache_level;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SET SESSION sql_mode=@old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SET SESSION sql_mode=@old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SET SESSION sql_mode=@old_sql_mode;
SET @@sql_mode='ansi';
SET @@sql_mode=default;
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
SET join_cache_level=@save_join_cache_level;
set @optimizer_switch_save=@@optimizer_switch;
set @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=on';
set @@optimizer_switch=@optimizer_switch_save;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SET SESSION sql_mode=@old_sql_mode;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SET SESSION sql_mode=@old_sql_mode;
SET @var2:=4, @var3:=8;
SET @var3=8;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set @tmp_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
set optimizer_switch=@tmp_optimizer_switch;
SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
SET SESSION sql_mode=@old_sql_mode;
set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
set @@optimizer_switch=@subselect_tmp;
set @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
set @@optimizer_switch=@subselect_tmp;
set @save_join_cache_level=@@join_cache_level;
SET SESSION join_cache_level=3;
set @@join_cache_level= @save_join_cache_level;
set @save_join_cache_level=@@join_cache_level;
SET SESSION join_cache_level=8;
set @@join_cache_level= @save_join_cache_level;
set @old_optimizer_switch = @@session.optimizer_switch;
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
set @@session.optimizer_switch=@old_optimizer_switch;
set @old_optimizer_switch = @@optimizer_switch;
SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
set @@optimizer_switch=@old_optimizer_switch;
SET optimizer_switch='subquery_cache=off';
set optimizer_switch=@subselect_tmp;
set @mdev367_optimizer_switch = @@optimizer_switch;
set optimizer_switch = 'subquery_cache=on';
set optimizer_switch=@mdev367_optimizer_switch;
set optimizer_switch = 'subquery_cache=off';
set optimizer_switch=@mdev367_optimizer_switch;
set optimizer_switch=@subselect_tmp;
set @@expensive_subquery_limit= 0;
set @@expensive_subquery_limit= default;
set @tmp_mdev410=@@global.userstat;
set global userstat=on;
set global userstat=@tmp_mdev410;
SET SESSION big_tables=1;
SET SESSION big_tables=0;
set @save_tmp_table_size=@@tmp_table_size;
set @save_max_heap_table_size=@@max_heap_table_size;
set @save_storage_engine=@@storage_engine;
set storage_engine=MYISAM;
SET max_heap_table_size=16384;
SET max_heap_table_size=default;
SET max_heap_table_size=16384;
SET @@tmp_table_size=@save_tmp_table_size;
SET @@max_heap_table_size=@save_max_heap_table_size;
set @save_storage_engine=@@storage_engine;
set storage_engine=INNODB;
set @@tmp_table_size=1024*256;
set @@tmp_table_size=@save_tmp_table_size;
SET @@max_heap_table_size=1024*256;
SET @@max_heap_table_size=@save_max_heap_table_size;
set storage_engine=@save_storage_engine;
SET @l=1;
SET SESSION keep_files_on_create = TRUE;
SET SESSION keep_files_on_create = FALSE;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
SET @@SQL_MODE=@OLD_SQL_MODE;
set timestamp=1;
set storage_engine=myisam;
set storage_engine=myisam;
set @name="This is a very long string, that mustn't find room in a system field like Table_name. Thus it should be cut by the actual size of the field. So we can use this string to find out the actual length of the field and to use it in any compare queries";
set optimizer_switch='table_elimination=off';
set optimizer_switch='table_elimination=on';
set optimizer_switch='table_elimination=default';
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
SET @@max_heap_table_size= 16384;
set @@optimizer_switch='derived_merge=OFF';
set @@optimizer_switch='extended_keys=ON';
set sql_mode='ignore_bad_table_options';
set sql_mode='';
SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
SET SQL_MODE='';
SET @@SQL_MODE=@OLD_SQL_MODE;
SET NAMES latin1;
SET sql_mode=no_zero_in_date;
SET sql_mode=no_zero_date;
SET sql_mode=default;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
SET sql_mode='no_zero_in_date';
SET sql_mode=DEFAULT;
set @@session.max_heap_table_size=16*1024*1024;
set time_zone='+00:00';
set time_zone='+10:30';
set time_zone='-10:00';
set time_zone='MET';
set time_zone='UTC';
set time_zone='Europe/Moscow';
set time_zone='leap/Europe/Moscow';
set time_zone='UTC';
set time_zone='MET';
set time_zone='+01:30';
set time_zone = default;
set time_zone= '0';
set time_zone= '0:0';
set time_zone= '-20:00';
set time_zone= '+20:00';
set time_zone= 'Some/Unknown/Time/Zone';
set timestamp=1000000000;
SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
SET SESSION TRANSACTION READ WRITE;
SET SESSION TRANSACTION READ WRITE;
SET TRANSACTION READ ONLY;
SET @mysqltest_var = NULL;
SET SESSION LOW_PRIORITY_UPDATES=1;
SET GLOBAL LOW_PRIORITY_UPDATES=1;
SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
set sql_mode=strict_all_tables;
set time_zone="+02:00";
set session sql_mode ='no_auto_value_on_zero';
set @a:=0;
set @a:="";
set @update_failed:="";
set @total_change:=0;
set @del_sum:= 0;
set @del:= 0;
set @fired:="";
set @log:= "";
set @log:= "";
set @log:= "";
set @log:= "";
set @log:= "";
set @del_before:=0, @del_after:= 0;
set @a:= 0, @b:= "";
set @a:= 0, @b:= "";
set @c:= 0, @d:= 0, @e:= "", @f:= "";
set @a:= 0;
set @b:="";
set @b:="";
set sql_mode='ansi';
set sql_mode="";
set sql_mode="traditional";
set sql_mode="";
set sql_mode="traditional";
set sql_mode=default;
set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth;
set @@max_sp_recursion_depth=100;
set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS;
SET @save_sql_mode=@@sql_mode;
SET SQL_MODE='';
SET SQL_MODE='traditional';
SET @x=1;
SET @x=2;
SET SQL_MODE='';
SET @x=3;
SET @x=4;
SET @@sql_mode=@save_sql_mode;
SET @save_sql_mode=@@sql_mode;
SET sql_mode='TRADITIONAL';
set @a:=1/0;
set @check=0, @t4_bi_called=0, @t4_bu_called=0;
SET @@sql_mode=@save_sql_mode;
set @a:="";
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @id=last_insert_id();
set @a= 0;
set @b= 0;
SET @bug51650 = 1;
SET @bug51650 = 1;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on';
SET optimizer_switch=@save_optimizer_switch;
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
SET @@session.sql_mode = default;
SET @a = 0;
SET @b = 0;
SET SESSION innodb_lock_wait_timeout = 2;
SET DEBUG_SYNC='RESET';
SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting';
SET DEBUG_SYNC='now WAIT_FOR waiting';
SET DEBUG_SYNC='RESET';
SET DEBUG_SYNC='mdl_upgrade_lock SIGNAL waiting';
SET DEBUG_SYNC='now WAIT_FOR waiting';
SET DEBUG_SYNC='RESET';
SET DEBUG_SYNC='mdl_acquire_lock_wait SIGNAL waiting';
SET DEBUG_SYNC='now WAIT_FOR waiting';
SET DEBUG_SYNC='RESET';
SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped';
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'now SIGNAL dropped';
SET DEBUG_SYNC= 'RESET';
SET GLOBAL query_cache_size=1024*1024*8;
SET GLOBAL query_cache_size=DEFAULT;
set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
set @@sql_mode= @old_sql_mode;
SET NAMES utf8;
set @@max_length_for_sort_data=0;
set @@max_length_for_sort_data=0;
set big_tables=1;
set big_tables=0;
set @@sql_mode='TRADITIONAL';
set @@sql_mode='';
SET SQL_MODE=TRADITIONAL;
SET SQL_MODE=DEFAULT;
SET SQL_MODE=TRADITIONAL;
SET SQL_MODE=DEFAULT;
SET @h0="20111107";
SET @h1="0";
SET @@timestamp=UNIX_TIMESTAMP('2013-08-19 20:30:00');
SET SQL_MODE=NO_ZERO_IN_DATE;
SET SQL_MODE=DEFAULT;
SET @@timestamp=DEFAULT;
set @a=(select min(makedate('111','1'))) ;
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
SET timestamp=DEFAULT;
SET @@time_zone='+00:00';
SET @@time_zone=DEFAULT;
set @org_mode=@@sql_mode;
set @@sql_mode='ansi,traditional';
set @@sql_mode= @org_mode;
set @bug28261='';
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='semijoin_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set @org_mode=@@sql_mode;
set @@sql_mode='ansi,traditional';
set @@sql_mode= @org_mode;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
SET timestamp=DEFAULT;
SET @@timestamp=UNIX_TIMESTAMP('2013-08-19 20:30:00');
SET SQL_MODE=NO_ZERO_IN_DATE;
SET SQL_MODE=DEFAULT;
SET @@timestamp=DEFAULT;
SET NAMES CP850;
SET NAMES latin1;
SET sql_mode='NO_ZERO_DATE';
SET old_mode=zero_date_time_cast;
SET old_mode=DEFAULT;
SET sql_mode=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2015-01-01 00:00:00');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2015-01-01 00:00:00');
SET SQL_WARNINGS=1;
set @a=1.0;
set names latin1;
set names latin1;
set names utf8;
set names latin1;
set session sql_mode='traditional';
set sql_mode='';
set sql_mode='traditional';
set sql_mode='ansi,traditional';
set sql_mode='';
set @@sql_mode='traditional';
set sql_mode='';
set @sav_dpi= @@div_precision_increment;
set @@div_precision_increment=15;
set div_precision_increment= @sav_dpi;
SET @a= CAST(1 AS decimal);
SET @decimal= 1.1;
SET SQL_MODE='';
SET sql_mode='STRICT_ALL_TABLES';
SET sql_mode=DEFAULT;
SET SQL_WARNINGS=1;
set names latin1;
SET TIME_ZONE='+00:00';
SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
SET TIMESTAMP=0; # back to current time
set time_zone='+03:00';
set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456;
set time_zone="+03:00";
SET TIMESTAMP=1234;
SET TIMESTAMP=1235;
SET TIMESTAMP=1236;
SET TIMESTAMP=1237;
SET TIMESTAMP=1238;
SET TIMESTAMP=1234;
SET TIMESTAMP=1000000000;
SET TIMESTAMP=1000000001;
SET TIMESTAMP=1000000002;
SET TIMESTAMP=1000000002;
SET TIMESTAMP=1000000003;
SET TIMESTAMP=1000000003;
SET TIMESTAMP=1000000004;
SET TIMESTAMP=1000000005;
SET TIMESTAMP=1000000005;
SET TIMESTAMP=1000000006;
SET TIMESTAMP=1000000007;
SET TIMESTAMP=1000000007;
SET TIMESTAMP=1000000007;
SET TIMESTAMP=1000000008;
SET TIMESTAMP=1000000008;
SET TIMESTAMP=1000000009;
SET TIMESTAMP=1000000010;
SET TIMESTAMP=1000000011;
SET TIMESTAMP=1000000012;
SET TIMESTAMP=1000000013;
SET TIMESTAMP=1000000014;
SET TIMESTAMP=1000000015;
SET TIMESTAMP=1000000016;
SET TIMESTAMP=1000000017;
SET TIMESTAMP=1000000018;
set timestamp=1000000019;
set sql_mode='maxdb';
set sql_mode='';
set time_zone= @@global.time_zone;
SET TIMESTAMP=0;
SET time_zone='+02:00';
set @a:=0;
set timestamp=12340;
set timestamp=12350;
set timestamp=0;
set @a:=0;
set timestamp=12340;
set timestamp=12350;
set timestamp=0;
SET time_zone=DEFAULT;
SET sql_mode="NO_ZERO_DATE";
SET sql_mode=DEFAULT;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
SET timestamp=unix_timestamp('2001-02-03 10:20:30');
SET timestamp=DEFAULT;
SET sql_mode=traditional;
SET sql_mode=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2014-04-14 01:02:03');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
SET timestamp=DEFAULT;
SET @@old_mode=zero_date_time_cast;
SET @@old_mode=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
SET timestamp=DEFAULT;
SET timestamp=UNIX_TIMESTAMP('2015-09-11 20:20:20');
SET timestamp=DEFAULT;
SET SQL_WARNINGS=1;
SET debug_sync='mysql_create_function_after_lock SIGNAL locked WAIT_FOR go';
SET debug_sync='now WAIT_FOR locked';
SET debug_sync='find_udf_before_lock SIGNAL go';
SET debug_sync='mysql_drop_function_after_lock SIGNAL locked WAIT_FOR go';
SET debug_sync='now WAIT_FOR locked';
SET debug_sync='find_udf_before_lock SIGNAL go';
SET debug_sync='RESET';
set GLOBAL query_cache_size=1355776;
set GLOBAL query_cache_size=default;
set testval = 'hello';
SET result = check_const_len(str_const);
set debug_dbug='+d,bug11747970_raise_error';
set SQL_SELECT_LIMIT=2;
set SQL_SELECT_LIMIT=DEFAULT;
set local tmp_table_size=1024;
set local tmp_table_size=default;
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
SET optimizer_switch=@save_optimizer_switch;
set sql_select_limit=1;
set sql_select_limit=default;
SET SQL_SELECT_LIMIT=1;
set sql_select_limit=default;
set @val:=6;
SET @@global.max_allowed_packet=25000000;
SET @@global.max_allowed_packet:= @tmp_max;
SET @old_slow_query_log= @@global.slow_query_log;
SET @old_log_output= @@global.log_output;
SET @old_long_query_time= @@long_query_time;
SET GLOBAL log_output= "TABLE";
SET GLOBAL slow_query_log= ON;
SET SESSION long_query_time= 0;
SET @@long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
set sql_mode="";
set session sort_buffer_size = 1024*1024*1024*1024;
SET @tmp=0;
set tmp_table_size=1024;
SET SESSION sql_safe_updates = 1;
SET SESSION sql_safe_updates = DEFAULT;
set @my_max_user_connections= @@global.max_user_connections;
set session max_user_connections= 2;
set global max_user_connections= 2;
set global max_user_connections= 0;
set global max_user_connections=-1;
set global max_user_connections=1;
set global max_user_connections= @my_max_user_connections;
set global userstat=1;
set global userstat=0;
set @save_general_log=@@global.general_log;
set @@global.general_log=0;
set @@global.userstat=1;
set @@global.userstat=0;
set @@autocommit=0;
set @@autocommit=1;
set @@global.general_log=@save_general_log;
SET TIMESTAMP=10000;
# MXSTODO qc_sqlite can not parse quoted variables.
# MXSTODO SET @`a b`='hello';
set @var1= "';aaa";
SET @var2=char(ascii('a'));
set @a := foo;
set @a := connection_id() + 3;
set @b := 1;
set @a=0,@b=0;
set @g=1;
set @a=0;
set @a=_latin2'test';
set @a=_latin2'test' collate latin2_general_ci;
set @var= NULL ;
set @v1=null, @v2=1, @v3=1.1, @v4=now();
# 'set session @honk = 99' is not legal.
# MXS set session @honk=99;
set @first_var= NULL;
set @first_var= cast(NULL as signed integer);
set @first_var= NULL;
set @first_var= concat(NULL);
set @first_var=1;
set @first_var= cast(NULL as CHAR);
set @a=18446744071710965857;
SET @a := (SELECT afield FROM bigfailure);
SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
set @rownum := 0;
set @rank := 0;
set @prev_score := NULL;
set @var := 0;
set @lastid=-1;
set @lastid=-1;
SET @bug12408412=1;
SET @var=NULL;
SET @aux = NULL ;
SET @aux1 = 0.123E-1;
SET @aux1 = NULL;
SET @aux = 1; # INT
SET @aux = NULL;
SET @aux = 'text'; # STRING
SET @aux = NULL;
SET @bug12408412=1;
SET @var=NULL;
set @var= repeat('a',20000);
# MXS Embedded parser is not aware of the 'global.slave_net_timeout' variable.
# MXS SET set @my_slave_net_timeout         =@@global.slave_net_timeout;
set global slave_net_timeout=100;
set global sql_slave_skip_counter=100;
set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
set @@global.slave_net_timeout= @my_slave_net_timeout;
SET @@session.log_slave_updates= true;
SET @@global.log_slave_updates= true;
SET @@session.relay_log= 'x';
SET @@global.relay_log= 'x';
SET @@session.relay_log_basename= 'x';
SET @@global.relay_log_basename= 'x';
SET @@session.log_bin_basename= 'x';
SET @@global.log_bin_basename= 'x';
SET @@session.relay_log_index= 'x';
SET @@global.relay_log_index= 'x';
SET @@session.log_bin_index= 'x';
SET @@global.log_bin_index= 'x';
SET @@session.relay_log_info_file= 'x';
SET @@global.relay_log_info_file= 'x';
SET @@session.relay_log_space_limit= 7;
SET @@global.relay_log_space_limit= 7;
SET @@session.slave_load_tmpdir= 'x';
SET @@global.slave_load_tmpdir= 'x';
SET @@session.slave_skip_errors= 7;
SET @@global.slave_skip_errors= 7;
SET GLOBAL max_allowed_packet=2048;
SET GLOBAL net_buffer_length=4096;
SET GLOBAL max_allowed_packet=default;
SET GLOBAL net_buffer_length=default;
set @my_binlog_cache_size         =@@global.binlog_cache_size;
set @my_connect_timeout           =@@global.connect_timeout;
set @my_delayed_insert_timeout    =@@global.delayed_insert_timeout;
set @my_delayed_queue_size        =@@global.delayed_queue_size;
set @my_flush                     =@@global.flush;
set @my_flush_time                =@@global.flush_time;
set @my_key_buffer_size           =@@global.key_buffer_size;
set @my_max_binlog_cache_size     =@@global.max_binlog_cache_size;
set @my_max_binlog_size           =@@global.max_binlog_size;
set @my_max_connect_errors        =@@global.max_connect_errors;
set @my_max_connections           =@@global.max_connections;
set @my_max_delayed_threads       =@@global.max_delayed_threads;
set @my_max_heap_table_size       =@@global.max_heap_table_size;
set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
set @my_max_join_size             =@@global.max_join_size;
set @my_max_user_connections      =@@global.max_user_connections;
set @my_myisam_data_pointer_size  =@@global.myisam_data_pointer_size;
set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size;
set @my_net_buffer_length         =@@global.net_buffer_length;
set @my_net_write_timeout         =@@global.net_write_timeout;
set @my_net_read_timeout          =@@global.net_read_timeout;
set @my_server_id                 =@@global.server_id;
set @my_slow_launch_time          =@@global.slow_launch_time;
set @my_storage_engine            =@@global.default_storage_engine;
set @my_thread_cache_size         =@@global.thread_cache_size;
set @my_max_allowed_packet        =@@global.max_allowed_packet;
set @my_delay_key_write           =@@global.delay_key_write;
set @my_join_buffer_size          =@@global.join_buffer_size;
set @my_log_warnings               =@@global.log_warnings;
# MXSTODO qc_sqlite can not parse quoted variables.
# MXSTODO set @`test`=1;
set @TEST=2;
# MXSTODO qc_sqlite can not parse quoted variables.
# MXSTODO set @"tEST"=3;
# MXSTODO qc_sqlite can not parse quoted variables.
# MXSTODO set @`TeST`=4;
set @select=2,@t5=1.23456;
set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
set @test_int="hellohello",@test_double="hellohello",@test_string="hellohello",@test_string2="hellohello";
set @test_int=null,@test_double=null,@test_string=null,@test_string2=null;
set GLOBAL max_join_size=10;
set max_join_size=100;
set GLOBAL max_join_size=2000;
set max_join_size=DEFAULT;
set GLOBAL max_join_size=DEFAULT;
set @@max_join_size=1000, @@global.max_join_size=2000;
set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
set global concurrent_insert=2;
set global concurrent_insert=1;
set global concurrent_insert=0;
set global concurrent_insert=DEFAULT;
set global timed_mutexes=ON;
set global timed_mutexes=0;
set default_storage_engine=MYISAM, default_storage_engine="HEAP", global default_storage_engine="MERGE";
set GLOBAL myisam_max_sort_file_size=2000000;
set GLOBAL myisam_max_sort_file_size=default;
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
set global net_buffer_length=1;
set global net_buffer_length=2000000000;
set character set cp1251_koi8;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
set @@range_alloc_block_size=1024*15+1024;
set @@query_alloc_block_size=1024*15+1024*2;
set @@query_prealloc_size=1024*18-1024;
set @@transaction_alloc_block_size=1024*21-1024*1;
set @@transaction_prealloc_size=1024*21-2048;
set @@range_alloc_block_size=1024*16+1023;
set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18-1023;
set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
set big_tables=OFFF;
set big_tables="OFFF";
set unknown_variable=1;
set max_join_size="hello";
set default_storage_engine=UNKNOWN_TABLE_TYPE;
set default_storage_engine=MERGE, big_tables=2;
set character_set_client=UNKNOWN_CHARACTER_SET;
set collation_connection=UNKNOWN_COLLATION;
set character_set_client=NULL;
set collation_connection=NULL;
set @@version='';
set @@concurrent_insert=1;
set myisam_max_sort_file_size=100;
set @@SQL_WARNINGS=NULL;
set autocommit=1;
set big_tables=1;
set global binlog_cache_size=100;
set bulk_insert_buffer_size=100;
set character set cp1251_koi8;
set character set default;
set @@global.concurrent_insert=1;
set global connect_timeout=100;
set global delay_key_write="OFF";
set global delay_key_write=ALL;
set global delay_key_write=1;
set global delayed_insert_limit=100;
set global delayed_insert_timeout=100;
set global delayed_queue_size=100;
set global flush=1;
set global flush_time=100;
set insert_id=1;
set interactive_timeout=100;
set join_buffer_size=100;
set last_insert_id=1;
set global local_infile=1;
set long_query_time=0.000001;
set long_query_time=100.000001;
set low_priority_updates=1;
set global max_allowed_packet=100;
set global max_binlog_cache_size=100;
set global max_binlog_size=100;
set global max_connect_errors=100;
set global max_connections=100;
set global max_delayed_threads=100;
set max_heap_table_size=100;
set max_join_size=100;
set max_sort_length=100;
set global max_user_connections=100;
set global max_write_lock_count=100;
set myisam_sort_buffer_size=100;
set global net_buffer_length=100;
set net_read_timeout=100;
set net_write_timeout=100;
set read_buffer_size=100;
set read_rnd_buffer_size=100;
set global server_id=100;
set global slow_launch_time=100;
set sort_buffer_size=100;
set @@max_sp_recursion_depth=10;
set @@max_sp_recursion_depth=0;
set sql_auto_is_null=1;
set @@sql_auto_is_null=0;
set sql_big_selects=1;
set sql_buffer_result=1;
set sql_log_bin=1;
set sql_log_off=1;
set sql_quote_show_create=1;
set sql_safe_updates=1;
set sql_select_limit=1;
set sql_select_limit=default;
set sql_warnings=1;
set global table_open_cache=100;
set default_storage_engine=myisam;
set global thread_cache_size=100;
set timestamp=1, timestamp=default;
set tmp_table_size=1024;
set tx_isolation="READ-COMMITTED";
set wait_timeout=100;
set log_warnings=1;
set global log_warnings=1;
set @save_insert_id=@@session.insert_id;
set session insert_id=20;
set session last_insert_id=100;
set @@session.insert_id=@save_insert_id;
set global key_buffer_size=100000;
set ft_boolean_syntax = @@init_connect;
set global ft_boolean_syntax = @@init_connect;
set init_connect = NULL;
set global init_connect = NULL;
set ft_boolean_syntax = @@init_connect;
set global ft_boolean_syntax = @@init_connect;
set global myisam_max_sort_file_size=4294967296;
set global myisam_max_sort_file_size=default;
set @svc=@@global.max_user_connections, @svj=@@local.max_join_size;
set @@global.max_user_connections=111,@@local.max_join_size=222;
set @@global.max_user_connections=@@local.max_join_size,@@local.max_join_size=@@global.max_user_connections;
set @@global.max_user_connections=@svc, @@local.max_join_size=@svj;
set @a=1, @b=2;
set @a=@b, @b=@a;
set @@global.global.key_buffer_size= 1;
set GLOBAL global.key_buffer_size= 1;
set @tstlw = @@log_warnings;
set global log_warnings = 0;
set global log_warnings = 42;
set global log_warnings = @tstlw;
set @arg00= 8, @arg01= 8.8, @arg02= 'a string', @arg03= 0.2e0;
SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
SET GLOBAL table_open_cache=-1;
SET GLOBAL table_open_cache=DEFAULT;
set character_set_results=NULL;
set names latin1;
set @@lc_time_names='ru_ru';
set @lc='JA_JP';
set @@lc_time_names=@lc;
set lc_time_names=concat('de','_','DE');
set lc_time_names=concat('de','+','DE');
set @@lc_time_names=1+2;
set @@lc_time_names=1/0;
set lc_time_names=en_US;
set lc_time_names=NULL;
set lc_time_names=-1;
set lc_time_names=110;
set lc_time_names=111;
set lc_time_names=0;
set @@global.lc_time_names=fr_FR;
set @@lc_time_names=ru_RU;
set lc_time_names=default;
set @@global.lc_time_names=default;
set @@lc_time_names=default;
set @test = @@query_prealloc_size;
set @@query_prealloc_size = @test;
set global sql_mode=repeat('a',80);
set @@warning_count=1;
set @@global.error_count=1;
set @@max_heap_table_size= 4294967296;
set global max_heap_table_size= 4294967296;
set @@max_heap_table_size= 4294967296;
set global character_set_system = latin1;
set @@global.version_compile_os='234';
set character_set_filesystem=latin1;
set @@global.character_set_filesystem=latin2;
set character_set_filesystem=latin1;
set @@global.character_set_filesystem=latin2;
set character_set_filesystem=default;
set @@global.character_set_filesystem=default;
set @old_sql_big_selects = @@sql_big_selects;
set @@sql_big_selects = 1;
set @@sql_big_selects = @old_sql_big_selects;
set @@sql_notes = 0, @@sql_warnings = 0;
set @@sql_notes = 1, @@sql_warnings = 1;
set sort_buffer_size=1024*8;
set @@hostname= "anothername";
SET @@myisam_mmap_size= 500M;
SET TIMESTAMP=2*1024*1024*1024;
SET TIMESTAMP=DEFAULT;
set join_buffer_size=1;
set @save_join_buffer_size=@@join_buffer_size;
set join_buffer_size=@save_join_buffer_size;
set global binlog_cache_size         =@my_binlog_cache_size;
set global connect_timeout           =@my_connect_timeout;
set global delayed_insert_timeout    =@my_delayed_insert_timeout;
set global delayed_queue_size        =@my_delayed_queue_size;
set global flush                     =@my_flush;
set global flush_time                =@my_flush_time;
set global key_buffer_size           =@my_key_buffer_size;
set global max_binlog_cache_size     =@my_max_binlog_cache_size;
set global max_binlog_size           =@my_max_binlog_size;
set global max_connect_errors        =@my_max_connect_errors;
set global max_connections           =@my_max_connections;
set global max_delayed_threads       =@my_max_delayed_threads;
set global max_heap_table_size       =@my_max_heap_table_size;
set global max_insert_delayed_threads=@my_max_insert_delayed_threads;
set global max_join_size             =@my_max_join_size;
set global max_user_connections      =@my_max_user_connections;
set global max_write_lock_count      =default;
set global myisam_data_pointer_size  =@my_myisam_data_pointer_size;
set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
set global net_buffer_length         =@my_net_buffer_length;
set global net_write_timeout         =@my_net_write_timeout;
set global net_read_timeout          =@my_net_read_timeout;
set global server_id                 =@my_server_id;
set global slow_launch_time          =@my_slow_launch_time;
set global default_storage_engine            =@my_storage_engine;
set global thread_cache_size         =@my_thread_cache_size;
set global max_allowed_packet        = default;
set global delay_key_write           =@my_delay_key_write;
set global join_buffer_size          =@my_join_buffer_size;
set global log_warnings              =@my_log_warnings;
SET GLOBAL log_output = '';
SET GLOBAL log_output = 0;
SET @@session.ft_max_word_len= 7;
SET @@global.ft_max_word_len= 7;
SET @@session.ft_min_word_len= 7;
SET @@global.ft_min_word_len= 7;
SET @@session.ft_query_expansion_limit= 7;
SET @@global.ft_query_expansion_limit= 7;
SET @@session.ft_stopword_file= 'x';
SET @@global.ft_stopword_file= 'x';
SET @@session.back_log= 7;
SET @@global.back_log= 7;
SET @@session.large_files_support= true;
SET @@global.large_files_support= true;
SET @@session.character_sets_dir= 'x';
SET @@global.character_sets_dir= 'x';
SET @@session.init_file= 'x';
SET @@global.init_file= 'x';
SET @@session.lc_messages_dir= 'x';
SET @@global.lc_messages_dir= 'x';
SET @@session.large_page_size= 7;
SET @@global.large_page_size= 7;
SET @@session.large_pages= true;
SET @@global.large_pages= true;
SET @@session.log_bin= true;
SET @@global.log_bin= true;
SET @@session.log_error= 'x';
SET @@global.log_error= 'x';
SET @@session.lower_case_file_system= true;
SET @@global.lower_case_file_system= true;
SET @@session.lower_case_table_names= 7;
SET @@global.lower_case_table_names= 7;
SET @@session.myisam_recover_options= 'x';
SET @@global.myisam_recover_options= 'x';
SET @@session.open_files_limit= 7;
SET @@global.open_files_limit= 7;
SET @@session.pid_file= 'x';
SET @@global.pid_file= 'x';
SET @@session.plugin_dir= 'x';
SET @@global.plugin_dir= 'x';
SET @@session.port= 7;
SET @@global.port= 7;
SET @@session.protocol_version= 7;
SET @@global.protocol_version= 7;
SET @@session.skip_external_locking= true;
SET @@global.skip_external_locking= true;
SET @@session.skip_networking= true;
SET @@global.skip_networking= true;
SET @@session.skip_show_database= true;
SET @@global.skip_show_database= true;
SET @@session.thread_stack= 7;
SET @@global.thread_stack= 7;
SET GLOBAL expire_logs_days = -1;
SET GLOBAL expire_logs_days = 11;
SET @old_mode=@@sql_mode;
SET SESSION sql_mode = 'TRADITIONAL';
SET GLOBAL expire_logs_days = 100;
SET SESSION sql_mode = @old_mode;
SET GLOBAL expire_logs_days = 100;
SET GLOBAL expire_logs_days = 11;
SET GLOBAL expire_logs_days = 99;
SET GLOBAL expire_logs_days = @old_eld;
SET GLOBAL auto_increment_offset=-1;
SET GLOBAL auto_increment_offset=0;
SET @old_server_id = @@GLOBAL.server_id;
SET GLOBAL server_id = (1 << 32) - 1;
SET GLOBAL server_id = (1 << 32);
SET GLOBAL server_id = (1 << 60);
SET GLOBAL server_id = 0;
SET GLOBAL server_id = -1;
SET GLOBAL server_id = @old_server_id;
SET @old_max_binlog_cache_size = @@GLOBAL.max_binlog_cache_size;
SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024;
SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size;
SET @kbs=@@global.key_buffer_size;
SET @kcbs=@@global.key_cache_block_size;
SET SQL_MODE=STRICT_ALL_TABLES;
SET @@global.max_binlog_cache_size=-1;
SET @@global.max_join_size=0;
SET @@global.key_buffer_size=0;
SET @@global.key_cache_block_size=0;
SET SQL_MODE=DEFAULT;
SET @@global.max_binlog_cache_size=-1;
SET @@global.max_join_size=0;
SET @@global.key_buffer_size=0;
SET @@global.key_cache_block_size=0;
SET @@global.max_binlog_cache_size=DEFAULT;
SET @@global.max_join_size=DEFAULT;
SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs;
set @a=NULL;
set sql_buffer_result=0;
set sql_buffer_result=1;
set sql_buffer_result=0;
SET @sql_notes_saved = @@sql_notes;
SET @@sql_notes = ON;
SET @@sql_notes = OF;
SET @@sql_notes = OFF;
SET @@sql_notes = @sql_notes_saved;
SET @delay_key_write_saved = @@delay_key_write;
SET GLOBAL delay_key_write = ON;
SET GLOBAL delay_key_write = OF;
SET GLOBAL delay_key_write = AL;
SET GLOBAL delay_key_write = OFF;
SET GLOBAL delay_key_write = ALL;
SET GLOBAL delay_key_write = @delay_key_write_saved;
SET @sql_safe_updates_saved = @@sql_safe_updates;
SET @@sql_safe_updates = ON;
SET @@sql_safe_updates = OF;
SET @@sql_safe_updates = OFF;
SET @@sql_safe_updates = @sql_safe_updates_saved;
SET @foreign_key_checks_saved = @@foreign_key_checks;
SET @@foreign_key_checks = ON;
SET @@foreign_key_checks = OF;
SET @@foreign_key_checks = OFF;
SET @@foreign_key_checks = @foreign_key_checks_saved;
SET @unique_checks_saved = @@unique_checks;
SET @@unique_checks = ON;
SET @@unique_checks = OF;
SET @@unique_checks = OFF;
SET @@unique_checks = @unique_checks_saved;
SET @sql_buffer_result_saved = @@sql_buffer_result;
SET @@sql_buffer_result = ON;
SET @@sql_buffer_result = OF;
SET @@sql_buffer_result = OFF;
SET @@sql_buffer_result = @sql_buffer_result_saved;
SET @sql_quote_show_create_saved = @@sql_quote_show_create;
SET @@sql_quote_show_create = ON;
SET @@sql_quote_show_create = OF;
SET @@sql_quote_show_create = OFF;
SET @@sql_quote_show_create = @sql_quote_show_create_saved;
set sql_mode="";
set sql_mode=default;
set @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
    @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
    @@session.autocommit=t1_min(), @@session.autocommit=t1_max();
set session character_set_results = 2048;
set session character_set_client=2048;
set session character_set_connection=2048;
set session character_set_server=2048;
set session collation_server=2048;
set session character_set_filesystem=2048;
set session character_set_database=2048;
set session collation_connection=2048;
set session collation_database=2048;
set session rand_seed1=DEFAULT;
set autocommit = values(v);
set session sql_mode=ansi_quotes;
SET DEBUG_SYNC= 'after_cached_view_opened SIGNAL oppp WAIT_FOR created';
SET DEBUG_SYNC= 'now WAIT_FOR oppp';
SET DEBUG_SYNC= 'RESET';
SET DEBUG_SYNC= 'now SIGNAL created';
SET DEBUG_SYNC= 'RESET';
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='outer_join_with_cache=off';
set updatable_views_with_limit=NO;
set updatable_views_with_limit=YES;
set updatable_views_with_limit=DEFAULT;
set sql_mode='ansi';
set sql_mode=default;
SET @v0 = '2';
SET @v0 = '3';
SET @v0 = '4';
SET @old_cs_client = @@character_set_client;
SET @old_cs_results = @@character_set_results;
SET @old_cs_connection = @@character_set_connection;
set names utf8;
SET character_set_client = @old_cs_client;
SET character_set_results = @old_cs_results;
SET character_set_connection = @old_cs_connection;
set @arg='d';
set @arg='e';
set updatable_views_with_limit=NO;
set updatable_views_with_limit=DEFAULT;
set @a= 10;
set @b= 100;
set @a= 300;
set @b= 10;
set @a= 100;
set @a= 300;
set @a= 101;
set @a= 301;
set sql_mode='strict_all_tables';
set sql_mode=default;
set @parm1=1;
SET SQL_MODE = STRICT_ALL_TABLES;
SET SQL_MODE = '';
set GLOBAL sql_mode="";
set LOCAL sql_mode="";
set GLOBAL sql_mode=default;
set LOCAL sql_mode=default;
set @old_mode=@@sql_mode;
set @@sql_mode=traditional;
set @@sql_mode=@old_mode;
SET collation_connection = latin1_general_ci;
SET names latin1;
SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on';
SET optimizer_switch = 'derived_merge=off';
SET optimizer_switch=@save_optimizer_switch_MDEV_3914;
SET @save_optimizer_switch_MDEV_3874=@@optimizer_switch;
SET optimizer_switch = 'materialization=on,semijoin=on';
SET optimizer_switch=@save_optimizer_switch_MDEV_3874;
SET optimizer_switch=@save_optimizer_switch;
SET @@global.wait_timeout= 2;
SET SESSION wait_timeout=100;
SET @aborted_clients= 0;
SET @aborted_clients= 0;
SET SESSION debug_dbug="+d,warn_during_ha_commit_trans";
set sql_mode="";
set sql_mode=default;
SET SQL_WARNINGS=1;
set SQL_WARNINGS=1;
set SQL_WARNINGS=0;
set sql_warnings=1;
set sql_warnings=0;
set max_error_count=10;
set max_error_count=0;
set max_error_count=65535;
set max_error_count=10;
set @c = repeat(' ', 256);
set @q = repeat('q', 256);
set sql_mode = '';
set sql_mode = 'traditional';
set sql_mode = default;
SET binlog_format= mixed;
SET SESSION autocommit=0;
SET SESSION autocommit=1;
SET SESSION autocommit=1;
SET @a=(SELECT * FROM t1);
SET @a=(SELECT * FROM t1); # used to cause InnoDB assert
SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
SET @xml='<a>a11<b ba="ba11" ba="ba12">b11</b><b ba="ba21" ba="ba22">b21<c>c1</c>b22</b>a12</a>';
SET @xml='<a><b>b</b><c>c</c></a>';
SET @xml='<a><b>b1</b><c>c1</c><b>b2</b><c>c2</c></a>';
SET @xml='<a><b x="xb1" x="xb2"/><c x="xc1" x="xc2"/></a>';
SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</b></c></a>';
SET @xml='<a><b>b1</b><b>b2</b></a>';
SET @xml='<a><b>b11<c>c11</c></b><b>b21<c>c21</c></b></a>';
SET @xml='<a><b c="c11">b11</b><b c="c21">b21</b></a>';
SET @xml='<a>a1<b c="c11">b11<d>d11</d></b><b c="c21">b21<d>d21</d></b></a>';
SET @xml='<a>ab<b c="c" c="e">b1</b><b c="d">b2</b><b c="f" c="e">b3</b></a>';
SET @xml='<a><b c="c" d="d">b1</b><b d="d" e="e">b2</b></a>';
SET @xml='<a><b c="c">b1</b><b>b2</b></a>';
SET @xml='<a b="11" b="12" b="21" b="22">ab</a>';
SET @xml='<a><b>b1</b><b>b2</b></a>';
SET @xml='<a b="b11" b="b12" b="b21" b="22"/>';
SET @xml='<a>a1<b>b1<c>c1</c>b2</b>a2</a>';
SET @xml='<a><b>bb</b></a>';
SET @xml='<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>';
SET @xml= '<order><clerk>lesser wombat</clerk></order>';
set names utf8;
set @xml= "<entry><id>pt10</id><pt>10</pt></entry><entry><id>pt50</id><pt>50</pt></entry>";
set @i=1;
set @i=2;
set @i=NULL;
SET @i='1';
SET @i='1 and string';
SET @i='string and 1';
SET @i='string';
SET @xml=
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> 
 <head>
  <title> Title - document with document declaration</title>
 </head> 
  <body> Hi, Im a webpage with document a declaration </body> 
</html>';
set @x=10;
SET NAMES utf8;
SET NAMES latin1;
set @save_storage_engine= @@storage_engine;
set storage_engine=InnoDB;
set @innodb_mrr_tmp=@@optimizer_switch;
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
set storage_engine= @save_storage_engine;
set @mrr_buffer_size_save= @@mrr_buffer_size;
set mrr_buffer_size=64;
set @@mrr_buffer_size= @mrr_buffer_size_save;
set @save_join_cache_level= @@join_cache_level;
set @save_optimizer_switch= @@optimizer_switch;
SET SESSION join_cache_level=9;
SET SESSION optimizer_switch='mrr_sort_keys=off';
set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
set @my_save_join_cache_level= @@join_cache_level;
SET join_cache_level = 0;
SET join_cache_level = 6;
set join_cache_level= @my_save_join_cache_level;
set @my_save_join_cache_level= @@join_cache_level;
SET join_cache_level=6;
SET join_cache_level=0;
set join_cache_level= @my_save_join_cache_level;
set @my_save_join_cache_level= @@join_cache_level;
set @my_save_join_buffer_size= @@join_buffer_size;
set join_cache_level=6;
set join_buffer_size=1536;
set join_cache_level=@my_save_join_cache_level;
set join_buffer_size=@my_save_join_buffer_size;
set @bug665669_tmp=@@optimizer_switch;
set optimizer_switch='mrr=off';
set optimizer_switch = @bug665669_tmp;
set @_save_join_cache_level= @@join_cache_level;
set join_cache_level = 6;
set join_cache_level=@_save_join_cache_level;
set optimizer_switch= @innodb_mrr_tmp;
#
# test of updating of keys
#

-- source include/have_innodb.inc

--disable_warnings
drop table if exists t1,t2;
--enable_warnings

create table t1 (a int auto_increment , primary key (a));
insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); 
update t1 set a=a+10 where a > 34;
update t1 set a=a+100 where a > 0;

# Some strange updates to test some otherwise unused code
update t1 set a=a+100 where a=1 and a=2;
--error 1054
update t1 set a=b+100 where a=1 and a=2; 
--error 1054
update t1 set a=b+100 where c=1 and a=2; 
--error 1054
update t1 set d=a+100 where a=1;
select * from t1;
drop table t1;

CREATE TABLE t1
 (
 place_id int (10) unsigned NOT NULL,
 shows int(10) unsigned DEFAULT '0' NOT NULL,
 ishows int(10) unsigned DEFAULT '0' NOT NULL,
 ushows int(10) unsigned DEFAULT '0' NOT NULL,
 clicks int(10) unsigned DEFAULT '0' NOT NULL,
 iclicks int(10) unsigned DEFAULT '0' NOT NULL,
 uclicks int(10) unsigned DEFAULT '0' NOT NULL,
 ts timestamp,
 PRIMARY KEY (place_id,ts)
 );

INSERT INTO t1 (place_id,shows,ishows,ushows,clicks,iclicks,uclicks,ts)
VALUES (1,0,0,0,0,0,0,20000928174434);
UPDATE t1 SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclicks+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00";
select place_id,shows from t1;
drop table t1;

#
# Test bug with update reported by Jan Legenhausen
#

CREATE TABLE t1 (
  lfdnr int(10) unsigned NOT NULL default '0',
  ticket int(10) unsigned NOT NULL default '0',
  client varchar(255) NOT NULL default '',
  replyto varchar(255) NOT NULL default '',
  subject varchar(100) NOT NULL default '',
  timestamp int(10) unsigned NOT NULL default '0',
  tstamp timestamp NOT NULL,
  status int(3) NOT NULL default '0',
  type varchar(15) NOT NULL default '',
  assignment int(10) unsigned NOT NULL default '0',
  fupcount int(4) unsigned NOT NULL default '0',
  parent int(10) unsigned NOT NULL default '0',
  activity int(10) unsigned NOT NULL default '0',
  priority tinyint(1) unsigned NOT NULL default '1',
  cc varchar(255) NOT NULL default '',
  bcc varchar(255) NOT NULL default '',
  body text NOT NULL,
  comment text,
  header text,
  PRIMARY KEY  (lfdnr),
  KEY k1 (timestamp),
  KEY k2 (type),
  KEY k3 (parent),
  KEY k4 (assignment),
  KEY ticket (ticket)
) ENGINE=MyISAM;

INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');

alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
update t1 set status=1 where type='Open';
select status from t1;
drop table t1;

#
# Test of ORDER BY
#

create table t1 (a int not null, b int not null, key (a));
insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
SET @tmp=0;
update t1 set b=(@tmp:=@tmp+1) order by a;
update t1 set b=99 where a=1 order by b asc limit 1;
select * from t1 order by a,b;
update t1 set b=100 where a=1 order by b desc limit 2;
# MXS: update t1 set a=a+10+b where a=1 order by b;
# MXS: qc_get_affected_fields   : ERR: a != a b
# MXS: qc_mysqlembedded does not report "b".
select * from t1 order by a,b;
create table t2 (a int not null, b int not null);
insert into t2 values (1,1),(1,2),(1,3);
update t1 set b=(select distinct 1 from (select * from t2) a);

drop table t1,t2;

#
# Test with limit (Bug #393)
#

CREATE TABLE t1 (
   `id_param` smallint(3) unsigned NOT NULL default '0',
   `nom_option` char(40) NOT NULL default '',
   `valid` tinyint(1) NOT NULL default '0',
   KEY `id_param` (`id_param`,`nom_option`)
 ) ENGINE=MyISAM;

INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);

UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1;
select * from t1;
drop table t1;

#
# Multi table update test from bugs
#

create table t1 (F1 VARCHAR(30), F2 VARCHAR(30), F3 VARCHAR(30), cnt int, groupid int, KEY groupid_index (groupid));

insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
('2','2','0',1,7);
delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
select * from t1;
drop table t1;

#
# Bug#5553 - Multi table UPDATE IGNORE fails on duplicate keys 
#

CREATE TABLE t1 ( 
   `colA` int(10) unsigned NOT NULL auto_increment,
   `colB` int(11) NOT NULL default '0',
   PRIMARY KEY  (`colA`)
);
INSERT INTO t1 VALUES (4433,5424);
CREATE TABLE t2 (
  `colC` int(10) unsigned NOT NULL default '0',
  `colA` int(10) unsigned NOT NULL default '0',
  `colD` int(10) unsigned NOT NULL default '0',
  `colE` int(10) unsigned NOT NULL default '0',
  `colF` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`colC`,`colA`,`colD`,`colE`)
);
INSERT INTO t2 VALUES (3,4433,10005,495,500);
INSERT INTO t2 VALUES (3,4433,10005,496,500);
INSERT INTO t2 VALUES (3,4433,10009,494,500);
INSERT INTO t2 VALUES (3,4433,10011,494,500);
INSERT INTO t2 VALUES (3,4433,10005,497,500);
INSERT INTO t2 VALUES (3,4433,10013,489,500);
INSERT INTO t2 VALUES (3,4433,10005,494,500);
INSERT INTO t2 VALUES (3,4433,10005,493,500);
INSERT INTO t2 VALUES (3,4433,10005,492,500);
UPDATE IGNORE t2,t1 set t2.colE = t2.colE + 1,colF=0 WHERE t1.colA = t2.colA AND (t1.colB & 4096) > 0 AND (colE + 1) < colF;
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;

#
# Bug #6054 
#
create table t1 (c1 int, c2 char(6), c3 int);
create table t2 (c1 int, c2 char(6));
insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
drop table t1, t2;

#
# Bug #8057
#
create table t1 (id int not null auto_increment primary key, id_str varchar(32));
insert into t1 (id_str) values ("test");
update t1 set id_str = concat(id_str, id) where id = last_insert_id();
select * from t1;
drop table t1;

#
# Bug #8942: a problem with update and partial key part
#

create table t1 (a int, b char(255), key(a, b(20)));
insert into t1 values (0, '1');
update t1 set b = b + 1 where a = 0;
select * from t1;
drop table t1;

# BUG#9103 "Erroneous data truncation warnings on multi-table updates"
create table t1 (a int, b varchar(10), key b(b(5))) engine=myisam;
create table t2 (a int, b varchar(10)) engine=myisam;
insert into t1 values ( 1, 'abcd1e');
insert into t1 values ( 2, 'abcd2e');
insert into t2 values ( 1, 'abcd1e');
insert into t2 values ( 2, 'abcd2e');
analyze table t1,t2;
update t1, t2 set t1.a = t2.a where t2.b = t1.b;
show warnings;
drop table t1, t2;

#
# Bug #11868 Update with subquery with ref built with a key from the updated
#            table crashes server
#
create table t1(f1 int, f2 int);
create table t2(f3 int, f4 int);
create index idx on t2(f3);
insert into t1 values(1,0),(2,0);
insert into t2 values(1,1),(2,2);
UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
select * from t1;
drop table t1,t2;

#
# Bug #13180 sometimes server accepts sum func in update/delete where condition
#
create table t1(f1 int);
select DATABASE();
--error 1111
update t1 set f1=1 where count(*)=1;
select DATABASE();
--error 1111
delete from t1 where count(*)=1;
drop table t1;

# BUG#12915: Optimize "DELETE|UPDATE ... ORDER BY ... LIMIT n" to use an index
create table t1 ( a int, b int default 0, index (a) );
insert into t1 (a) values (0),(0),(0),(0),(0),(0),(0),(0);

flush status;
select a from t1 order by a limit 1;
show status like 'handler_read%';

flush status;
update t1 set a=9999 order by a limit 1;
update t1 set b=9999 order by a limit 1;
show status like 'handler_read%';

flush status;
delete from t1 order by a limit 1;
show status like 'handler_read%';

flush status;
delete from t1 order by a desc limit 1;
show status like 'handler_read%';

alter table t1 disable keys;

flush status;
delete from t1 order by a limit 1;
show status like 'handler_read%';

select * from t1;
update t1 set a=a+10,b=1 order by a limit 3;
update t1 set a=a+11,b=2 order by a limit 3;
update t1 set a=a+12,b=3 order by a limit 3;
select * from t1 order by a;

drop table t1;

#
# Bug#14186 select datefield is null not updated
#
create table t1 (f1 date not null);
insert into t1 values('2000-01-01'),('0000-00-00');
update t1 set f1='2002-02-02' where f1 is null;
select * from t1;
drop table t1;

#
# Bug#15028 Multitable update returns different numbers of matched rows
#           depending on table order
create table t1 (f1 int);
create table t2 (f2 int);
insert into t1 values(1),(2);
insert into t2 values(1),(1);
--enable_info
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
--disable_info
update t2 set f2=1;
update t1 set f1=1 where f1=3;
--enable_info
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
--disable_info
drop table t1,t2;


# BUG#15935
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
flush status;
update t2 set a=3 where a=2;
show status like 'handler_read%';
drop table t1, t2;

#
# Bug #16510 Updating field named like '*name' caused server crash
#
create table t1(f1 int, `*f2` int);
insert into t1 values (1,1);
update t1 set `*f2`=1;
drop table t1;

#
# Bug#25126: Wrongly resolved field leads to a crash
#
create table t1(f1 int);
--error 1054
update t1 set f2=1 order by f2;
drop table t1;
# End of 4.1 tests

#
# Bug #24035: performance degradation with condition int_field=big_decimal
#

CREATE TABLE t1 (
  request_id int unsigned NOT NULL auto_increment,
  user_id varchar(12) default NULL,
  time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
  ip_address varchar(15) default NULL,
  PRIMARY KEY (request_id),
  KEY user_id_2 (user_id,time_stamp)
);

INSERT INTO t1 (user_id) VALUES ('user1');
INSERT INTO t1(user_id) SELECT user_id FROM t1;
INSERT INTO t1(user_id) SELECT user_id FROM t1;
INSERT INTO t1(user_id) SELECT user_id FROM t1;
INSERT INTO t1(user_id) SELECT user_id FROM t1;
INSERT INTO t1(user_id) SELECT user_id FROM t1;
INSERT INTO t1(user_id) SELECT user_id FROM t1;
INSERT INTO t1(user_id) SELECT user_id FROM t1;
INSERT INTO t1(user_id) SELECT user_id FROM t1;

flush status;
SELECT user_id FROM t1 WHERE request_id=9999999999999; 
show status like '%Handler_read%';
SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999; 
show status like '%Handler_read%';
UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
show status like '%Handler_read%';
UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
show status like '%Handler_read%';

DROP TABLE t1;

#
# Bug #24010: INSERT INTO ... SELECT fails on unique constraint with data it 
# doesn't select
#
CREATE TABLE t1 (

  a INT(11),
  quux decimal( 31, 30 ),

  UNIQUE KEY bar (a),
  KEY quux (quux)
);

INSERT INTO
 t1 ( a, quux )
VALUES
    ( 1,    1 ),
    ( 2,  0.1 );

INSERT INTO t1( a )
  SELECT @newA := 1 + a FROM t1 WHERE quux <= 0.1;

SELECT * FROM t1;

DROP TABLE t1;

#
# Bug #22364: Inconsistent "matched rows" when executing UPDATE
#

connect (con1,localhost,root,,test);
connection con1;

set tmp_table_size=1024;

# Create the test tables
create table t1 (id int, a int, key idx(a));
create table t2 (id int unsigned not null auto_increment primary key, a int);
insert into t2(a) values(1),(2),(3),(4),(5),(6),(7),(8);
insert into t2(a) select a from t2; 
insert into t2(a) select a from t2;
insert into t2(a) select a from t2; 
# MXS: update t2 set a=id;
# MXS: qc_get_affected_fields   : ERR: a != a id
# MXS: qc_mysqlembedded does not consider "id" to be an affected field.
insert into t1 select * from t2;

# Check that the number of matched rows is correct when the temporary
# table is small enough to not be converted to MyISAM
select count(*) from t1 join t2 on (t1.a=t2.a);
--enable_info
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
--disable_info

# Increase table sizes
insert into t2(a) select a from t2; 
# MXS: update t2 set a=id;
# MXS: qc_get_affected_fields   : ERR: a != a id
# MXS: qc_mysqlembedded does not consider "id" an affected field.
truncate t1; 
insert into t1 select * from t2; 

# Check that the number of matched rows is correct when the temporary
# table has to be converted to MyISAM
select count(*) from t1 join t2 on (t1.a=t2.a);
--enable_info
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
--disable_info

# Check that the number of matched rows is correct when there are duplicate
# key errors
update t1 set a=1;
update t2 set a=1;
select count(*) from t1 join t2 on (t1.a=t2.a);
--enable_info
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
--disable_info

drop table t1,t2;

connection default;
disconnect con1;

#
# Bug #40745: Error during WHERE clause calculation in UPDATE
#             leads to an assertion failure
#
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS f1;
--enable_warnings

CREATE FUNCTION f1() RETURNS INT RETURN f1();
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);

--error ER_SP_NO_RECURSION
UPDATE t1 SET i = 3 WHERE f1();
--error ER_SP_NO_RECURSION
UPDATE t1 SET i = f1();

DROP TABLE t1;
DROP FUNCTION f1;

--echo End of 5.0 tests

--echo #
--echo # Bug #47919 assert in open_table during ALTER temporary table
--echo #

CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
CREATE TEMPORARY TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);

ALTER TABLE t2 COMMENT = 'ABC';
UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
ALTER TABLE t2 COMMENT = 'DEF';

DROP TABLE t1, t2;

--echo #
--echo # Bug#50545: Single table UPDATE IGNORE crashes on join view in
--echo # sql_safe_updates mode.
--echo #
CREATE TABLE t1 ( a INT, KEY( a ) );
INSERT INTO t1 VALUES (0), (1);
CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12;
SET SESSION sql_safe_updates = 1;

--error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
UPDATE IGNORE v1 SET a = 1;

SET SESSION sql_safe_updates = DEFAULT;
DROP TABLE t1;
DROP VIEW v1;

--echo #
--echo # Bug#54734 assert in Diagnostics_area::set_ok_status
--echo #

--disable_warnings
DROP TABLE IF EXISTS t1, not_exists;
DROP FUNCTION IF EXISTS f1;
DROP VIEW IF EXISTS v1;
--enable_warnings

CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk;
CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists);
CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13;
--error ER_VIEW_INVALID
UPDATE v1 SET pk = 7 WHERE pk > 0;

DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;

--echo # Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE INCORRECT
--echo #                RESULTS

CREATE TABLE t1 (a VARCHAR(50), b TEXT, c CHAR(50)) ENGINE=INNODB;

INSERT INTO t1 (a, b, c) VALUES ('start trail', '', 'even longer string');
UPDATE t1 SET b = a, a = 'inject';
SELECT a, b FROM t1;
UPDATE t1 SET b = c, c = 'inject';
SELECT c, b FROM t1;

DROP TABLE t1;

--echo #
--echo # MDEV-3948 Assertion `records_are_comparable(table)' fails in compare_record(const TABLE*) on UPDATE with simple AND condition, index_merge+index_merge_intersection, InnoDB
--echo #
--echo # Verify that UPDATE does the same number of handler_update
--echo # operations, no matter if there is ORDER BY or not.
--echo #

CREATE TABLE t1 (i INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
                      (20),(21),(22),(23),(24),(25),(26),(27),(28),(29),
                      (30),(31),(32),(33),(34),(35);
CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2),
                 INDEX idx (a,b(1),c)) ENGINE=INNODB;
INSERT INTO t2 SELECT i, i, i, i FROM t1;
FLUSH STATUS; # FLUSH is autocommit, so we put it outside of transaction
START TRANSACTION;
UPDATE t2 SET d = 10 WHERE b = 10 LIMIT 5;
SHOW STATUS LIKE 'HANDLER_UPDATE';
ROLLBACK;
FLUSH STATUS;
START TRANSACTION;
UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
SHOW STATUS LIKE 'HANDLER_UPDATE';
ROLLBACK;

--echo Same test with a different UPDATE.

ALTER TABLE t2 DROP INDEX idx, ADD INDEX idx2 (a, b);
FLUSH STATUS;
START TRANSACTION;
UPDATE t2 SET c = 10 LIMIT 5;
SHOW STATUS LIKE 'HANDLER_UPDATE';
ROLLBACK;
FLUSH STATUS;
START TRANSACTION;
UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
SHOW STATUS LIKE 'HANDLER_UPDATE';
ROLLBACK;
DROP TABLE t1, t2;

--echo #
--echo # MDEV-8938: Server Crash on Update with joins
--echo #

CREATE TABLE `t1` (
  `name` varchar(255) NOT NULL,
  `value` varchar(4095) DEFAULT NULL,
  PRIMARY KEY (`name`)
);

UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";

drop table t1;

CREATE TABLE `t1` (
  `name` varchar(255) NOT NULL,
  `value` varchar(4095) DEFAULT NULL,
  PRIMARY KEY (`name`)
);

create table t2 (
  `name` varchar(255) NOT NULL,
  `value` varchar(4095) DEFAULT NULL,
  PRIMARY KEY (`name`)
);

UPDATE t1
SET value = (SELECT value FROM t2 WHERE `name`= t1.name) 
WHERE value is null ;

drop table t1,t2;

--echo #
--echo #MDEV-8701: Crash on derived query
--echo #

CREATE TABLE t1 (
  data_exit_entry_id int(11) NOT NULL,
  data_entry_id int(11) NOT NULL,
  data_entry_exit_id int(11) NOT NULL,
  data_exit_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;

CREATE TABLE t2 (
  data_entry_id int(11) NOT NULL,
  data_entry_cost double NOT NULL,
  data_entry_quantity double NOT NULL
) DEFAULT CHARSET=utf8;

create  algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost 
          FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;

UPDATE t2 
SET data_entry_cost
  = ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
	FROM 
        v1 AS query 
        WHERE data_entry_exit_id = t2.data_entry_id
      )
    );

UPDATE t2 
SET data_entry_cost
  = ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
	FROM 
        ( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost 
          FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query 
        WHERE data_entry_exit_id = t2.data_entry_id
      )
    );

drop view v1;
drop table t1, t2; 
--echo #
--echo # MDEV-4410: update does not want to use a covering index, but select uses it.
--echo #
create table t2(a int);
insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

create table t1 (key1 int, col1 int, key(key1));
insert into t1
select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;

--echo # This must not have "Using filesort":
explain 
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;

flush status;
update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
# Handler_read_next should be 1 (due to LIMIT), not 100:
show status like 'Handler_read%';

drop table t1, t2;

--echo # End of MariaDB 10.0 tests
