Skip to content

Default database fails if username is not postgres. #1

@Dunedubby

Description

@Dunedubby

First off, this crate is great and exactly what we needed for our tests. Definitely happy to help maintain it going forward, or maybe to help merge it with the main sqlx codebase.

So for the issue: if the username is not postgres (I think quite common in some managed DB cloud offerings), then this will use the username as the database on which CREATE DATABASE is called. Many times, this database will not exist.

It seems that more consistent solution would be to just use postgres as the default CREATE DATABASE context, and then maybe have the option of using something else if an environment variable, e.g. DEFAULT_DATABASE_NAME, is supplied.

I've created a fork with this change. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions