Comment by ako

Comment by ako a day ago

3 replies

I would expect most drivers to support (anonymous) stored procedures so you can batch/pipeline multiple queries into one statement to be executed by the database. Probably more a problem of developers not knowing how to use databases properly, not so much a limitation of technology.

hombre_fatal a day ago

People don't do that because when you're writing insert/update queries, you tend to want to write logic based on the value of intermediate results, and also you can't return tabular data from a DO block (they operate as a function returning void).

You also can't use parameterized values like $1, $2.

It seems more niche than you're suggesting. Though I wish people would write app layer pseudocode to demonstrate what they are referring to.