ambiguousNames property

List<String> get ambiguousNames

Names that differ only in case, and so cannot be resolved by folding.

Empty for almost every database. When it is not, a tool has to say so rather than quietly choose one of the two: folding a case-sensitive database's names together generates code for the wrong table.

Implementation

List<String> get ambiguousNames {
  final seen = <String, String>{};
  final clashes = <String>[];
  for (final table in tables) {
    final folded = table.qualifiedName.toLowerCase();
    final first = seen[folded];
    if (first != null && first != table.qualifiedName) {
      clashes.add('$first / ${table.qualifiedName}');
    } else {
      seen[folded] = table.qualifiedName;
    }
  }
  return clashes;
}