Transaction not respecting locks

await db.transaction(async (trx) => {
          await trx.execute(sql`LOCK TABLE myTable IN SHARE MODE;`);
await trx.select.where name === kat
if name === kat throw
await trx.insert(myTable).set({name:'kat'})


})

using supabase and postgres
spam the above function, sometimes kat gets created more than once
however adding trx.execute(BEGIN TRANSACTION ) and then manually comitting it solves the problem, but drizzle logs gives an warning that a transaction is ongoing
Was this page helpful?