PgRelation has this code in it:
pub fn heap_relation(&self) -> Option<PgRelation> {
// SAFETY: we know self.boxed and its members are correct as we created it
let rd_index: PgBox<pg_sys::FormData_pg_index> =
unsafe { PgBox::from_pg(self.boxed.rd_index) };
if rd_index.is_null() {
None
} else {
Some(unsafe { PgRelation::open(rd_index.indrelid) })
}
}
PgRelation::open() does not lock the heaprel, which means that if you use it for anything and another process tries to modify it, you might get a race condition. Am I understanding this correctly?
Would it not make more sense to replace the PgRelation::open() line with:
Some(unsafe{PgRelation::with_lock(rd_index.indrelid, self.lockmode)})
I hesitate to submit a PR in case I've missed something here.
PgRelation has this code in it:
PgRelation::open() does not lock the heaprel, which means that if you use it for anything and another process tries to modify it, you might get a race condition. Am I understanding this correctly?
Would it not make more sense to replace the PgRelation::open() line with:
Some(unsafe{PgRelation::with_lock(rd_index.indrelid, self.lockmode)})I hesitate to submit a PR in case I've missed something here.