We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
on
Variables cannot be bound in the on clause of an Ecto.Query join:
one = 1 Repo.all( from u in User, left_join: staff in assoc(u, :staff), on: 1 == ^one, select: u.id )
Error:
** (ArgumentError) parameters must be of length 1 for query %Postgrex.Query{columns: ["id"], copy_data: false, decoders: [#Function<8.109917431/1 in Postgrex.Types.decoder/2>], encoders: [#Function<9.109917431/1 in Postgrex.Types.encoder/2>], name: "ecto_31925", null: nil, param_formats: [:binary], param_info: [{23, %Postgrex.TypeInfo{array_elem: 0, base_type: 0, comp_elems: [], input: "int4in", oid: 23, output: "int4out", receive: "int4recv", send: "int4send", type: "int4"}, Postgrex.Extensions.Int4}], ref: #Reference<0.0.5.5707>, result_formats: [:binary], result_info: [{2950, %Postgrex.TypeInfo{array_elem: 0, base_type: 0, comp_elems: [], input: "uuid_in", oid: 2950, output: "uuid_out", receive: "uuid_recv", send: "uuid_send", type: "uuid"}, Postgrex.Extensions.UUID}], statement: "SELECT u0.\"id\" FROM \"users\" AS u0 LEFT OUTER JOIN \"staff\" AS s1 ON (s1.\"user_id\" = u0.\"id\") AND (1 = $1)", types: 14135761} [debug] QUERY ERROR source="users" db=2.0ms SELECT u0."id" FROM "users" AS u0 LEFT OUTER JOIN "staff" AS s1 ON (s1."user_id" = u0."id") AND (1 = $1) [] (postgrex) lib/postgrex/query.ex:78: DBConnection.Query.Postgrex.Query.encode/3 (db_connection) lib/db_connection.ex:859: DBConnection.describe_execute/4 (db_connection) lib/db_connection.ex:930: anonymous fn/4 in DBConnection.run_meter/5 (db_connection) lib/db_connection.ex:987: DBConnection.run_begin/3 (db_connection) lib/db_connection.ex:463: DBConnection.prepare_execute/4 (ecto) lib/ecto/adapters/postgres/connection.ex:78: Ecto.Adapters.Postgres.Connection.prepare_execute/5 (ecto) lib/ecto/adapters/sql.ex:235: Ecto.Adapters.SQL.sql_call/6 (ecto) lib/ecto/adapters/sql.ex:424: Ecto.Adapters.SQL.execute_and_cache/7 (ecto) lib/ecto/repo/queryable.ex:127: Ecto.Repo.Queryable.execute/5 (ecto) lib/ecto/repo/queryable.ex:40: Ecto.Repo.Queryable.all/4
A successful query (:happy panda:), or a better error message (:sad panda:).
I know we can use fragments, but this current error is confusing and unexpected. Would love to see this improved!
The text was updated successfully, but these errors were encountered:
6022e9d
You're amazing.
❤️
Sorry, something went wrong.
Pass join parameters on assoc with :on forward, closes elixir-ecto#1678
111b789
No branches or pull requests
Environment
Current behavior
Variables cannot be bound in the
on
clause of an Ecto.Query join:Error:
Expected behavior
A successful query (:happy panda:), or a better error message (:sad panda:).
I know we can use fragments, but this current error is confusing and unexpected. Would love to see this improved!
The text was updated successfully, but these errors were encountered: