Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw error when main db instance method used inside an interactive transaction #76

Open
denis-sepirak opened this issue Apr 16, 2024 · 1 comment

Comments

@denis-sepirak
Copy link

denis-sepirak commented Apr 16, 2024

const client = new PGlite();
await client.transaction(async (tx) => {
   await tx.query('select 1');
   await client.query('select 1'); // process just exits without any errors
}) 

Is this an intended behavior? (I know that I shouldn't do this, but still)

$ node -v
v20.11.0
$ arch
arm64
@samwillis
Copy link
Collaborator

Hey @denis-sepirak
Yep, using the client instance inside an interactive transaction is not supported. There is no specific error handling for it apart from a Mutex at the moment, it may be that it's deadlocking.

I'm going to repurpose this issue to track adding error handling to this situation.

@samwillis samwillis changed the title Question: Using original client within an interactive transaction Throw error when main db instance method used inside an interactive transaction Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants