So I have a application that makes two different PG connection pools, one 
to a read-only server, and one to a read-write server.
All was going great, until I accidentally use my RO connection for a write.

Sadly, all my automated testing didn't catch it, as we just have a RW 
server automated test environment.(ok the code gets two hostnames, but they 
are the same.

We just have those in our production env (I'd love it to match, but... 
costs money)

So what I am thinking about doing... when I setup my RO connection I run 
`SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;`

i.e I make my RO guy like this
```
  config = {
    host:    'some_ro_server',
    port:    '1234'
    ...
  }
  db_ro = Sequel.postgres(config)
  db_ro.run('SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;')
``` 

But, after working with the Sequel gem for so long typing in direct stuff 
like this always seem so, non sequel..

Anyways, is there an option when setting up my connection, to make it 
read-only, (i.e. do this command)

In this document
https://github.com/jeremyevans/sequel/blob/master/doc/opening_databases.rdoc

 I see a `:readonly ` flag but that looks like it sis for `sqlite` only 
<https://github.com/jeremyevans/sequel/blob/master/doc/opening_databases.rdoc#label-sqlite>
Am I missing anything?

Thanks


 
 
 
 
 



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/e749a5f7-87f6-46e1-ae59-7eb9982ad4afn%40googlegroups.com.

Reply via email to