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

Argument error in parse_version #368

Closed
angelikatyborska opened this issue Feb 9, 2018 · 5 comments
Closed

Argument error in parse_version #368

angelikatyborska opened this issue Feb 9, 2018 · 5 comments

Comments

@angelikatyborska
Copy link

In the official Docker image postgres:10.2, my Ecto application failes to start or execute any mix task due to an argument error:

$ mix ecto.drop
15:56:25.597 [error] GenServer #PID<0.288.0> terminating
** (ArgumentError) argument error
    (postgrex) lib/postgrex/utils.ex:69: anonymous fn/1 in Postgrex.Utils.parse_version/1
    (elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
    (elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
    (postgrex) lib/postgrex/utils.ex:69: Postgrex.Utils.parse_version/1
    (postgrex) lib/postgrex/protocol.ex:642: Postgrex.Protocol.bootstrap_send/6
    (postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
    (db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Schemas.Repo couldn't be dropped: an exception was raised:
    ** (ArgumentError) argument error
        (postgrex) lib/postgrex/utils.ex:69: anonymous fn/1 in Postgrex.Utils.parse_version/1
        (elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
        (elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
        (postgrex) lib/postgrex/utils.ex:69: Postgrex.Utils.parse_version/1
        (postgrex) lib/postgrex/protocol.ex:642: Postgrex.Protocol.bootstrap_send/6
        (postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
        (db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
        (connection) lib/connection.ex:622: Connection.enter_connect/5
        (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

I have checked that the string that Postgrex.Utils.parse_version tries to parse is "10.2 (Debian 10.2-1.pgdg90+1)".

I also noticed this difference between the new and some older PostgreSQL Docker images:

$ docker run -ti postgres:9.5.10 /bin/sh
# psql --version
psql (PostgreSQL) 9.5.10
$ docker run -ti postgres:10 /bin/sh
# psql --version
psql (PostgreSQL) 10.2 (Debian 10.2-1.pgdg90+1)
@josevalim
Copy link
Member

HI @angelikatyborska! We have just backported a fix for this in the v0.13 branch, can you try it out for now and let us know how it goes? Thank you!

@angelikatyborska
Copy link
Author

Oh, I did not notice that! I only looked through open and closed issues.

Yes, I confirm that the fix on branch v0.13 works for me.

 defp deps do
    [
      {:ecto, "~> 2.0"},
      {:postgrex, git: "https://github.com/elixir-ecto/postgrex", branch: "v0.13", override: true},
      # ...
    ]
  end

👍

@kulshekhar
Copy link

Ran into this issue an hour ago and can confirm this fix worked for me as well.

Some additional info in case it helps - the setup worked fine without the fix but broke after my system received upgrades for Postgres (among others)

1

@josevalim
Copy link
Member

Since many people are running into this I will ship a new version still today. :)

@josevalim
Copy link
Member

Done!

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

No branches or pull requests

3 participants