How to use postgres connection string that has query params with ecto?


How do you use a connection_string (url config param) that has query params?
Like this one: postgres://xxxx:xxxx@xxxx:5432/xxxxx?param_name=xxxx ?

It seems like it is not passed.


Maybe, ecto://xxxx:xxxx@xxxx:5432/xxxxx?param_name=xxxx?

A code snippet from Ecto:

  @doc """
  Parses an Ecto URL allowed in configuration.

  The format must be:


  def parse_url(""), do: []

  def parse_url(url) when is_binary(url) do
    info = URI.parse(url)

I think the scheme is just ignored.

@benonymus what is param_name meant to configure? If you want to configure postgres connection parameters they’re nested by an additional :parameters key:

config :my_app, MyApp.Repo, parameters: [application_name: "my_app"]
1 Like

It is supposed to be application_name.
I tried this but did not seem to work for me.

That config line is out of a production app where this is working.

Oh I see.
Thank you!

It seems like it is a problem with polyscale then.
Would you happen to know how could I pass channel_binding=false?
We are trying to come up with an example project to point people to.