You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
psql (14.11 (Homebrew), server 17.2)
WARNING: psql major version 14, server major version 17.
Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=>
error: error communicating with database: No such file or directory (os error 2)
--> src/run_webserver.rs:56:16
|
56 | let rows = sqlx::query!("SELECT version()")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `library` (lib) due to 1 previous error
error: `cargo check` failed with status: exit status: 101
Reproduction steps
Here's my cargo.toml
rustls = "0.23.22"
serde = { version = "1.0.217", features = ["derive"] }
sqlx = { version = "0.8.3", features = [
"chrono",
"json",
"migrate",
"postgres",
"runtime-tokio",
"tls-native-tls",
"tls-rustls",
"rust_decimal",
"uuid",
"sqlite",
] }
tokio = { version = "1.43.0", features = ["full"] }
and the code:
let database_url = env::var("DATABASE_URL").expect("Failed to get DATABASE_URL.");
let pool = PgPoolOptions::new()
.max_connections(10)
.connect(&database_url)
.await?;
let rows = sqlx::query!("SELECT version()")
.fetch_one(&pool)
.await?;
println!("Database version: {}", rows.get(0));
Ok(())
I have found these related issues/pull requests
Maybe #1716 and #1162
Description
This works:
but when I do
or
I get
Reproduction steps
Here's my cargo.toml
and the code:
SQLx version
0.8.3
Enabled SQLx features
chrono, json, migrate, postgres, runtime-tokio, tls-native-tls, tls-rustls, rust_decimal, uuid, sqlite
Database server and version
Postgres 17
Operating system
MacOS
Rust version
rustc 1.83.0 (90b35a623 2024-11-26)
The text was updated successfully, but these errors were encountered: