Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permit outer joins when using update_all with PostreSQL (#457)
The PostgreSQL UPDATE command permits specifying multiple 'from_item' expressions to allow columns from other tables to appear in the update expression. In particular, the documentation explains (cf. https://www.postgresql.org/docs/current/sql-update.html): > This uses the same syntax as the FROM clause of a SELECT statement Thus, a statement such as UPDATE x SET a = z.a FROM y LEFT_JOIN z ON z.i = y.i is legal. However, executing query like this this via Ecto would fail, raising an error: ** (Ecto.QueryError) PostgreSQL supports only inner joins on update_all, got: `left` in query: from x0 in "x", join: y1 in "y", on: true, left_join: z2 in "z", on: true, update: [set: [a: 1]] This PR fixes the issue by adding a `Postgres.Connection.using_join/4` clause for the :update_all case: in this scenario, at least one inner join has to be specified, but additional other joins are permissible.
- Loading branch information