2 ms·
https://gist.github.com/aanari/349c7d97ed50c6f69930#file-batch_at_will_commander-sql-L22-L28 https://gist.github.com/aanari/349c7d97ed50c6f69930#file-bat... Th
by bhahn 12y ago
https://gist.github.com/aanari/349c7d97ed50c6f69930#file-batch_at_will_commander-sql-L22-L28 https://gist.github.com/aanari/349c7d97ed50c6f69930#file-bat...
The anonymous block is implicitly called in a transaction, so all the calls to batch_at_will will be executed in the parent transaction; there's no way around this (except for using db_link but that's pretty smelly imo).
The only way to batch update while only locking rows in the batch is to run the loop outside of postgres like OP suggested.