External Publication
Visit Post

[ANN] hpgsql, a pure Haskell PostgreSQL driver (no libpq)

Haskell Community [Unofficial] May 13, 2026
Source

Thank you, Yuras! I think you were in fact the person that taught me a lot about asynchronous exceptions in a postgresql-simple PR review. I learned a lot then, so thanks!

I have a question about the semantics. Is it always safe to reuse connection unless I got IrrecoverableHpgsqlError? The docs are not 100% clear, e.g. this:

Oh, a different type of exception would be considered a bug in the library. I did try to wrap all potentially exception throwing code in a way that turns them into a IrrecoverableHpgsqlError precisely because otherwise it’s impossible to know what to do with the connection.

Since it’s the first release, though, I wouldn’t be surprised if something escaped me. Still, take this as a project goal commitment.

And in withTransactionMode it looks like IrrecoverableHpgsqlError might get lost if async exception arrives between tryAny and throw

I think I see what you’re saying. Very nice catch! I created a github issue for this, and will address it as soon as I can.

(Also these TODOs are suspicious)

Yes, there are a few warts I want to address in the codebase. This one is a potential problem “only” when opening new connections, so I thought I could do a first release before addressing them. I did take a lot more care once a connection is opened, and I have stress tests that have helped me catch and hone parts of the code.

Discussion in the ATmosphere

Loading comments...