Thread: BUG #5809: bigserial duplicate value

BUG #5809: bigserial duplicate value

From
"mahmoud elzaiady"
Date:
The following bug has been logged online:

Bug reference:      5809
Logged by:          mahmoud elzaiady
Email address:      melzaiady@yahoo.co.uk
PostgreSQL version: 8.4
Operating system:   windows xp
Description:        bigserial duplicate value
Details:

I have problem today
i have table and colum type bigserial
and insert data automatic number
but i found the value duplicate
i ask ,bigserial must not duplicate the value ?
how solve this problem

Re: BUG #5809: bigserial duplicate value

From
Jeff Davis
Date:
On Sun, 2011-01-02 at 11:40 +0000, mahmoud elzaiady wrote:
> The following bug has been logged online:
>
> Bug reference:      5809
> Logged by:          mahmoud elzaiady
> Email address:      melzaiady@yahoo.co.uk
> PostgreSQL version: 8.4
> Operating system:   windows xp
> Description:        bigserial duplicate value
> Details:
>
> I have problem today
> i have table and colum type bigserial
> and insert data automatic number
> but i found the value duplicate
> i ask ,bigserial must not duplicate the value ?
> how solve this problem

This is probably due to the sequence being reset somehow. Have you
dumped/reloaded recently? Did you manually back up or copy the table?

What is the exact error message that you see? If it tells you the
duplicated value, is it very old, perhaps 1 (indicating a reset of the
sequence)?

Note that, by "reset", I do not mean "overflow". I mean that the
sequence might have been recreated somehow.

Try to provide more detail in your bug report. See:
http://wiki.postgresql.org/wiki/Guide_to_reporting_problems

Regards,
    Jeff Davis

Re: BUG #5809: bigserial duplicate value

From
Joshua Tolley
Date:
On Mon, Jan 03, 2011 at 11:04:17AM -0800, Jeff Davis wrote:
> On Sun, 2011-01-02 at 11:40 +0000, mahmoud elzaiady wrote:
> > i ask ,bigserial must not duplicate the value ?
> > how solve this problem
>=20
> This is probably due to the sequence being reset somehow. Have you
> dumped/reloaded recently? Did you manually back up or copy the table?

Alternatively, perhaps at some point you've added data to that column, rath=
er
than relying on PostgreSQL to supply a default value.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com

Re: BUG #5809: bigserial duplicate value

From
Melzaiady
Date:
=C2=A0i relying on PostgreSQL to supply a default value,
i=C2=A0 have application at=C2=A0 hospital and application appear error abo=
ut duplicate=20
value.=20

There was a primary key on this columns but i found error form my applicati=
on=20
about duplicate value and can`t insert value then i remove the primary key=
=20
constraint to try=C2=A0 to find problem and try again i found bigserial=C2=
=A0 put=20
duplicate value on fields=C2=A0.
=C2=A0

________________________________

Mahmoud El Zaiady
Bachelor of Information Systems
Faculty of Computers & Information Sciences
Mansoura University
=C2=A0
=C2=A0





________________________________
From: Joshua Tolley <eggyknap@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: mahmoud elzaiady <melzaiady@yahoo.co.uk>; pgsql-bugs@postgresql.org
Sent: Tue, January 4, 2011 6:34:57 PM
Subject: Re: [BUGS] BUG #5809: bigserial duplicate value

On Mon, Jan 03, 2011 at 11:04:17AM -0800, Jeff Davis wrote:
> On Sun, 2011-01-02 at 11:40 +0000, mahmoud elzaiady wrote:
> > i ask ,bigserial must not duplicate the value ?
> > how solve this problem
>=20
> This is probably due to the sequence being reset somehow. Have you
> dumped/reloaded recently? Did you manually back up or copy the table?

Alternatively, perhaps at some point you've added data to that column, rath=
er
than relying on PostgreSQL to supply a default value.

--
Joshua Tolley / eggyknap
End Point Corporation
http://www.endpoint.com



=20=20=20=20=20=20=

Re: BUG #5809: bigserial duplicate value

From
Robert Haas
Date:
On Wed, Jan 5, 2011 at 12:38 AM, Melzaiady <melzaiady@yahoo.co.uk> wrote:
> =A0i relying on PostgreSQL to supply a default value,
> i=A0 have application at=A0 hospital and application appear error about
> duplicate value.
> There was a primary key on this columns but i found error form my
> application about duplicate value and can`t insert value then i remove the
> primary key constraint to try=A0 to find problem and try again i found
> bigserial=A0 put duplicate value on fields=A0.

I'm pretty sure there isn't a bug that's making the sequence return
duplicate values, because if there were, a lot more people would have
complained about it by now.  I think there's probably a bug in your
application logic, but you haven't provided enough detail to figure
out what it is.  I'd suggest examining your log files for clues, and
perhaps posting relevant sections of them here.

It's not surprising that if you're getting duplicate key errors and
you drop the index, you would then get actual duplicate keys...

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: BUG #5809: bigserial duplicate value

From
melzaiady
Date:
http://postgresql.1045698.n5.nabble.com/file/n3332998/data1.jpg

this picture of screen you can new sequence of value.

now how can i slove this problem and this field dont start new squences in
any time ?
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-5809-bigserial-duplicate-value-tp3325115p3332998.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

Re: BUG #5809: bigserial duplicate value

From
Robert Haas
Date:
On Sat, Jan 8, 2011 at 6:10 AM, melzaiady <melzaiady@yahoo.co.uk> wrote:
>
> http://postgresql.1045698.n5.nabble.com/file/n3332998/data1.jpg
>
> this picture of screen you can new sequence of value.
>
> now how can i slove this problem and this field dont start new squences in
> any time ?

It's pretty hard to tell what's actually going on here, but your
original complaint is that you're getting duplicate values, and there
are no duplicate values shown in this picture.  It's not even clear
that the sequence is resetting itself -- it might just be that the
values are sorted as strings rather than integers.  But if it is
getting reset, it's not happening magically behind the scenes - some
human being or program is resetting it.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company