mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 19:56:02 +00:00
fixed postgres connections for readonly connection #900
This commit is contained in:
@@ -86,14 +86,16 @@ const drivers = driverBases.map(driverBase => ({
|
|||||||
const client = new pg.Client(options);
|
const client = new pg.Client(options);
|
||||||
await client.connect();
|
await client.connect();
|
||||||
|
|
||||||
if (isReadOnly) {
|
const dbhan = {
|
||||||
await this.query(client, 'SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
client,
|
client,
|
||||||
database,
|
database,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (isReadOnly) {
|
||||||
|
await this.query(dbhan, 'SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
|
||||||
|
}
|
||||||
|
|
||||||
|
return dbhan;
|
||||||
},
|
},
|
||||||
async close(dbhan) {
|
async close(dbhan) {
|
||||||
return dbhan.client.end();
|
return dbhan.client.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user