Closed
Description
I am using sqlx::Postgres::create_database
in my test code, which runs in parallel, and I get the following error:
Database(PgDatabaseError { severity: Error, code: "55006", message: "source database \"template1\" is being accessed by other users", detail: Some("There are 2 other sessions using the database."), hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("dbcommands.c"), line: Some(528), routine: Some("createdb") })'
This is caused by this line of code. I am not familiar with postgres internals, but reading code from the createdb
: /* No point in trying to use postgres db when creating postgres db. */
, it seems like we only need to switch to template1
when the database name is postgres
, not when the user is postgres
.
Metadata
Metadata
Assignees
Labels
No labels