Search Postgresql Archives

Scary behavior after power failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux