Skip to content

explain extended select 1 is not a valid statement since MySQL 8.0.3 #893

@yahonda

Description

@yahonda

CI for #892 shows some failures. One of them is below:

$ bundle exec rspec ./spec/mysql2/client_spec.rb:328
Run options: include {:locations=>{"./spec/mysql2/client_spec.rb"=>[328]}}

Randomized with seed 11457

Mysql2::Client
  #warning_count
    when has a warnings
      should > 0 (FAILED - 1)

Failures:

  1) Mysql2::Client#warning_count when has a warnings should > 0
     Failure/Error: _query(sql, @query_options.merge(options))

     Mysql2::Error:
       You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select 1' at line 1
     # ./lib/mysql2/client.rb:120:in `_query'
     # ./lib/mysql2/client.rb:120:in `block in query'
     # ./lib/mysql2/client.rb:119:in `handle_interrupt'
     # ./lib/mysql2/client.rb:119:in `query'
     # ./spec/mysql2/client_spec.rb:331:in `block (4 levels) in <top (required)>'

Finished in 0.0126 seconds (files took 0.18505 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/mysql2/client_spec.rb:328 # Mysql2::Client#warning_count when has a warnings should > 0

Randomized with seed 11457

$

This is likely due to
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-3.html

The deprecated EXTENDED and PARTITIONS keywords for the EXPLAIN statement have been removed. These keywords are unnecessary because their effect is always enabled.

It also reproduces using mysql command line without mysql2 gem.

$ mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2463
Server version: 8.0.3-rc-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> explain extended select 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select 1' at line 1
mysql>

I have not found other sql statements showing warning in MySQL 8.0.3 yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions