From: Alban Hertroys [mailto:alban@xxxxxxxxxxxxxxxxx] >Martijn van Oosterhout wrote: >> On Thu, Sep 07, 2006 at 07:15:43AM -0400, Arturo Perez wrote: >>> iht=> select max(article_id) from article; >>> max >>> ------ >>> 4992 >>> (1 row) >>> >>> iht=> select nextval('pk_article'); >>> nextval >>> --------- >>> 4986 >>> (1 row) >>> >>> Assuming the sequence number is being used correctly why would they >> be 6 apart? >> >> The last four transactions could be rolled back, or not committed yet. > > b) the OP inserted numbers not coming from the sequence; he shot his >own feet. I prefer to think that my feet were shot off by a library I'm using :-) Some many layers, so little time (to debug). In any case, at this point in time it's looking like Cayenne doesn't honor the rules of the sequence. It appears to (and is documented as) internally incrementing rather than fetching the sequence for each insert. I would still like more debugging tips for this sort of thing. As I mentioned, statement logging did not show the relevant details. What other things could I have done? -arturo