Improve output for Database enumerators.

This fixes #3072 and has some other cosmetic changes also.