Here is the code from content::revision::new
db_transaction {
if {[string equal "" $revision_id]} {
set revision_id [db_nextval "acs_object_id_seq"]
}
db_dml insert_revision $query_text
update_content \
-revision_id $revision_id \
-content $content
}
If we execute the code without a revision_id at exactly the same time, which value will the db_nextval have? My assumption is:
Exactly the same.
Why? The increase in the value of the acs_object_id_seq will not be executed for other transactions until the item has been generated. But in the meantime another transaction accesses the acs_object_id_seq and retrieve the same value and try to insert it which results in foreign key constraints.