mojolicious / mojo-pg

Mojolicious :heart: PostgreSQL
https://metacpan.org/release/Mojo-Pg
Artistic License 2.0
99 stars 46 forks source link

Isolation level attribute in Mojo::Pg::Transaction #32

Closed avkhozov closed 7 years ago

avkhozov commented 8 years ago

Summary

When you need to specify a custom transaction isolation level you have to write additional code. Like this:

my $tx = $db->begin;
$db->dbh->do('set transaction isolation level repeatable read');

Useful when there is a helper in Mojo::Pg::Database:

my $tx = $db->begin('repeatable read');

Also in such cases, the query set transaction must be first in this transaction, so it is more logical to put this query in Mojo::Pg::Transaction.

jberger commented 8 years ago

Why only isolation level? Deferred mode is every bit as useful and there are others listed here: https://www.postgresql.org/docs/current/static/sql-set-transaction.html

I do like the idea of making it easier to set transaction properties but it also shouldn't be some at the expense of others.

kraih commented 8 years ago

I think until we all agree that this is definitely the right thing to do, it might be best to stick closely to vanilla DBD::Pg behavior.

Logioniz commented 8 years ago

@jberger i think need to see on this page https://www.postgresql.org/docs/9.5/static/sql-begin.html because it should be read like this:

begin transaction isolation level serializable
Logioniz commented 8 years ago

@jberger, oh, i missed DEFERRABLE mode

kraih commented 7 years ago

Afraid it looks like this pull request did not get the required votes.