Thread: Primary key violation

Primary key violation

From
bmp@ipath.net.in
Date:
Sir,

We were using postgresql for our development for two years. The database which we are using is having no problem till
lastweek.Now we are using version 7.2 of postgresql. 

In this week, we got two major bugs in database. They are,
1 . Once we could see that a record is inserted into a table with violation of primary key. Primary key is numeric
type.Then we checked the oid of these two records. The oids are also same! How this happens ? 

2. When we give a query like "select token_no from member_master where token_no = 1290" gives an output "No record
found".But when we give another query like "select * from member_master where token_no = 1290" gives one record showing
thetoken_no as 1290.Token number is also numeric type. 

Sir, does these happen due to our mistake or some database failure ?

Awaiting reply,
Baiju MP

Re: Primary key violation

From
Tom Lane
Date:
bmp@ipath.net.in writes:
> We were using postgresql for our development for two years. The database which we are using is having no problem till
lastweek.Now we are using version 7.2 of postgresql. 

If you are still on 7.2, and not 7.2.4, you should update.  Immediately.

> In this week, we got two major bugs in database. They are,

Did you have any system or database crashes before that?  These sound
like the kind of thing you could get after a crash, or an attempt to
backup/restore a live database using tar, or something else that would
allow files to get out of sync.

            regards, tom lane