You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Postgres transaction are bugged, i cant use them, i think i know why.
In the postgres docs, we see that after opening a transaction, we have to use the object returned by transaction() to make queries, not the base client
But DenoDB doesn't give us a chance to work with this transaction object, neither use it to make the queries, thus systematically showing the error "This connection is currently locked by the "transaction" transaction"
As a temporary quick and dirty solution, for anyone else stuck on this problematic, you can use this code to fix the transactions without waiting for the fix to be done:
asyncdoInTransaction(block: ()=>Promise<void>): Promise<void>{// deno-lint-ignore no-explicit-anyconstclient=this.db["_connector"]["_client"]asPostgresClient;consttransaction=client.createTransaction("transaction");// deno-lint-ignore no-explicit-anythis.db["_connector"]["_client"]=transaction;awaittransaction.begin();awaitblock()awaittransaction.commit();// deno-lint-ignore no-explicit-anythis.db["_connector"]["_client"]=client;// Waiting for a fix of DenoDB//return this.client.transaction(block) as Promise<void>;}
Hello !
Postgres transaction are bugged, i cant use them, i think i know why.
In the postgres docs, we see that after opening a transaction, we have to use the object returned by transaction() to make queries, not the base client
But DenoDB doesn't give us a chance to work with this transaction object, neither use it to make the queries, thus systematically showing the error "This connection is currently locked by the "transaction" transaction"
This is where the code is broken:
https://github.com/eveningkid/denodb/blob/master/lib/connectors/postgres-connector.ts#L89
The text was updated successfully, but these errors were encountered: