Elixir version
1.19.5
Database and Version
sqlite
Ecto Versions
3.13.5
Database Adapter and Versions (postgrex, myxql, etc)
ecto_sqlite3 0.22.0
Current behavior
Hello, It appears that the function Ecto.Adapters.SQL.table_exists? is missing a is_pid(repo) guard clause (see ecto/adapters/sql.ex), unlike other similar functions which do contain the expected guard clause - is_atom(repo) or is_pid(repo).
I have discovered this accidentally in my project which relies on dynamic repos to manage varying numbers of sqlite files on disk. The above problem incorrectly throws non-existing repo error when using the function:
def handle_continue(:setup, %{filepath: filepath} = state) do
{:ok, db} =
SqliteRepo.start_link(
database: filepath,
name: nil
)
SqliteRepo.put_dynamic_repo(db)
Ecto.Adapters.SQL.table_exists?(db, "my_tables")
# ^ this throws ** (RuntimeError) could not lookup Ecto repo nil because it was not started or it does not exist
{:noreply, state}
end
Expected behavior
Should not throw the error above (if put_dynamic_repo is called before).
I have fixed it temporarily by adding back the is_pid(repo) guard clause to the function and recompile ecto_sql locally.
Elixir version
1.19.5
Database and Version
sqlite
Ecto Versions
3.13.5
Database Adapter and Versions (postgrex, myxql, etc)
ecto_sqlite3 0.22.0
Current behavior
Hello, It appears that the function
Ecto.Adapters.SQL.table_exists?is missing ais_pid(repo)guard clause (seeecto/adapters/sql.ex), unlike other similar functions which do contain the expected guard clause -is_atom(repo) or is_pid(repo).I have discovered this accidentally in my project which relies on dynamic repos to manage varying numbers of sqlite files on disk. The above problem incorrectly throws non-existing repo error when using the function:
Expected behavior
Should not throw the error above (if
put_dynamic_repois called before).I have fixed it temporarily by adding back the
is_pid(repo)guard clause to the function and recompileecto_sqllocally.