sqorn/sqorn

How to lock table for transaction?

olso opened this issue · 0 comments

olso commented
const trx = await sq.transaction();

// FIXME: can't get these to work
await sq.sql`lock table ${tables.stripeSubscriptionMirror} in exclusive mode`.one(trx);
await sq.sql`lock table ${tables.stripeSubscriptionMirror} in exclusive mode`.all(trx);
(node:69305) UnhandledPromiseRejectionWarning: error: syntax error at or near "$1"
    at Connection.parseE (/Users/olso/Dev/xxx/api/node_modules/pg/lib/connection.js:614:13)
    at Connection.parseMessage (/Users/olso/Dev/xxx/api/node_modules/pg/lib/connection.js:413:19)
    at TLSSocket.<anonymous> (/Users/olso/Dev/xxx/api/node_modules/pg/lib/connection.js:129:22)