Feat/add max result size by avallete · Pull Request #3406 · brianc/node-postgres

Hey @brianc !

Thank's for the comment. Indeed, as stated in the issue, the use case here is actually one where the actor "performing the query" and the "database" are two separate entity.

Basically, an example would be an api serving a web client, and proxying the "queries" in and out of the user database. The web-client allowing the user to run arbitrary queries and see the results for it in the browser.

In such case, when a user query can OOM the "api server" accidentally forces the whole machine to die and reboot a new instance which is not ideal. Because then, the user doesn't get it's response but other connections that could be on the same instance from other users will also dies from the OOM.

I could understand if that's not something you're willing to pursue though as it's indeed corner-casy. I opened the PR because of this comment on an older issue mentioning similar problem: #2336 (comment)

Let me know how you want to proceed.