Scary behavior after power failure

From: John Siracusa <siracusa(at)mindspring(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Scary behavior after power failure
Date: 2004-05-14 13:03:25
Message-ID: BCCA3BDD.445ED%siracusa@mindspring.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

We had a power failure (and a UPS failure) on our database machine. It's
back up now but some spooky stuff is happening. Here's an example:

(Names changed to protect the guilty.) First, the table:

---

CREATE TABLE foo
(
id SERIAL PRIMARY KEY,

bar INT NOT NULL REFERENCES blah (id),
...

UNIQUE(bar, baz, blee)
);

---

Now take a look at this:

---

pdm=# select * from foo where bar = 5;
id | bar
----------+------
13495206 | 5
13495206 | 5
(2 rows)

(Me: huh? How is that possible? The "id" column is the primary key!)

xxx=# delete from foo where id = 13495206;
DELETE 1

xxx=# select * from foo where bar = 5;
id | bar
----------+------
13495206 | 5
(1 row)

xxx=# delete from related_purchases where id = 13495206;
DELETE 1

xxx=# select * from foo where bar = 5;
id | bar
----------+------
(0 rows)

---

Is there any way I can "sanity check" the remaining tables for craziness
like this?

-John

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fred Fung 2004-05-14 13:11:19 Re: dbmirror
Previous Message Paolo Tavalazzi 2004-05-14 12:57:59 slow query if add order by