databendlabs/databend · error

not implemented

Error message

not implemented

What it means

The immutable (system database) catalog implements the Catalog trait but index management is meaningless for system tables, so `create_table_index` is a stub that panics with `unimplemented!`. This is a guard: the system catalog never supports creating indexes.

Solutions

  1. Do not create indexes on system database tables; run the CREATE INDEX against a regular user database table instead
  2. If a tool is doing this automatically, exclude the system catalog from its index-maintenance scope
  3. If user-facing SQL should reject this gracefully, file an issue so the stub returns ErrorCode::Unimplemented instead of panicking

Example fix

-- before
CREATE INDEX idx ON system.one(id);
-- after: indexes only apply to user tables
CREATE INDEX idx ON my_db.my_table(id);
Defensive patterns

Strategy: validation

Validate before calling

if (statement.targetDatabase === "system" || statement.targetDatabase.startsWith("system.")) {
  throw new Error("Index operations are not allowed on the system database");
}

Type guard

function isSystemDatabase(dbName) {
  return String(dbName).toLowerCase() === "system";
}

Prevention

When it happens

Trigger: Calling CREATE INDEX (or an index-mutating API) against a system database table (tables in the `system` catalog backed by ImmutableCatalog), reaching ImmutableCatalog::create_table_index.

Common situations: Trying to CREATE INDEX on a `system.*` table; tooling or scripts that generically apply index creation across all tables including system ones.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/1a6d01a3d4a9cc71. Report an issue: GitHub.

Appendix: source

Thrown at src/query/service/src/catalogs/default/immutable_catalog.rs:462

            "Cannot rename table in system database",
        ))
    }

    #[async_backtrace::framed]
    async fn swap_table(&self, _req: SwapTableReq) -> Result<SwapTableReply> {
        Err(ErrorCode::Unimplemented(
            "Cannot swap table in system database",
        ))
    }

    async fn commit_table_meta(&self, _req: CommitTableMetaReq) -> Result<CommitTableMetaReply> {
        Err(ErrorCode::Unimplemented(
            "cannot commit_table_meta in system database",
        ))
    }

    async fn create_table_index(&self, _req: CreateTableIndexReq) -> Result<()> {
        unimplemented!()
    }

    async fn drop_table_index(&self, _req: DropTableIndexReq) -> Result<()> {
        unimplemented!()
    }

    #[async_backtrace::framed]
    async fn get_table_copied_file_info(
        &self,
        _tenant: &Tenant,
        _db_name: &str,
        req: GetTableCopiedFileReq,
    ) -> Result<GetTableCopiedFileReply> {
        Err(ErrorCode::Unimplemented(format!(
            "get_table_copied_file_info not allowed for system database {:?}",
            req
        )))
    }

View on GitHub (pinned to 288d84d76e)