Re: Problems with sequences - Mailing list pgsql-general

From Arturo Perez
Subject Re: Problems with sequences
Date
Msg-id 4AA304A4DBB6414199F18D7E324EBDE9016C0523@HAYES3.HAYESINC.ORG
Whole thread Raw
In response to Problems with sequences  ("Arturo Perez" <aperez@hayesinc.com>)
Responses Re: Problems with sequences
List pgsql-general
From: Alban Hertroys [mailto:alban@magproductions.nl]
>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

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Replace NULL values
Next
From: Alvaro Herrera
Date:
Subject: Re: Majordomo drops multi-line Subject: