avito-tech / go-transaction-manager

Transaction manager for GoLang
MIT License
231 stars 14 forks source link

Library close transaction #29

Closed maranqz closed 1 year ago

maranqz commented 1 year ago

pgx closes transaction on error. Then the lib returns missing error of "commit unexpectedly resulted in rollback".

hound672 commented 1 year ago

I checked this behavior in https://github.com/avito-tech/go-transaction-manager/pull/76 If I return trm.ErrSkip in transaction section transaction will be commited. Is this correct?

maranqz commented 1 year ago

ErrSkip doesn't connect with ErrTxCommitRollback. ErrSkip allows to commit on an application error not a database.

I think, I can close this issue, because the pgx docs said: PostgreSQL accepts COMMIT on aborted transactions, but px is treated as ROLLBACK.

The libs cannot fix this behavior.