Support disabling savepoints for tests

6 views
Skip to first unread message

Artem Baikov

unread,
Nov 27, 2025, 7:27:40 AM (7 days ago) Nov 27
to elixir-ecto
Hello, I'm working with AWS redshift database. I'm using Ecto.Adapters.SQL.Sandbox in tests and problem with it is that when error occurs in DB adapter tries to rollback to savepoint. The thing is that redshift database doesn't support savepoints – so DB returns error that it doesn't support savepoints and initial error is hidden. Maybe we should allow to specify for repo config that DB doesn't supports savepoints ?

How to reproduce:

1. Create any table with not nullable column in Redshift
2. Setup Ecto.Adapters.SQL.Sandbox for redshift test
3. In test try to use `Repo.insert_all` where struct has not nullable column set to nil.

DB will return error that savepoints not supported: 

(Postgrex.Error) ERROR 0A000 (feature_not_supported) SQL command "ROLLBACK TO SAVEPOINT postgrex_query" not supported

To look at actual error you need to modify test to run unboxed.

José Valim

unread,
Nov 27, 2025, 8:27:20 AM (7 days ago) Nov 27
to elixi...@googlegroups.com
The sandbox was designed to use savepoints. If you can't use the savepoints, then you should disable the sandbox (and instead you truncate all tables before you run tests).


--
You received this message because you are subscribed to the Google Groups "elixir-ecto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-ecto...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/elixir-ecto/8d59fc08-efc4-4939-98f5-5eeeab941b2cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages