Mateus Cordeiro Inssa <mateus@ifnet.com.br> writes:
> I got this error vacuuming pg_proc:
> ERROR: _bt_endpoint: leftmost page (20) has not leftmost flag
Hmm, I wonder if this could be yet another manifestation of the problems
that btree indexes have with oversized key values. Do you have any
procedures with long definitions? "Long" in this context means over
about 4K. If you're not sure, tryselect proname from pg_proc where length(prosrc) > 4000;
If you do, try breaking them up into smaller procedures. You might have
to dump and rebuild the database to get rid of the corruption in
pg_proc's index, though.
The reason this is an issue is that btree wants to be able to store at
least two index tuples per disk page, so it has problems with indexing
values over half-a-page-less-overhead. I'm not sure exactly what the
critical size is, but it is somewhere around 4000 bytes. And pg_proc
has an index on the prosrc field.
The prosrc index is actually completely unnecessary, so we've removed
it for 7.0. Work is in progress to fix the tuple-size problem as well,
but that will probably take longer.
regards, tom lane