Re: PostgreSQL Data Loss

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: BluDes <darocchi(at)tiscali(dot)it>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PostgreSQL Data Loss
Date: 2007-01-26 21:46:28
Message-ID: 45BA76B4.2080904@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

BluDes wrote:
> I made a program that uses a PostgreSQL (win32) database to save its data.

What version of PostgreSQL is this?

> My customer claims that he lost lots of data reguarding his own clients
> and that those data had surely been saved on the database.
> My first guess is that he is the one who deleted the data but wants to
> blame someone else, obviously I can't prove it.

Did he lose all data in one table, or just some rows? Or is there some
other pattern?

> Could it be possible for PostgreSQL to lose its data?

Not when properly installed.

> Maybe with a file corruption?

I doubt it. You'd almost certainly get warnings or errors if there's
corruption.

> Could it be possible to restore these data?

The first thing to do is to take a filesystem-level physical copy of the
data directory to prevent further damage. Copy the data directory to
another system for forensics.

You might be able to get a picture of what happened by looking at the
WAL logs using the xlogviewer tool in pgfoundry.

You can also modify the PostgreSQL source code so that it shows also row
versions marked as deleted, and recover the deleted data. I can't
remember exactly how to do it, maybe others who have done it can fill
in. A row stays physically in the file until the table is vacuumed;
hopefully it hasn't been.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2007-01-26 21:47:13 Re: Proposal: Change of pg_trigger.tg_enabled and adding
Previous Message Jim Nasby 2007-01-26 21:40:12 Re: Proposal: Change of pg_trigger.tg_enabled and adding pg_rewrite.ev_enabled