mysql2 icon indicating copy to clipboard operation
mysql2 copied to clipboard

Exceptions raised while streaming results do not have an error_number

Open blowfishpro opened this issue 2 years ago • 0 comments

Steps to Reproduce

  • Have a query that will take a nontrivial amount of time to send results from the server to the client
    • e.g. select x.column_name, y.table_name from information_schema.columns x cross join information_schema.tables y
  • Run the query with streaming
    • e.g. ActiveRecord::Base.connection.raw_connection.query(sql, stream: true).each {}
  • Have the streaming interrupted somehow (e.g. kill the query from the MySQL server side)
  • Inspect the resulting exception

Observed Behavior

  • The exception has no error_number

Desired Behavior

  • The exception has an error_number (in this case it would be 1317), just as if that same case were encountered while not streaming. This allows the calling code to correctly identify what went wrong.

Possibly related to #1065

blowfishpro avatar Aug 01 '22 22:08 blowfishpro