mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 07:56:01 +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);
|
||||
await client.connect();
|
||||
|
||||
if (isReadOnly) {
|
||||
await this.query(client, 'SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
|
||||
}
|
||||
|
||||
return {
|
||||
const dbhan = {
|
||||
client,
|
||||
database,
|
||||
};
|
||||
|
||||
if (isReadOnly) {
|
||||
await this.query(dbhan, 'SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
|
||||
}
|
||||
|
||||
return dbhan;
|
||||
},
|
||||
async close(dbhan) {
|
||||
return dbhan.client.end();
|
||||
|
||||
Reference in New Issue
Block a user