← Back to team overview

maria-discuss team mailing list archive

Re: Collations, trailing spaces and unique indexes


Binarus <lists@xxxxxxxxxx> writes:

> "All MySQL collations are of type PADSPACE. This means that all CHAR,
> VARCHAR, and TEXT values in MySQL are compared without regard to any
> trailing spaces. “Comparison” in this context does not include the

Yes, I have always found this terminally stupid as well. But I think it
comes from the SQL standard.

The only workaround I know of is to use VARBINARY instead of VARCHAR. I
think it works much the same in most respects. But obviously some semantics
is lost when the server no longer is aware of the character set used.

> Since the index behaviour obviously depends on the collation, would
> building an own collation which does not PADSPACE be an option? I have

That would be interesting, actually. I don't know what support there is for
non-PADSPACE collations. Maybe bar knows (Cc:'ed)?

 - Kristian.

Follow ups