▲ | ncruces a day ago | |
To do this, it's best if the user opens two pools themselves. I've tried to create something that does this transparently (give you a pool that magically routes writes to a single connection), but it's hard. It starts simple: Exec is a write, Query is a read. Unless it contains the word RETURNING, then it can be an UPDATE…RETURNING. BeginTx can be read-only otherwise assume it's a write. The problem is that attached DBs throw a wrench and make it even more confusing. So only the user can really know if it's a write or a read. But then this makes it harder to use an ORM or even something like SQLc. So I don't know if the “driver” should do anything about it really. |