Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions test/ecto/adapters/exqlite/connection_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1225,13 +1225,16 @@ defmodule Ecto.Adapters.Exqlite.ConnectionTest do
|> from(update: [set: [x: 0], inc: [y: 1, z: -3]])
|> plan(:update_all)

# TODO: should probably be "y = s0.y + 1"
# table-name.column-name is not allowed on the left hand side of SET
# but is allowed on right hand side, and we should err towards being more explicit
assert update_all(query) ==
"""
UPDATE schema AS s0 \
SET \
x = 0, \
y = s0.y + 1, \
z = s0.z + -3\
y = y + 1, \
z = z + -3\
"""

query =
Expand All @@ -1255,14 +1258,15 @@ defmodule Ecto.Adapters.Exqlite.ConnectionTest do

query =
Schema
|> join(:inner, [p], q in Schema2, on: p.x == q.z)
|> update([_], set: [x: 0])
|> plan(:update_all)

assert update_all(query) ==
"""
UPDATE schema AS s0 \
SET \
s0.x = 0 \
x = 0 \
FROM schema2 AS s1 \
WHERE (s0.x = s1.z)\
"""
Expand Down