-- Works fine with MySQL 8.0.2 Alpha	=>	Resultset 1
-- Doesn't work with MariaDB 10.2.7		=>	Message: SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<in_optimizer>(1,<exists>(select max(1))) then 1 end AS `testcase`) `testalias`' at line 1

USE test;

SET @sql_query = "

	CREATE OR REPLACE VIEW testview AS
	
		SELECT * FROM (
					SELECT CASE WHEN 1 IN (SELECT max(1)) THEN TRUE END AS testcase
		) testalias

";

PREPARE stmt FROM @sql_query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

SELECT * FROM testview;