pgo icon indicating copy to clipboard operation
pgo copied to clipboard

How to run a query outside of the transaction while in a transaction

Open lpil opened this issue 1 year ago • 2 comments

Hello!

There's a check that prevents a process from intentionally using another pool in a transaction or with a different connection from the same transaction, even if one is explicitly passed in by the programmer.

https://github.com/erleans/pgo/blob/d1989c44f41ccf1b4e670ccafe46d43f71cb6dfc/src/pgo.erl#L95-L98

Is there an intended way around this? I would like full control over which pool is used, even if one of them is in a transaction state.

Thank you, Louis

lpil avatar Jun 30 '24 18:06 lpil

Maybe exposing query/4 will do it. It accepts a Conn. So to get around this you'd have to checkout a connection and pass it directly, to be explicit you are going around the transaction.

tsloughter avatar Jul 02 '24 11:07 tsloughter

That would work! Sounds good

lpil avatar Jul 07 '24 12:07 lpil