fixed postgres connections for readonly connection #900

This commit is contained in:
Jan Prochazka
2024-09-25 10:46:07 +02:00
parent 2b6fdf5a6a
commit 58e65608e4

View File

@@ -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();