t8y2/dbx · error

sequence name is ambiguous: %s.%s; specify the catalog's exa

Error message

sequence name is ambiguous: %s.%s; specify the catalog's exact case

What it means

When the sequence-name lookup matches multiple catalog entries differing only by case, the resolver refuses to guess and returns 'sequence name is ambiguous: <schema>.<name>; specify the catalog's exact case'. The caller must supply the exact casing stored in the catalog.

Source

Thrown at agents/drivers/xugu/main.go:3514

	if err := rows.Err(); err != nil {
		return nil, err
	}
	return candidates, nil
}

func selectXuguCatalogSequenceName(schema, name string, candidates []xuguCatalogSequenceName) (string, string, error) {
	for _, candidate := range candidates {
		if candidate.Schema == schema && candidate.Name == name {
			return candidate.Schema, candidate.Name, nil
		}
	}
	if len(candidates) == 1 {
		return candidates[0].Schema, candidates[0].Name, nil
	}
	if len(candidates) == 0 {
		return "", "", fmt.Errorf("sequence not found: %s.%s", schema, name)
	}
	return "", "", fmt.Errorf("sequence name is ambiguous: %s.%s; specify the catalog's exact case", schema, name)
}

func renderXuguSequenceDDL(sequence xuguSequenceMetadata) string {
	var builder strings.Builder
	builder.WriteString("CREATE SEQUENCE ")
	builder.WriteString(quoteIdentifier(sequence.Schema))
	builder.WriteByte('.')
	builder.WriteString(quoteIdentifier(sequence.Name))

	if value := xuguSequenceNumber(sequence.Step); value != "" {
		builder.WriteString("\n  INCREMENT BY ")
		builder.WriteString(value)
	}
	if value := xuguSequenceNumber(sequence.Current); value != "" {
		builder.WriteString("\n  START WITH ")
		builder.WriteString(value)
	}
	if value := xuguSequenceNumber(sequence.Minimum); value != "" {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Re-request using the exact catalog casing for schema and name as shown in the sequence listing/error.
  2. Drop or rename the duplicate-case sequence so the name is unique.
  3. Enumerate the candidates and select the intended sequence explicitly in tooling.

Example fix

// before
getSequenceDDL("app", "order_seq") // ambiguous: "Order_Seq" also exists
// after
getSequenceDDL("app", "Order_Seq") // exact catalog case
Defensive patterns

Strategy: validation

Validate before calling

seqs := listSequences(schema)
matches := filterByFold(seqs, name)
if len(matches) > 1 {
  return fmt.Errorf("ambiguous %s.%s; candidates %v", schema, name, matches)
}

Try / catch

if err := getSequenceDDL(schema, name); err != nil {
  if strings.Contains(err.Error(), "ambiguous") {
    schema, name = exactCaseCandidateFromCatalog(schema, name)
    getSequenceDDL(schema, name)
  }
}

Prevention

When it happens

Trigger: Resolving schema.name where multiple case-variant entries exist (e.g. 'app.Order_Seq' and 'app.order_seq') and the requested form does not uniquely identify one.

Common situations: Sequences created by different tools with inconsistent casing; quoted/unquoted identifier mixes in DDL history; case-sensitive catalog on Xugu after a migration.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/0a93f688b7cc775c. Report an issue: GitHub.