4 ms·
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 databas
by ako 1y ago
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.
- mxey 1y agoYou don’t even need driver support, you can use https://www.postgresql.org/docs/current/sql-do.html https://www.postgresql.org/docs/current/sql-do.html
- ako 1y agoYes, exactly, sql do is the Postgres way of executing an anonymous block.
- hombre_fatal 1y agoPeople 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.
- ako 1y agoIn a plsql block you can use parameters, ref cursors or arrays to return tabular data and do if/then/else/while logic.