Re: pgadmin or pgsql bug? inserting row

From: Kevin Field <kev(at)brantaero(dot)com>
To: Dave Page <dpage(at)postgresql(dot)org>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: pgadmin or pgsql bug? inserting row
Date: 2007-08-09 13:24:32
Message-ID: 46BB1590.2020000@brantaero.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Dave Page wrote:
> Kevin Field wrote:
>> One other detail, after it worked I noticed that the ID returned was one
>> where there had been a gap in the sequence (i.e., we had entries 1-12
>> and 14-24, and the new row had id 13.) This may be because the existing
>> entries had been added with explicit id numbers but the sequence was
>> probably still at a lower number.
>>
>> This is pretty befuddling to me. I'm not sure if it's a pgsql issue or
>> a pgadmin one, but anyway, there's my report.
>
> Check the current value of the sequence used by the serial column, and
> if it's less than the highest value in the table, you're almost
> certainly trying to insert a duplicate. Each time you try though, the
> sequence increments whether or not the insert worked - so by chance it
> was OK in your app when you hit the gap.
>
> The solution would be to set the current value of the sequence to
> something higher than any record already in the table.
>
> Regards, Dave
>

Oh, of course! Right. It was so coincidental it threw me for a loop. :)

Thanks,
Kev

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Milen A. Radev 2007-08-09 13:36:16 Re: operators, types, etc....where'd they go?
Previous Message Dave Page 2007-08-09 13:21:11 Re: pgadmin or pgsql bug? inserting row