{"record":{"id":"440469bbbbc57b54","repo":"t8y2/dbx","slug":"synonym-name-is-ambiguous-s-s-specify-the-cata","errorCode":null,"errorMessage":"synonym name is ambiguous: %s.%s; specify the catalog's exact case","messagePattern":"synonym name is ambiguous: (.+?)\\.(.+?); specify the catalog's exact case","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/xugu/main.go","lineNumber":3688,"sourceCode":"\t\t}\n\t\tcandidates = append(candidates, candidate)\n\t}\n\treturn candidates, rows.Err()\n}\n\nfunc selectXuguCatalogSynonym(schema, name string, candidates []xuguCatalogSynonym) (xuguCatalogSynonym, error) {\n\tfor _, candidate := range candidates {\n\t\tif candidate.Schema == schema && candidate.Name == name {\n\t\t\treturn candidate, nil\n\t\t}\n\t}\n\tif len(candidates) == 1 {\n\t\treturn candidates[0], nil\n\t}\n\tif len(candidates) == 0 {\n\t\treturn xuguCatalogSynonym{}, fmt.Errorf(\"synonym not found: %s.%s\", schema, name)\n\t}\n\treturn xuguCatalogSynonym{}, fmt.Errorf(\"synonym name is ambiguous: %s.%s; specify the catalog's exact case\", schema, name)\n}\n\nfunc xuguSequenceNumber(value any) string {\n\treturn strings.TrimSpace(xuguString(value))\n}\n\nfunc (s *server) getTableDDL(schema, table string) (string, error) {\n\t// Resolve the catalog's stored casing before issuing exact metadata lookups,\n\t// so emitted DDL quotes the original names and preserves double-quoted\n\t// schema/table/column spellings.\n\tif strings.TrimSpace(schema) != \"\" {\n\t\tif err := s.setSchema(schema); err != nil {\n\t\t\tif !isXuguMetadataAccessError(err) {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t}\n\t}\n\tcatalogSchema, catalogTable, err := s.resolveCatalogTableName(schema, table)","sourceCodeStart":3670,"sourceCodeEnd":3706,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/xugu/main.go#L3670-L3706","documentation":"When resolveCatalogSynonym finds more than one synonym matching schema.name case-insensitively, it cannot pick one and throws this error, telling the caller to specify the catalog's exact case. Ambiguity arises because the catalog stores multiple rows differing only by identifier case.","triggerScenarios":"Calling the synonym DDL/source path with a name like 'orders' when the catalog contains both 'ORDERS' and 'Orders' synonyms in the same schema, and neither exact-cases match the requested string.","commonSituations":"Objects created with quoted mixed-case identifiers on a case-sensitive catalog; migration tools that duplicated objects with different casing; querying with the wrong casing so the exact-match pass misses and the fallback matches many rows.","solutions":["Re-send the request with the synonym's exact catalog casing (query ALL_SYNONYMS to see the stored name).","Drop the duplicate synonyms so only one case variant remains.","If the tooling generates names programmatically, normalize identifier casing consistently when creating objects."],"exampleFix":"// before\nddl, err := srv.GetObjectDDL(\"APP\", \"orders\") // matches ORDERS and Orders\n\n// after\nddl, err := srv.GetObjectDDL(\"APP\", \"Orders\") // exact catalog casing","handlingStrategy":"validation","validationCode":"rows, _ := db.Query(`SELECT SCHEMA_NAME, SYNONYM_NAME FROM ALL_SYNONYMS WHERE UPPER(SCHEMA_NAME)=UPPER(?) AND UPPER(SYNONYM_NAME)=UPPER(?)`, schema, name)\nvar matches []string\nfor rows.Next() { var s, n string; rows.Scan(&s, &n); matches = append(matches, s+\".\"+n) }\nrows.Close()\nif len(matches) > 1 { return fmt.Errorf(\"ambiguous synonym; exact matches: %v\", matches) }","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"synonym name is ambiguous\") {\n    // re-run with exact casing after listing candidates\n    return retryWithExactCase(schema, name)\n}","preventionTips":["Avoid quoted mixed-case identifiers when creating objects.","Deduplicate case-variant synonyms in the schema.","Always request objects with their exact stored catalog casing."],"tags":["database","synonym","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-14T00:17:10.932Z"}