diff --git a/compute_tools/src/bin/fast_import.rs b/compute_tools/src/bin/fast_import.rs index 793ec4cf10..abd746e344 100644 --- a/compute_tools/src/bin/fast_import.rs +++ b/compute_tools/src/bin/fast_import.rs @@ -189,12 +189,26 @@ pub(crate) async fn main() -> anyhow::Result<()> { format!("host=localhost port=5432 user={superuser} dbname=postgres"); loop { let res = tokio_postgres::connect(&restore_pg_connstring, tokio_postgres::NoTls).await; - if res.is_ok() { + if let Ok((client, connection)) = res { info!("postgres is ready, could connect to it"); + + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + + client + .execute("CREATE DATABASE neondb", &[]) + .await + .context("create database neondb")?; + break; } } + let restore_pg_connstring = restore_pg_connstring.replace("dbname=postgres", "dbname=neondb"); + // // Decrypt connection string //