Skip to content

fix(mysql): decode MySQL 9 VECTOR columns (type 0xf2) - #4441

Merged
abonander merged 1 commit into
transact-rs:mainfrom
anderson-andres-dev:mysql-vector
Oct 3, 2026
Merged

abonander merged 1 commit into
transact-rs:mainfrom
anderson-andres-dev:mysql-vector

Conversation

@anderson-andres-dev

Copy link
Copy Markdown
Contributor

Adds MySQL 9's VECTOR column type (0xf2) to sqlx-mysql, so result sets with a vector column can be read.

Does your PR solve an issue?

fixes #4440

Is this a breaking change?

No. ColumnType is pub(crate). Queries that failed with "unknown column type 0xf2" now return rows; nothing that worked before changes.

What changes

  • ColumnType::Vector = 0xf2, decoded in try_from_u16 and named VECTOR.
  • Binary protocol rows: a vector value is length-encoded like blobs and strings (the server sends it as float32 values, little-endian).
  • [u8]/Vec<u8> are compatible with VECTOR, so a vector can be decoded as its raw bytes; through any.rs that also makes it an AnyTypeInfoKind::Blob.

There is no Rust type for vectors here: decoding them into something like Vec<f32> could be a follow-up if wanted.

Tests

  • Regression test decodes_a_mysql_9_vector_column in protocol/text/column.rs: it decodes a column definition of type 0xf2. It fails before this change with unknown column type 0xf2 and passes after it.
  • No integration test in tests/mysql: CI runs MySQL 8, which has no VECTOR type. I checked by hand against MySQL 9.0.1 and 9.7.2, with both protocols: SELECT * on a table with a VECTOR(3) column, SELECT STRING_TO_VECTOR('[1,2,3]'), and a prepared statement with a parameter. In the last one, the vector arrives as its 12 bytes and the column after it is read correctly.

@abonander
abonander merged commit aefa420 into transact-rs:main Oct 3, 2026
147 checks passed
anderson-andres-dev pushed a commit to anderson-andres-dev/rowly-db that referenced this pull request Oct 3, 2026
Rowly deja de depender de anderson-andres-dev/sqlx (rev df7b880): se quita
[patch.crates-io] y los 6 crates de sqlx vuelven a la 0.8.6 de crates.io.
La 0.8.6 publicada no lee el tipo 0xf2 (transact-rs/sqlx#4441 a煤n no est谩
en una release), as铆 que las lecturas de VECTOR de MySQL 9 llevan
"-- gap:" y version_lines exige que sigan fallando con ese error. D8 pasa a
parcial y SQL_ENGINE 搂9 suma el P2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MySQL 9 VECTOR columns fail with "unknown column type 0xf2"

2 participants