postgresql-transactional icon indicating copy to clipboard operation
postgresql-transactional copied to clipboard

Missing "fold" from postgresql-simple

Open purcell-nec opened this issue 7 years ago • 2 comments

Large result sets returned via query etc. get read completely into memory, for which reason postgresql-simple also provides fold, forEach and co. There's no corresponding way to consume result sets incrementally within PGTransactionT. Is this something you've considered adding?

purcell-nec avatar Jan 25 '18 04:01 purcell-nec

@purcell-nec we would absolutely merge this. Would you be interested in making a PR? Thanks for the suggestion, either way!

reiddraper avatar Jan 25 '18 22:01 reiddraper

Would you be interested in making a PR?

Quite possibly, yes. Although I realised that this still doesn't give me exactly what I want. fold etc. are backed by a cursor, and what I'd like is to be able to iterate over result rows from that cursor and decide based on what I see whether or not to continue. fold will always consume every available record from the result set, so probably what I need is a monadic context for the cursor inside which I could sequence rows or abort.

I really enjoy that postgresql-transactional gives me a consistent transactional context, so I'd like to be able to tackle this sort of problem in that same context rather than having to run everything in a pipes or conduit-based connection pipeline instead -- which is partly to say, thanks for this library!

purcell avatar Jan 26 '18 04:01 purcell