Yeah, I’ve missed that, it was implemented at around 3.3.0 and became stable (as in without “It may be removed in future releases” note) at around 3.8.0. That’s why I never used it, apparently. But now I know, thanks!
Which is a good point, but people don’t use it not because “it is not a common situation”, but because it is hard to use and it is a bad DX. Situation, however, is very common, and it is testing when I want to check how multiple processes use the database. If I had the manual startup approach with explicit pool, I’d have something like this
- I create a prefix of the database, or I set up a sandbox pool which executes every query in a single transaction.
- I start the database connection pool by some name.
- I start the subset of my supervision tree I want to test.
- I pass the pool in start options.
- I perform the test and it is fully async and isolated because it uses a pool which is separate from other tests.
This way I dont have to write any testing code, because pool propagation is already there. I don’t have to rewrite the code in order to make it work with a different database. Plus, I can now see which functions work with database, because I pass the pool around explicitly.
And also, at any moment, I can make this explicit pool passing approach into implicit one, like Ecto does today, by introducing one wrapper module which would take around 30 lines of code.


















