{"record":{"id":"e2b5858c5c996faf","repo":"t8y2/dbx","slug":"table-name-is-ambiguous-s-s-specify-the-catalo","errorCode":null,"errorMessage":"table name is ambiguous: %s.%s; specify the catalog's exact case","messagePattern":"table name is ambiguous: (.+?)\\.(.+?); specify the catalog's exact case","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/xugu/main.go","lineNumber":3848,"sourceCode":"\tif err := rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn candidates, nil\n}\n\nfunc selectXuguCatalogTableName(schema, table string, candidates []xuguCatalogTableName) (string, string, error) {\n\tfor _, candidate := range candidates {\n\t\tif candidate.Schema == schema && candidate.Table == table {\n\t\t\treturn candidate.Schema, candidate.Table, nil\n\t\t}\n\t}\n\tif len(candidates) == 1 {\n\t\treturn candidates[0].Schema, candidates[0].Table, nil\n\t}\n\tif len(candidates) == 0 {\n\t\treturn \"\", \"\", fmt.Errorf(\"table not found: %s.%s\", schema, table)\n\t}\n\treturn \"\", \"\", fmt.Errorf(\"table name is ambiguous: %s.%s; specify the catalog's exact case\", schema, table)\n}\n\nfunc (s *server) getExplainInfo(sqlText string) (string, error) {\n\tif strings.TrimSpace(sqlText) == \"\" {\n\t\treturn \"\", errors.New(\"sql is required\")\n\t}\n\trows, err := s.queryRowsWithTimeoutOnce(\"EXPLAIN \"+trimStatementSQL(sqlText), nil, 0)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer s.closeRows(rows)\n\tcolumns, err := rows.Columns()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tvar builder strings.Builder\n\tfor rows.Next() {\n\t\tvalues, err := scanRow(rows, len(columns))","sourceCodeStart":3830,"sourceCodeEnd":3866,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/xugu/main.go#L3830-L3866","documentation":"When table resolution finds multiple case-insensitive candidates for schema.table, the driver cannot disambiguate and throws this error, asking for the catalog's exact case. This protects against generating DDL for the wrong object.","triggerScenarios":"Requesting DDL for 'orders' when the catalog holds both 'ORDERS' and 'Orders' tables in the same schema and the requested casing does not exactly match either.","commonSituations":"Mixed-case quoted identifiers created in the catalog; tools that created duplicate tables with different casing; a caller using lowercase names against a catalog storing uppercase.","solutions":["Retry with the exact catalog casing (check ALL_TABLES for stored TABLE_NAME).","Drop or rename the duplicate case-variant table.","Standardize unquoted (upper/lower) identifier conventions in your schema."],"exampleFix":"// before\nddl, err := srv.GetTableDDL(\"app\", \"orders\") // ORDERS and Orders both exist\n\n// after\nddl, err := srv.GetTableDDL(\"app\", \"ORDERS\") // exact match wins","handlingStrategy":"validation","validationCode":"rows, _ := db.Query(`SELECT TABLE_NAME FROM ALL_TABLES WHERE UPPER(TABLE_NAME)=UPPER(?)`, table)\nvar variants []string\nfor rows.Next() { var t string; rows.Scan(&t); variants = append(variants, t) }\nrows.Close()\nif len(variants) > 1 { return fmt.Errorf(\"ambiguous table name, catalog has: %v\", variants) }","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"table name is ambiguous\") { return resolveWithExactCase(table) }","preventionTips":["Adopt a single-case identifier convention (e.g. all unquoted uppercase).","Rename or drop case-variant duplicates.","Pass exact catalog casing when calling DDL APIs."],"tags":["database","table","ambiguity","case-sensitivity"],"backgroundTag":"ambiguous-identifier","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}