{"record":{"id":"df564734f1073b79","repo":"vitessio/vitess","slug":"unable-to-resolve-table-name-s","errorCode":null,"errorMessage":"unable to resolve table name %s","messagePattern":"unable to resolve table name (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtexplain/vtexplain_vttablet.go","lineNumber":647,"sourceCode":"\t}\n\n\t// Gen4 supports more complex queries so we now need to\n\t// handle multiple FROM clauses\n\ttables := make([]*sqlparser.AliasedTableExpr, 0, len(selStmt.From))\n\tfor _, from := range selStmt.From {\n\t\ttables = append(tables, getTables(from)...)\n\t}\n\n\ttableColumnMap := map[sqlparser.IdentifierCS]map[string]querypb.Type{}\n\tfor _, table := range tables {\n\t\tif table == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\ttableName := sqlparser.String(sqlparser.GetTableName(table.Expr))\n\t\tcolumns, exists := t.vte.getGlobalTabletEnv().tableColumns[tableName]\n\t\tif !exists && tableName != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"unable to resolve table name %s\", tableName)\n\t\t}\n\n\t\tcolTypeMap := map[string]querypb.Type{}\n\n\t\tif table.As.IsEmpty() {\n\t\t\ttableColumnMap[sqlparser.GetTableName(table.Expr)] = colTypeMap\n\t\t} else {\n\t\t\ttableColumnMap[table.As] = colTypeMap\n\t\t}\n\n\t\tfor k, v := range columns {\n\t\t\tif colType, exists := colTypeMap[k]; exists {\n\t\t\t\tif colType != v {\n\t\t\t\t\treturn nil, fmt.Errorf(\"column type mismatch for column : %s, types: %d vs %d\", k, colType, v)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcolTypeMap[k] = v","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtexplain/vtexplain_vttablet.go#L629-L665","documentation":"When resolving the FROM tables of a select, vtexplain looks up each table name in the preloaded tableColumns map of the global tablet environment. If a table name is non-empty and not found there, it cannot determine column types for the simulated result and returns this error. This mirrors error 1220 but for the select-planning path.","triggerScenarios":"Explaining a SELECT whose FROM table is not present in the schema loaded into vtexplain (tableColumns map missing the key).","commonSituations":"SELECT referencing a table absent from the --schema input; wrong keyspace-qualified name; subquery or join referencing an undefined table; schema file outdated after a table rename.","solutions":["Add the missing table's CREATE TABLE to the vtexplain schema.","Correct the table name/keyspace qualifier in the SELECT.","Verify the schema file loaded actually contains all tables used in the workload."],"exampleFix":"// before\nselect * from missing_table; // not in schema\n// after\ncreate table missing_table (id int); // add to --schema\nselect * from missing_table;","handlingStrategy":"validation","validationCode":"for _, t := range fromTables(sel) {\n    name := sqlparser.String(sqlparser.GetTableName(t.Expr))\n    if _, ok := env.tableColumns[name]; !ok && name != \"\" {\n        return fmt.Errorf(\"table %s not in schema\", name)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"unable to resolve table name\") {\n    // regenerate schema file including the missing table, then retry\n}","preventionTips":["Regenerate the schema file after every DDL deployment.","Validate all workload tables against the schema before explaining.","Use fully qualified, correct keyspace.table names."],"tags":["vtexplain","schema","missing-table"],"backgroundTag":"schema-table-not-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}