Thread: Bug with sequence ?

Bug with sequence ?

From
"Christian Meunier"
Date:
First just let you know i solved my past issue, i used IPCHAINS to redirect port 80 to a non root port, look like there is some ressource system leaking in IPCHAINS, i moved from it to IPTABLE and all works fine now.
 
Back to postgres :)
 
let's say i have one table with the following schema:
 
Table test(num int not null primary key,.........);
 i have a sequence to handle the num: create sequence test_num_seq;
 
When i insert a new tuple i use: insert into test values(nextval('test_num_seq'),......);
 
When i look at my postgres log, time to time i see:
2002-02-04 08:11:47 ERROR:  Cannot insert a duplicate key into unique index test_pkey
 
It's really rare (considering the traffic i handle) but it shouldnt happen at all.
 
Ha using 7.2RC2 btw
Best regards

Re: Bug with sequence ?

From
Tom Lane
Date:
"Christian Meunier" <vchris@club-internet.fr> writes:
> When i insert a new tuple i use: insert into test values(nextval('test_num_=
> seq'),......);
> When i look at my postgres log, time to time i see:
> 2002-02-04 08:11:47 ERROR:  Cannot insert a duplicate key into unique index=
>  test_pkey

You sure that's the *only* way that the num column gets inserted or
updated?
        regards, tom lane


Re: Bug with sequence ?

From
Tom Lane
Date:
"Dave Cramer" <davec@fastcrypt.com> writes:
> Mine manifests with the sequence being updated, and then another process
> comes along and tries to do the same operation and somehow gets the same
> sequence.

All I can say is I've been over the sequence code with a flinty eye,
and I'm darned if I can see anything wrong with it.  I don't think
we are going to make much progress on this without being able to
investigate a failure with a debugger.

A self-contained example that shows a failure (even if only rarely)
would be really useful.  Anything less really isn't useful.
        regards, tom lane


Re: Bug with sequence ?

From
"Christian Meunier"
Date:
Well correcting the report:

by the past, i was used to have this trouble ( using 7.2b5 or prior and
ipchains)

the only 2 occurences i have now in my log are not linked to sequence so it
must occur sometime somehow but it has nothing to do with postgres.

However by the past, i had this trouble with sequence, i dont know if i get
rid off this issue updating to 7.2RC2 or moving to IPTABLE instead of
ipchains.





----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Christian Meunier" <vchris@club-internet.fr>
Cc: <pgsql-hackers@postgresql.org>
Sent: Monday, February 04, 2002 5:21 PM
Subject: Re: [HACKERS] Bug with sequence ?


> "Christian Meunier" <vchris@club-internet.fr> writes:
> > When i insert a new tuple i use: insert into test
values(nextval('test_num_=
> > seq'),......);
> > When i look at my postgres log, time to time i see:
> > 2002-02-04 08:11:47 ERROR:  Cannot insert a duplicate key into unique
index=
> >  test_pkey
>
> You sure that's the *only* way that the num column gets inserted or
> updated?
>
> regards, tom lane
>