adelsz / pgtyped

pgTyped - Typesafe SQL in TypeScript
https://pgtyped.dev
MIT License
2.91k stars 94 forks source link

Providing a pool to .run() works only sometimes. #544

Closed bbsimonbb closed 11 months ago

bbsimonbb commented 11 months ago

Describe the bug I want to be able to provide a pool to my query's .run() method. When I do this it works some of the time. I have inserts, reads and updates working like this no problem. However I've just done my first delete, and I needed to explicitly connect to the pool then release the connection, otherwise my changes were not persisted.

Expected behavior If I have no need for transactions, I want to just provide a pool to pgtyped generated run methods. If this is not possible, or easy, I would like to understand why a pool works sometimes.

adelsz commented 11 months ago

It is hard to understand what is going on without a reproducible example. pgTyped .run method calls the connection.query method without doing anything too smart on top of that. It can be a problem of how you acquire and release clients in the pool in your other code.

adelsz commented 11 months ago

Please reopen with a reproduction if this continues to be an issue.