Closed FaveroFerreira closed 12 months ago
Tokio Postgres hangs when running CREATE DATABASE query. awaiting it never returns.
CREATE DATABASE
awaiting
In this example I am using simple_query, but it also happens with execute and query methods.
simple_query
execute
query
All other queries works fine.
tokio-postgres = { version = "0.7.8", features = ["with-uuid-1", "with-chrono-0_4", "with-serde_json-1"] }
async fn seed_database(db_config: &PostgresConfig) { let without_db = format!( "postgres://{}:{}@{}:{}/postgres", db_config.username.expose_secret(), db_config.password.expose_secret(), db_config.host, 5432 ); let (client, _conn) = tokio_postgres::connect(&without_db, tokio_postgres::NoTls) .await .expect("Failed to connect to Postgres"); client .simple_query(&format!("CREATE DATABASE \"{}\"", db_config.database)) .await .expect("Failed to create database"); // .... }
rustc --version
Don't ignore conn.
conn
Tried it, sadly it behaves the same.
What is "it"? What are you doing with conn?
Sorry for the late response, I realised I was not spawning the conn to a separate thread. My bad.
Bug Description
Tokio Postgres hangs when running
CREATE DATABASE
query.awaiting
it never returns.In this example I am using
simple_query
, but it also happens withexecute
andquery
methods.All other queries works fine.
Minimal Reproduction
Info
rustc --version
: rustc 1.71.0 (8ede3aae2 2023-07-12)