简体   繁体   中英

Knex.js PostgreSQL how to change transaction isolation level?

This doesn't seem to be covered in Knex.js docs . Any ideas?

Thanks

I'd expect it to be a raw SQL statement. Syntax

knex.schema.raw('set transaction isolation level serializable;') 

This setting persists for the current session. That means you might have to change it to something else for other queries in the same session.

您可以使用交易选项,例如:

   this.knex.transaction(async (trx) => { ... }, { isolationLevel: 'repeatable read' });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM