mirror of https://github.com/citusdata/citus.git
Don't release lock on pg_constraint until the xact ends
Do not release AccessShareLock when closing pg_constraint to prevent modifications to be done on pg_constraint to make sure that caller will process valid foreign key constraints through the transaction.pull/3846/head
parent
79a688ffe0
commit
98a660d0b7
|
@ -437,7 +437,7 @@ ColumnAppearsInForeignKeyToReferenceTable(char *columnName, Oid relationId)
|
||||||
|
|
||||||
/* clean up scan and close system catalog */
|
/* clean up scan and close system catalog */
|
||||||
systable_endscan(scanDescriptor);
|
systable_endscan(scanDescriptor);
|
||||||
heap_close(pgConstraint, AccessShareLock);
|
heap_close(pgConstraint, NoLock);
|
||||||
|
|
||||||
return foreignKeyToReferenceTableIncludesGivenColumn;
|
return foreignKeyToReferenceTableIncludesGivenColumn;
|
||||||
}
|
}
|
||||||
|
@ -763,7 +763,13 @@ GetForeignKeyOids(Oid relationId, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
systable_endscan(scanDescriptor);
|
systable_endscan(scanDescriptor);
|
||||||
heap_close(pgConstraint, AccessShareLock);
|
|
||||||
|
/*
|
||||||
|
* Do not release AccessShareLock yet to prevent modifications to be done
|
||||||
|
* on pg_constraint to make sure that caller will process valid foreign key
|
||||||
|
* constraints through the transaction.
|
||||||
|
*/
|
||||||
|
heap_close(pgConstraint, NoLock);
|
||||||
|
|
||||||
return foreignKeyOids;
|
return foreignKeyOids;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue