On Sunday, June 18, 2017 at 6:20:38 PM UTC-7, Daniel Leavitt wrote:
>
> Great answer! I no longer misunderstand :)
>
> It looks like 'transaction_status' gives us what we want:
>
> https://github.com/ged/ruby-pg/blob/219f33223b7fa9f3d352e993ccb0eaa598a05e1a/ext/pg_connection.c#L720
>
> If it's PQTRANS_IDLE (0) we probably don't want to ROLLBACK. If 
> it's PQTRANS_INERROR (3) (or anything else?) we probably do.
>
> It appears to be available in the pure-Ruby version as well:
>
> https://github.com/mneumann/postgres-pr/blob/master/lib/postgres-pr/connection.rb#L36
>

The only issue with this approach is if the client side state is mismatched 
with the server side state (transaction_status just checks local state, not 
server state).  I'm guessing that is unlikely, and it may be impossible, 
but I'm not sure.  It's good to know it's supported on both pg and 
postgres-pr.  I'll certainly consider a pull request for it.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to