Mysql – thesql error handling stored procedure doesn’t catch error

MySQLstored-procedures

NOTE: I also tried CONTINUE instead of EXIT with same results.

I am running mysql 5.5 and am trying to create a stored procedure that sends a variable out based on if it supports full text.

delimiter //

CREATE PROCEDURE supports_ft(OUT supports_ft SMALLINT)
BEGIN
   DECLARE EXIT HANDLER FOR SQLSTATE 'HY000' SET supports_ft = 0;
    SET supports_ft = 1;
    SELECT @@innodb_ft_cache_size;
END;

The error I am getting is #1193 - Unknown system variable 'innodb_ft_cache_size'

According to https://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html

the error code is Error: 1193 SQLSTATE: HY000 (ER_UNKNOWN_SYSTEM_VARIABLE)

Best Answer

Out of the box answer:

mysql> SELECT @@version REGEXP '^5.[6789]';
+------------------------------+
| @@version REGEXP '^5.[6789]' |
+------------------------------+
|                            1 |
+------------------------------+

(Granted, it won't work forever.)