Skip to content

Commit

Permalink
improvement: support {:unsafe_fragment, ".."} as a conflict target
Browse files Browse the repository at this point in the history
this is supported by other sql data layers, for example. This is necessary for AshSqlite3's upsert behavior.
Postgres adapter implementation: https://github.com/elixir-ecto/ecto_sql/blob/v3.10.2/lib/ecto/adapters/postgres/connection.ex#L212C4-L213C26
  • Loading branch information
zachdaniel committed Oct 10, 2023
1 parent f9fdfa5 commit d03824e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ecto/adapters/sqlite3/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,9 @@ defmodule Ecto.Adapters.SQLite3.Connection do

defp conflict_target([]), do: ""

defp conflict_target({:unsafe_fragment, fragment}),
do: [fragment, ?\s]

defp conflict_target(targets) do
[?(, intersperse_map(targets, ?,, &quote_name/1), ?), ?\s]
end
Expand Down

0 comments on commit d03824e

Please sign in to comment.