Skip to content

--connection-url doesn't handle URI-encoded password #436

@keithlayne

Description

@keithlayne

Looks like here:

que/lib/que/locker.rb

Lines 147 to 156 in 17fb2c3

uri = URI.parse(connection_url)
opts =
{
host: uri.host,
user: uri.user,
password: uri.password,
port: uri.port || 5432,
dbname: uri.path[1..-1],
}

I'm trying to use this arg for the first time, and I end up getting a password failure. Is there another way I can provide this option? PG urls allow escaping special chars in the password, and this isn't working.

Actually, with a little experimentation, it really looks like PG::Connection.open is fully capable of parsing connection strings, without the URI.parse step. It appears that it handles both postgres:// URLs and connection strings like user=... password=... host=... dbname=....

So, AFAICT, the connection url option ought to be passed directly to PG::Connection.open.

I do see this, but I don't understand what it's for (I will check the docs):

que/lib/que/locker.rb

Lines 189 to 194 in 17fb2c3

unless connection_args.has_key?(:application_name)
@connection.execute(
"SELECT set_config('application_name', $1, false)",
["Que Locker: #{@connection.backend_pid}"]
)
end

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