--disable_abort_on_error --disable_warnings DROP TABLE IF EXISTS t1, t2; DROP VIEW IF EXISTS v1; DROP FUNCTION IF EXISTS func1; DROP FUNCTION IF EXISTS func2; --enable_warnings CREATE TABLE t1 (f1 SMALLINT, PRIMARY KEY(f1)); INSERT INTO t1 SET f1 = 1; CREATE TABLE t2 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT); INSERT INTO t2 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1; CREATE FUNCTION func2() RETURNS BIGINT RETURN 1; # A simplified FUNCTION # - no INFORMATION_SCHEMA table or # - RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS); # removes the crash # Crashing SELECTs # RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS); delimiter //; CREATE FUNCTION func1() RETURNS BIGINT BEGIN RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS); END// delimiter ;// # A simplified VIEW (function outside of subquery) removes the crash CREATE VIEW v1 AS SELECT 1 FROM t2 WHERE f3 = (SELECT func2 ()); SELECT 1 FROM t2 WHERE f3 = (SELECT func2 ()); # The next two SELECTs are harmless SELECT * FROM v1; SELECT 1; # This produces the crash SELECT func1(); # Cleanup DROP TABLE IF EXISTS t1, t2; DROP VIEW IF EXISTS v1; DROP FUNCTION IF EXISTS func1; DROP FUNCTION IF EXISTS func2;