Skip to content

The connection URL ?application_name= param can't be parsed. #160

@pylead

Description

@pylead

The sqlalchemy connection URL like postgresql://user:[email protected]:6666/db?application_name=app can not be parsed correctly because of the regexp:

/^postgres(?:ql)?:\/\/([^:]*):([^@]*)@(.*?):(.*?)\/(.*?)$/'

This leads to an error like:

ERROR: database "db?application_name=app" does not exist

Optional query parameters should be ignored during the connection URL parsing.

See also:

application_name (string)
The application_name can be any string of less than NAMEDATALEN characters (64 characters in a standard build). It is typically set by an application upon connection to the server. The name will be displayed in the pg_stat_activity view and included in CSV log entries. It can also be included in regular log entries via the log_line_prefix parameter. Only printable ASCII characters may be used in the application_name value. Other characters will be replaced with question marks (?).
https://www.postgresql.org/docs/14/runtime-config-logging.html#GUC-APPLICATION-NAME

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