Skip to content

Upgrading sqlx 0.7 to 0.8

Breaking0.7.4 → 0.8.6Breaking17Security3Deprecated1New42Changed24Fixed73Other48

BreakingUpgrade verdict

17 breaking changes and 3 security fixes.

  • Bumps syn to 2.0 and removes deprecated type ascription syntax in the query macros.
  • Allows rename with rename_all, changing precedence so #[sqlx(rename)] wins over #[sqlx(rename_all)].
  • Removes the Send trait bound from argument binding.
  • Replaces HasValueRef, HasArguments and HasStatement with Generic Associated Types in Database.
Top 5 of 21 that need code or config changes
Breaking17
Bumps syn to 2.0 and removes deprecated type ascription syntax in the query macros.
Allows rename with rename_all, changing precedence so #[sqlx(rename)] wins over #[sqlx(rename_all)].
sqlx(rename)sqlx(rename_all)
Removes the Send trait bound from argument binding.
Send
Replaces HasValueRef, HasArguments and HasStatement with Generic Associated Types in Database.
DatabaseHasValueRefHasArgumentsHasStatement
Fixes describe on PostgreSQL views with rules, potentially changing nullability inference for Postgres.
Implements PgHasArrayType for all references, conflicting with existing manual implementations.
PgHasArrayType
Fixes Decode and Encode derives, changing lifetime obligations for field types.
DecodeEncode
Adds Sqlite explain graph, potentially changing nullability inference for SQLite.
Makes Encode return a result.
Encode
Adds version information for failed CLI migration, with breaking changes to MigrateError.
MigrateError
Adds no-transaction migrations for Postgres and a new field to Migration.
Migration
SQLite always uses i64 as intermediate when decoding, erroring loudly on integer overflow instead of truncating.
query!()
Fixes #[derive(sqlx::Type)] in Postgres; manual PgHasArrayType impls for enums now conflict with the generated one.
sqlx::TypePgHasArrayTypePgTypeInfosqlx(no_pg_array)
Fixes handling of arrays of custom types in Postgres; PgTypeInfo::with_name() now infers names starting with _ as arrays.
PgTypeInfo::with_name()
Fixes name collision in FromRow and returns Error::ColumnDecode for TryFrom errors.
FromRowError::ColumnDecodeError::ColumnNotFoundsqlx(try_from = "T")sqlx(default)
Uses correct names for sslmode options, changing the output of ConnectOptions::to_url_lossy().
ConnectOptions::to_url_lossy()
Reorders attributes in the sqlx::test macro so attributes are applied in the correct order.
sqlx::test
Security3
Fixes RUSTSEC-2024-0363, a protocol handling vulnerability; Postgres users are advised to upgrade ASAP as an exploit has been demonstrated.
Fixes audit protocol handling, addressing RUSTSEC-2024-0363 with regression tests for MySQL, Postgres and SQLite.
Bumps rustls to 0.21.11.
rustls
Deprecated1
Deprecates misspelled MySqlConnectOptions::no_engine_subsitution() in favor of the correctly spelled version.
MySqlConnectOptions::no_engine_subsitution()MySqlConnectOptions::no_engine_substitution()