Forum OpenACS Q&A: I still don't understand locking in PG

the statement
        db_dml reset_hp_u "update minions set hp = hp_max"
is deadlocking with other updates to minions. I thought simple updates like this are supposed to go lock all the rows they need before proceeding. (Guess not?) Even when I try this
    db_transaction {
        db_dml lock "lock table minions in row share mode"
        db_dml reset_hp_u "update minions set hp = hp_max"
    }
it gets rejected. (row share = others can read but don't let anyone write anything 'til I'm done, right?)
Collapse
Posted by Don Baccus on
I'd ask about this over in the PG mailing lists ... and I'd be curious to see their answer (i.e. posted here).