Skip to content

Upgrading sqlx 0.8 to 0.9

Breaking0.8.6 → 0.9.0Breaking28Platform2New23Changed23Fixed42Other20

BreakingUpgrade verdict

27 breaking changes and 2 platform requirement changes.

  • Installing the CLI with the --locked flag will fail; install without it or keep your own lockfile.
  • Removes the lifetime from `PgAdvisoryLockGuard`.
  • If you enabled combined runtime and TLS features, switch to separate runtime and TLS features.
  • Removes the re-export of the unstable `TransactionManager` trait from `sqlx`.
Top 5 of 29 that need code or config changes

Requires Rust 1.94.0 from 0.9.0 (none stated before).

Breaking27
Makes cargo install --locked sqlx-cli no longer work after Cargo.lock removal.
cargo install --locked sqlx-clicargo install sqlx-cli
Removes the lifetime from PgAdvisoryLockGuard.
PgAdvisoryLockGuard
Deletes deprecated combination runtime+TLS features such as runtime-tokio-native-tls.
runtime-tokio-native-tls
Removes the re-export of the unstable TransactionManager trait from sqlx.
TransactionManager
SET NAMES utf8mb4 is sent by default instead of SET NAMES utf8mb4 COLLATE utf8_general_ci, letting the server pick the default collation.
SQLite no longer borrows bound values and the lifetime on SqliteArguments is deleted.
SqliteArguments
Removes the lifetime parameter from AnyArguments.
AnyArguments
Removes the lifetime parameter from the Arguments trait.
Arguments
#[derive(sqlx::Type)] now automatically generates impl PgHasArrayType by default for newtype structs.
#[derive(sqlx::Type)]PgHasArrayType#[sqlx(no_pg_array)]
Changes the Migrate trait significantly and hides sqlx::migrate::resolve_blocking().
Migratesqlx::migrate::resolve_blocking()
Corrects spelling of the aquired_after_secs tracing field to acquired_after_secs.
aquired_after_secsacquired_after_secs
Makes Migrator::set_ignore_missing and set_locking return &mut Self instead of &Self.
Migrator::set_ignore_missingMigrator::set_locking
Forces generic plans in Postgres, which may change query!() macro output for some queries.
query!()
Adds a DB type parameter to all methods of RawSql.
RawSql
Implements Decode, Encode and Type for Box, Arc, Cow and Rc, changing Cow decoding.
DecodeEncodeTypeBoxArcCowRc
Adds SqlStr so query*() functions take impl SqlSafeStr, requiring AssertSqlSafe for non-static strings.
SqlStrSqlSafeStrAssertSqlSafequery*()Query<'static, DB>
Automatically escapes options passed to PgConnectOptions::options().
PgConnectOptions::options()
MySQL now assumes all non-binary collations are compatible with str, inferring text columns as String instead of Vec<u8>.
RawSql::fetch_optional() now returns sqlx::Result<Option<DB::Row>> instead of sqlx::Result<DB::Row>.
RawSql::fetch_optional()
libsqlite3-sys version is now specified using a range, with the maximum increasable in backwards-compatible releases.
libsqlite3-sys
SQLite extension loading, including via the new sqlx-toml feature, is now unsafe.
sqlx-toml
SqliteValue is now !Sync and SqliteValueRef is !Send to prevent data races from concurrent accesses.
SqliteValueSqliteValueRef
Moves PgLTree::from to a From<Vec<PgLTreeLabel>> implementation.
PgLTree::fromFrom<Vec<PgLTreeLabel>>PgLTreeLabel
PostgreSQL passfile passwords now process backslash-escapes, which may change the password sent to the server.
Makes the offline feature optional to allow building without serde.
offlineserde
Adds mysql-rsa feature for non-TLS RSA auth; connections requiring RSA password encryption need it or fail at runtime.
mysql-rsa
Correctly converts text and blob types to AnyTypeInfo for any and MySQL drivers.
AnyTypeInfo
Platform2
Raises the supported Rust version (MSRV) for this release cycle to 1.94.0.
Increases MSRV to 1.86 and sets rust-version.
rust-version