Re: Problems with sequences

From: "Arturo Perez" <aperez(at)hayesinc(dot)com>
To: "Alban Hertroys" <alban(at)magproductions(dot)nl>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problems with sequences
Date: 2006-09-07 13:19:17
Message-ID: 4AA304A4DBB6414199F18D7E324EBDE9016C0523@HAYES3.HAYESINC.ORG
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


From: Alban Hertroys [mailto:alban(at)magproductions(dot)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2006-09-07 13:20:02 Re: Majordomo drops multi-line Subject:
Previous Message Andrew Sullivan 2006-09-07 13:18:50 Re: Replace NULL values