Duplicate Tickets?

Can someone help me out of this mess?

I use RT 2.0.15 with RHDB 2.1 (Postgres 7.2.3) as the backend. Today,
while I tried to resolve a ticket, I got this:

Status: Status could not be set to resolved.

I found this in the database:

tickets=# select id from tickets where id = 10622;
id
10622
10613
(2 rows)

tickets=# update tickets set status = ‘resolved’ where id = 10622;
ERROR: Cannot insert a duplicate key into unique index tickets_pkey

Questions:

Why is it showing me ticket 10613 for a query on 10622?
How do I get out of this mess?

Any help will be appreciated.

(Now I find more tickets with the same problem, viz:

tickets=# select id from tickets where id = 10613;
id
10613
10476
(2 rows)

I feel the index has gone bust. How do I rebuild it?)

Binand

Update: I ran this query in a loop, and found a total of twenty ticket
IDs which return multiple rows for the select down there.

Is this a postgres problem?

BinandOn Fri, Mar 14, 2003 at 06:34:30PM +0530, Binand Raj S. wrote:

tickets=# select id from tickets where id = 10622;
id

10622
10613
(2 rows)

Update: I ran this query in a loop, and found a total of twenty ticket
IDs which return multiple rows for the select down there.

Is this a postgres problem?

Sorry to keep on increasing my own thread, but I solved it finally. The
backend indexes were corrupt, I guess (there was a power failure on the
machine a week ago). I rebuilt the indexes (REINDEX DATABASE tickets
FORCE;) and the problem went away.

All doubts I have (do I need to reindex everytime an unclean shutdown is
performed?) belong to a postgres list, I expect.

Binand