[Please CC any replies, I'm subscribed nomail] As promised I've given it a bit of polish and it's actually almost useful. You can have a look at it http://svana.org/kleptog/pgsql/pgfsck.html
Just unpack the files into a directory. It's just a perl script with two modules so no compiling necessary. You can download the package directly at http://svana.org/kleptog/pgsql/pgfsck-0.01.tar.gz I've tested it on versions 6.5, 7.0 and 7.2 and it works. It shouldn't crash, no matter how bad a file you feed it. It can output insert statements also to help reconstruction. Here is an example of the program being run over a suitably hexedited file. # ./pgfsck -r 16559 kleptog website -- Detected database format 7.2 -- Table pg_class(1259):Page 1:Tuple 0: Unknown type _aclitem (1034) -- Table pg_class(1259):Page 1:Tuple 49: Unknown type _aclitem (1034) -- Table website(16559):Page 0:Tuple 7: Tuple incorrect length (parsed data=57,length=1638) -- Table website(16559):Page 0:Tuple 44: Decoding tuple runs off end: 627338916 > 69 -- Table website(16559):Page 0:Tuple 70: Bad tuple offset. Should be: 3784 <= 11592 < 8192 Currently the following features are not supported: - Toasted / compressed tuples - Checking indexes doesn't work (should it?) - Views just produce empty output (because they are) - Arrays don't work - Since each type output has to be written, many types are not correctly output - Split tables (1GB) are not supported past the first part. - Some system tables in some versions have a strange layout. You may get many harmless warnings about the formats of pg_class, pg_attribute and/or pg_type. Most of these are basically because I don't know how they work, but with a bit of work some of these should be fixable. Have a nice day, -- Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/ > Canada, Mexico, and Australia form the Axis of Nations That > Are Actually Quite Nice But Secretly Have Nasty Thoughts About America ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly