Correctly handle empty databases in `Database::listTables()` (see #6222)