Skip to content

Commit 8313b99

Browse files
committed
some SQL syntax does not pass a table prefix (atom or string)
in the case of `create_name`, then third param may be a string or atom prefix ... and in those cases should be treated as a prefix. however syntax such as `VALUES (...)` will pass in the values list information as the third tuple. this was causing spurious exceptions to be thrown, rather than creating the correct table name
1 parent c32929c commit 8313b99

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/ecto/adapters/sqlite3/connection.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,10 +1909,12 @@ defmodule Ecto.Adapters.SQLite3.Connection do
19091909

19101910
defp quote_table(nil, name), do: quote_entity(name)
19111911

1912-
defp quote_table(_prefix, _name) do
1912+
defp quote_table(prefix, _name) when is_atom(prefix) or is_binary(prefix) do
19131913
raise ArgumentError, "SQLite3 does not support table prefixes"
19141914
end
19151915

1916+
defp quote_table(_, name), do: quote_entity(name)
1917+
19161918
defp quote_entity(val) when is_atom(val) do
19171919
quote_entity(Atom.to_string(val))
19181920
end

0 commit comments

Comments
 (0)