Skip to content

[Errno -2] Name or service not known #471

Closed
@2ik

Description

@2ik
  • asyncpg version: 0.18.3
  • PostgreSQL version: 11
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    :
  • Python version: 3.7
  • Platform: Linux Mint
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: Yes
  • If you built asyncpg locally, which version of Cython did you use?:
  • Can the issue be reproduced under both asyncio and
    uvloop?
    :

There was a similar question #467

I found a problem when connecting a pool with dsn transfer.

if the @ symbol is present in the password, then an error appears: [Errno -2] Name or service not known
if replaced by %40 then an access error password authentication failed for user "user_db"

Will give an example better:

# error:
dsn = 'postgresql://{user}:{pwd}@{host}:{port}/{database}'.format(
    host=config.DB_HOST,
    port=config.DB_PORT,
    user=config.DB_USER,
    pwd=config.DB_PASS, # passw@123
    database=config.DB_NAME
)

conn = await asyncpg.create_pool(dsn)

# successfully
conn = await asyncpg.create_pool(
    host=config.DB_HOST,
    port=config.DB_PORT,
    database=config.DB_NAME,
    user=config.DB_USER,
    password=config.DB_PASS # passw@123
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions