DROP DATABASE IF EXISTS database0;
CREATE DATABASE database0;
USE database0;

CREATE OR REPLACE TABLE t0(c0 CHAR(100));
CREATE OR REPLACE TABLE t1(c0 CHAR(100) UNIQUE);
SET SESSION join_cache_level = 7;
REPAIR TABLE t1, t0 QUICK EXTENDED;
INSERT INTO t0 VALUES ('%S');
INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES ('*');
INSERT INTO t0 VALUES ('');
INSERT INTO t1 VALUES ('\r');

SELECT "------------";
SELECT t0.c0 FROM t0 NATURAL JOIN t1 WHERE TRUE RLIKE t1.c0;
SELECT "------------";
SET STATEMENT optimizer_switch = 'join_cache_bka=off' FOR SELECT t0.c0 FROM t0 NATURAL JOIN t1 WHERE TRUE RLIKE t1.c0;
SELECT "------------";
