#SET TRANSACTION ISOLATION LEVEL must be called before any query

4 messages · Page 1 of 1 (latest)

glossy osprey
#

I'm getting this error when running my program locally: SET TRANSACTION ISOLATION LEVEL must be called before any query, can't I nest transactions? or do I have to update the isolation level of the outer transaction so everything is serializable?

In my code I have some business logic that handles account balances so I wrap the code with a transaction like this:

   ## There's another TX wrapping this.
    Repo.transaction(fn ->
      Repo.query!("set transaction isolation level SERIALIZABLE;")
      # Rest of the monetary account handling here... 
#

ah, I can't nest it.

vital bloom