INDEX_LENGTH uppercase alias missing from information_schema.tables view · Issue #101696 · ClickHouse/ClickHouse · GitHub
Skip to content

INDEX_LENGTH uppercase alias missing from information_schema.tables view #101696

Description

@clickgapai

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

Describe what's wrong

SELECT INDEX_LENGTH FROM information_schema.tables fails with UNKNOWN_IDENTIFIER, breaking the pattern where every column has both lowercase and UPPERCASE aliases

Root cause: tables.sql: INDEX_LENGTH was not added to the UPPERCASE column definitions (lines 13-18) nor to the SELECT aliases (lines 39-46), while all other columns have both lowercase and UPPERCASE versions

Why we believe this is a bug: tables.sql lines 13-18: The column definition lists TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, TABLE_ROWS, DATA_LENGTH, TABLE_COLLATION, TABLE_COMMENT — but INDEX_LENGTH is missing. Similarly the SELECT clause has no index_length AS INDEX_LENGTH alias.

Affected locations:

  • src/Storages/System/information_schema/tables.sql:17 — Missing INDEX_LENGTH in uppercase column definitions
  • src/Storages/System/information_schema/tables.sql:44 — Missing index_length AS INDEX_LENGTH in SELECT aliases

Impact: MySQL clients that query INFORMATION_SCHEMA.TABLES using uppercase INDEX_LENGTH will get an error. This breaks MySQL compatibility which is the stated goal of the PR.

Does it reproduce on most recent release?

Yes — confirmed on current master (commit 4bb74310a97c).

How to reproduce

SELECT INDEX_LENGTH FROM information_schema.tables WHERE table_schema = 'system' AND table_name = 'one' ORDER BY INDEX_LENGTH;

Try it on ClickHouse Fiddle

Expected behavior

0

Error message and/or stacktrace

Code: 47. DB::Exception: Unknown expression identifier `INDEX_LENGTH`

Additional context

Suggested fix: Add INDEX_LENGTH Nullable(UInt64) to the UPPERCASE column definitions, and add index_length AS INDEX_LENGTH to the SELECT aliases between DATA_LENGTH and TABLE_COLLATION.

Analysis details: Confidence HIGH | Severity P2 | Testability: STATELESS_SQL

Found during automated review of PR #78119.


ClickGapAI · Confidence: HIGH · Severity: P2 · Finding: h_pr78119_002

Version info

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions