Skip to content

MySQL Cursor drops connect when fetching a case statement #1525

@Yaytay

Description

@Yaytay

Version

4.5.14 (can't update until Resteasy does :( )

Context

When using the MySQL client to read the results of a query via a cursor, fetching some rows at a time, if the query contains a "case" statement the second fetch fails.

If the result of the case statement is cast to "signed integer" in SQL it works, but the raw case results don't.

Looking in Wireshark, the case returns a FIELD_TYPE_LONG, but the cast returns FIELD_TYPE_LONGLONG.

The simplest example I have for this is:

SELECT 
  row_number() over () as "Number"
  , case when 1 then 1 else 0 end as "Case" 
FROM 
  mysql.help_relation limit 0,100

With a cursor fetching 50 rows at a time.

Do you have a reproducer?

https://github.com/Yaytay/vertx_mysql_case_cursor/blob/main/src/test/java/uk/co/spudsoft/vmcc/MainTest.java

Steps to reproduce

Pass the result of a "case" statement to a cursor and it will fail on the second fetch.

Extra

MySQL version data:
innodb_version: 8.0.41
protocol_version: 10
version: 8.0.41
version_comment: MySQL Community Server - GPL
version_compile_machine: x86_64
version_compile_os: Linux
version_compile_zlib: 1.3.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions