Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior when connecting to database -> Database username is used as database name. #823

Closed
KharchenkoDmitriy opened this issue Sep 6, 2021 · 1 comment · Fixed by #847

Comments

@KharchenkoDmitriy
Copy link

KharchenkoDmitriy commented Sep 6, 2021

database = user

In documentation it is said:

If not specified, the value parsed from the dsn argument is used, or the value of the PGDATABASE environment variable, or the operating system name of the user running the application.

But in fact if database username is provided but database is not, database user name is used instead of system username.

Also why not just use postgres as default value instead of username?

asyncpg version ==0.24.0
postgres: docker image postgres:13-alpine, at the moment it use version 13.4
python version ==3.8

@elprans
Copy link
Member

elprans commented Nov 7, 2021

Yes, the docs are slightly incorrect, I'll make an edit.

Also why not just use postgres as default value instead of username?

For compatibility, asyncpg follows the behavior of libpq which underpins most other PostgreSQL bindings.

elprans added a commit that referenced this issue Nov 7, 2021
The docs incorrectly claim that the `database` argument defaults to
the OS username, whereas in fact, the computed value of the `user`
argument is used.

Fixes: #823.
elprans added a commit that referenced this issue Nov 16, 2021
The docs incorrectly claim that the `database` argument defaults to
the OS username, whereas in fact, the computed value of the `user`
argument is used.

Fixes: #823.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants