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

Missing encoder for float8 #123

Closed
almassapargali opened this issue Dec 2, 2015 · 2 comments
Closed

Missing encoder for float8 #123

almassapargali opened this issue Dec 2, 2015 · 2 comments

Comments

@almassapargali
Copy link

Hello, I'm using earthdistance module for querying users by coordinates, and I'm getting this error when passing String. If I convert input to float or integer myself and query, then all is good. Here is the log:

Request: GET /users/nearby?longitude=42.6&latitude=12.3
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Postgrex.Extensions.Binary.encode/4
        (postgrex) lib/postgrex/extensions/binary.ex:59: Postgrex.Extensions.Binary.encode(%Postgrex.TypeInfo{array_elem: 0, base_type: 0, comp_elems: [], input: "float8in", oid: 701, output: "float8out", receive: "float8recv", send: "float8send", type: "float8"}, "12.3", 901179, {9, 4, 5})

I wanted to fix this myself, and send PR, but not that good in binary << :: :D >> stuff yet, sorry 😄

@josevalim
Copy link
Member

It is not about a missing encoder. You are sending a string to a float or integer column, then Postgres is giving up because it doesn't know how you would parse that. I believe converting it to integer or float is the way to go. :)

@almassapargali
Copy link
Author

Oh sorry, just ecto was handling my other string to int conversions well, so I though float one is missing.

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

2 participants