I see, thanks for that! On Monday, June 18, 2018 at 6:28:32 PM UTC+2, Jeremy Evans wrote: > > On Monday, June 18, 2018 at 2:30:46 AM UTC-7, Ian Murray wrote: >> >> I tried the same situation in a Postgres, and the error seems slightly >> different, depending on the command: >> >> testdb=> insert into table values ('lorem ipsum'); >> ERROR: cannot execute INSERT in a read-only transaction >> testdb=> update table set name = 'lorem ipsum'; >> ERROR: cannot execute UPDATE in a read-only transaction >> testdb=> delete from table; >> ERROR: cannot execute DELETE in a read-only transaction >> >> Hopefully it's simple to consider this scenario as well in the postgres >> adapter. >> > > Unfortunately not. On PostgreSQL, you can have read only transactions > without the connection being read only, and those shouldn't be treated as a > disconnect error: > > DB.transaction(:read_only=>true){DB[:bar].insert} > > You can use a local patch for that: > > def DB.disconnect_error?(e, opts) > super || e.message =~ /cannot execute (INSERT|UPDATE|DELETE) in a > read-only transaction/ > end > > 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 sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.