From 23251972a6615f2e2cd8df4f5993da2888d27bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Thu, 25 Apr 2019 18:15:07 +0200 Subject: [PATCH] Fix broken spec due to EXPLAIN EXTENDED on MySQL 8 The behavior that used to be triggered by EXPLAIN EXTENDED has been the default for a long time and the previously deprecated EXTENDED keyword was finally removed in MySQL 8.0. To avoid breaking the spec on very old MySQL versions we just catch the SQL syntax error and retry without the EXTENDED keyword. --- spec/mysql2/client_spec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/mysql2/client_spec.rb b/spec/mysql2/client_spec.rb index 5a443b228..5a1b45d4b 100644 --- a/spec/mysql2/client_spec.rb +++ b/spec/mysql2/client_spec.rb @@ -232,7 +232,15 @@ def connect *args it "should > 0" do # "the statement produces extra information that can be viewed by issuing a SHOW WARNINGS" # http://dev.mysql.com/doc/refman/5.0/en/explain-extended.html - @client.query("explain extended select 1") + begin + @client.query("explain extended select 1") + rescue Mysql2::Error + # EXTENDED keyword is deprecated in MySQL 8.0 and triggers a syntax error + # https://dev.mysql.com/doc/refman/5.7/en/explain-extended.html + # "extended output is now enabled by default, so the EXTENDED keyword is superfluous and + # deprecated ... and it will be removed from EXPLAIN syntax in a future MySQL release" + @client.query("explain select 1") + end @client.warning_count.should > 0 end end