Which, if the IDs make sense, means that we inserted 7 POMsgSets before the last one failed. So some other hypotheses that might explain this problem:
- Somewhere along the line we are doing an ABORT/ROLLBACK which causes all the work before the POMsgSet insertion to be invalidated. The sequence stays sequential because sequences are transaction independent (right?)
- The message we are getting is lying to us. In this case it is:
DETAIL: Key (pofile)=(169860) is not present in table "pofile".
Well, if that's the case, then I think we have a more complicated problem than I initially predicted, because that log says:
/*46912674137040*/ INSERT INTO POFile (id...) VALUES (169860, ...)
and then
/*46912674137040*/ SELECT NEXTVAL( 'POMsgSet_ id_seq' )
/*46912674137040*/ INSERT INTO POMsgSet (id, ... pofile) VALUES (71049052, ... 169860)
successfully, and then at the end
/*46912674137040*/ SELECT NEXTVAL( 'POMsgSet_ id_seq' )
/*46912674137040*/ INSERT INTO POMsgSet (id, ... pofile) VALUES (71049059, ... 169860)
Which, if the IDs make sense, means that we inserted 7 POMsgSets before the last one failed. So some other hypotheses that might explain this problem:
- Somewhere along the line we are doing an ABORT/ROLLBACK which causes all the work before the POMsgSet insertion to be invalidated. The sequence stays sequential because sequences are transaction independent (right?)
- The message we are getting is lying to us. In this case it is:
DETAIL: Key (pofile)=(169860) is not present in table "pofile".
I'll look at the log a bit more.