This is a discussion on Postgres recoverey for deleted row of data within the pgsql Hackers forums, part of the PostgreSQL category; --> hi, is there is way undelete or recover the deleted row in a table in postgres.iam layman, can anyone ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| hi, is there is way undelete or recover the deleted row in a table in postgres.iam layman, can anyone help me. with regards csperumal __________________________________________________ ________________ Switch to Netscape Internet Service. As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register Netscape. Just the Net You Need. New! Netscape Toolbar for Internet Explorer Search from anywhere on the Web and block those annoying pop-ups. Download now at http://channels.netscape.com/ns/search/install.jsp ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend |
| ||||
| "Srinivasa Perumal" <csperumal@netscape.net> writes > > hi, is there is way undelete or recover the deleted row in a table in postgres.iam layman, can anyone help me. > Here is one way but I am not sure it is a good one. The precondition is that you didn't schedule any vacuum on your database. Since PG never really destory any data as you delete them before you use vacuum, so you still have chance to find back your data - copy down the values, and re-insert them again. PG uses visibility rules to fill out the garbage data, say, the data you deleted. So if you change the visibility rules, you could see your data again. The visibility rules is in function/macro HeapTupleSatisfiesVisibility(), return true means the tuple is visible, else, not. So if you know how to compile PG kernel, here is how: (1) shutdown your database and backup your data; (2) change HeapTupleSatisfiesVisibility(), just let it return "true", which means, it will treat everything as visible, including deleted rows; compile the kernel; (3) restart your database and find out the data you want - you may select them into another table; (4) revert the changes, and restart your database and insert the rows you just find out. Regards, Qingqing |