为什么我在 Elixir Ecto 查询中得到"unsupported :except_all in keyword query expression"?



这个 Ecto 查询工作:

bid_players = from a in Auction,
where: a.id == 1,
join: bids in assoc(a, :bids),
join: player in assoc(bids, :player),
select: player.id

此查询有效:

players = from player in Player,
where: player.year_range == ^a.year_range,
select: player.id

但是我不知道如何得到不是出价玩家的玩家。当我尝试这个时:

not_bid_players = from player in Player,
where: player.year_range == ^a.year_range,
select: player.id,
except_all: ^bid_players

。我得到:

** (Ecto.Query.CompileError) unsupported :except_all in keyword query expression
(ecto) expanding macro: Ecto.Query.from/2
iex:35: (file)

我想except_all(见 https://hexdocs.pm/ecto/Ecto.Query.html#except_all/2(有些我不明白的地方。

except_all

被添加到 Ecto 3 中。
phoenix_ecto需要达到 4.0 才能使用 Ecto 3+,看起来您需要升级。

最新更新