DROP DATABASE IF EXISTS dbtest;
CREATE DATABASE dbtest;
USE dbtest;

CREATE TABLE t0(c0 VARCHAR(100), PRIMARY KEY(c0));
CREATE TABLE t1 LIKE t0;
CREATE TABLE t2 LIKE t1;
CREATE TABLE t3(c0 VARCHAR(100));
CREATE TABLE t4(c0 CHAR(100), c1 VARCHAR(100));


INSERT INTO t3 VALUES ('');
INSERT INTO t0 VALUES ('2069165959');
INSERT INTO t0 VALUES ('');

INSERT INTO t1 VALUES ('6lnm9');
INSERT INTO t0 VALUES ('	G');
SET SESSION join_cache_level = 4;
INSERT INTO t3 VALUES ('kmWIL5');
INSERT INTO t2 VALUES ('');


select version(),  @@version_source_revision;
SELECT "---------------- join_cache_hashed=on";
SET STATEMENT optimizer_switch = 'join_cache_hashed=on' FOR SELECT t3.c0 IS NULL, HEX(t3.c0), t2.c0 IS NULL, HEX(t2.c0) FROM t1, t3, t0 NATURAL JOIN t2 WHERE ('2002684482' REGEXP t0.c0);
SELECT "---------------- join_cache_hashed=off";
SET STATEMENT optimizer_switch = 'join_cache_hashed=off' FOR SELECT t3.c0 IS NULL, HEX(t3.c0), t2.c0 IS NULL, HEX(t2.c0) FROM t1, t3, t0 NATURAL JOIN t2 WHERE ('2002684482' REGEXP t0.c0);
SELECT "----------------";
