Repository: ClickHouse/ClickHouse
File: src/Storages/System/StorageSystemTables.cpp (C++)

Code before:
    void fillParametralizedViewData(MutableColumns & columns, const StoragePtr & table, size_t & res_index)
    {
        if (table)
        {
            StorageMetadataPtr metadata_snapshot = table->tryGetInMemoryMetadataPtr().value_or(nullptr);
            if (!metadata_snapshot)
            {
                columns[res_index++]->insertDefault();
                return;
            }

            NameToNameMap query_parameters_array = getSelectParamters(metadata_snapshot);
            if (!query_parameters_array.empty())
            {
                Array changes;
                for (const auto & [key, value] : query_parameters_array)
                    changes.push_back(Tuple{key, value});
                columns[res_index++]->insert(changes);
            }
            else
                columns[res_index++]->insertDefault();
        }
    }


    void showTablesQuery(MutableColumns & res_columns, bool need_to_check_access_for_tables)
    {
        auto table_details = database->getLightweightTablesIterator(context,
                                /* filter_by_table_name */ {},
                                /* skip_not_loaded */ false);

        const auto access = context->getAccess();
        for (auto & table_detail: table_details)
        {
            size_t src_index = 0;
            size_t res_index = 0;

            if (need_to_check_access_for_tables && !access->isGranted(AccessType::SHOW_TABLES, database_name, table_detail.name))
                continue;

            if (columns_mask[src_index++])
                res_columns[res_index++]->insert(database_name);

            if (columns_mask[src_index++])
                res_columns[res_index++]->insert(table_detail.name);
        }
    }

    Chunk generate() override
    {
        if (done)

Review comment (suggestion):
The method name `showTablesQuery` is misleading as it doesn't execute a query but rather populates result columns. Consider renaming to `populateTableNames` or `fillTableNamesOnly` to better reflect its actual purpose.

Code after:
            {
                Array changes;
                for (const auto & [key, value] : query_parameters_array)
                    changes.push_back(Tuple{key, value});
                columns[res_index++]->insert(changes);
            }
            else
                columns[res_index++]->insertDefault();
        }
    }


    size_t fillTableNamesOnly(MutableColumns & res_columns, bool need_to_check_access_for_tables)
    {
        auto table_details = database->getLightweightTablesIterator(context,
                                /* filter_by_table_name */ {},
                                /* skip_not_loaded */ false);

        size_t count = 0;

        const auto access = context->getAccess();
        for (const auto & table_detail: table_details)
        {
            size_t src_index = 0;
            size_t res_index = 0;

            if (need_to_check_access_for_tables && !access->isGranted(AccessType::SHOW_TABLES, database_name, table_detail.name))
                continue;

            if (columns_mask[src_index++])
                res_columns[res_index++]->insert(database_name);

            if (columns_mask[src_index++])
                res_columns[res_index++]->insert(table_detail.name);

            ++count;
        }
        ++database_idx;
        return count;
    }

    Chunk generate() override
    {
        if (done)
            return {};

        MutableColumns res_columns = getPort().getHeader().cloneEmptyColumns();

        const auto access = context->getAccess();
        const bool need_to_check_access_for_databases = !access->isGranted(AccessType::SHOW_TABLES);