Mark, Here's a quick and very dirty sketch of what I think perhaps this logic could look like. This is pretty much untested and it might be buggy, but at least you can see whether we're thinking at all in the same direction.
-- Robert Haas EDB: http://www.enterprisedb.com
very-rough-visibility-ideas.patch
Description: Binary data