How Collation Mapping Works

Describes the lookup and candidate selection logic used to resolve a MySQL/MariaDB collation for each EDB text column.

Lookup Keys

Each text column (CHAR, VARCHAR, CLOB) is resolved using four keys:

Key Description
DB type csANSI or csUnicode — the EDB session character set
Family binary for UNI/ANSI bases; locale for named locale bases (PTG, ENU, DEU, …)
Target charset The charset selected on the Target Database tab (e.g. utf8mb4)
Modifiers Normalised EDB modifiers: '', _CI, _AI, or _CI_AI (_KI and _WI are dropped)

Candidate Selection

Each map entry contains two ordered candidate lists — one for MySQL, one for MariaDB. The converter picks the first candidate that:

  1. Satisfies its eligibility condition, and
  2. Is present on the connected server (when Server settings is active on the Target Database tab).

Eligibility Conditions

Condition When used
(empty — Always) Unconditionally. Every entry must have at least one Always candidate as the final fallback.
If AI-safe Only when mapping to an accent-insensitive collation cannot break uniqueness.
If CI-safe Only when mapping to a case-insensitive collation cannot break uniqueness.
If AI-safe and CI-safe Only when both conditions are met.

AI-safe — a column is AI-safe when it does not participate in a PRIMARY KEY or UNIQUE constraint, or when its EDB collation already has the _AI modifier on a locale base. Columns outside unique constraints are always AI-safe.

CI-safe — analogous: a column in a unique constraint is CI-safe only if its EDB collation already has _CI.

If No accented characters in CHAR/VARCHAR is checked on the Source Database tab, all columns are treated as AI-safe.

Typical candidate list for a _CI entry:

1. utf8mb4_0900_ai_ci  — If AI-safe and CI-safe   (best: CI + AI)
2. utf8mb4_unicode_ci  — If CI-safe                (CI only, accent-sensitive)
3. utf8mb4_general_ci  — Always                    (safe fallback)

Fallback Behaviour

When no map entry exists for the key combination, or all candidates fail:

  1. A warning is emitted identifying the EDB collation that could not be mapped.
  2. The column receives the table-level default collation (from the Target Database tab).

This always produces a valid script, but the column’s sort order may differ from the original EDB behaviour.

COLLATE Clause Emission

A COLLATE clause is emitted only when the resolved collation differs from the table default.
Columns that match the table default inherit it implicitly — no explicit COLLATE clause is added.

Source Collation Inference

When a column has no explicit EDB collation (inherited at table level), EDB2MySQL uses the most frequently occurring collation in the source database as a proxy. This dominant collation is shown in the Collation Analysis panel on the Source Database tab.

See Also

(C) 2026 Easygate, Lda