Skip to content

Commit 2325197

Browse files
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.
1 parent 93d3240 commit 2325197

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spec/mysql2/client_spec.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,15 @@ def connect *args
232232
it "should > 0" do
233233
# "the statement produces extra information that can be viewed by issuing a SHOW WARNINGS"
234234
# http://dev.mysql.com/doc/refman/5.0/en/explain-extended.html
235-
@client.query("explain extended select 1")
235+
begin
236+
@client.query("explain extended select 1")
237+
rescue Mysql2::Error
238+
# EXTENDED keyword is deprecated in MySQL 8.0 and triggers a syntax error
239+
# https://dev.mysql.com/doc/refman/5.7/en/explain-extended.html
240+
# "extended output is now enabled by default, so the EXTENDED keyword is superfluous and
241+
# deprecated ... and it will be removed from EXPLAIN syntax in a future MySQL release"
242+
@client.query("explain select 1")
243+
end
236244
@client.warning_count.should > 0
237245
end
238246
end

0 commit comments

Comments
 (0)