Comments - storage/retrieval of ASCII(32)
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
It is because char(n) columns strip trailing spaces when selected. So chr(32), a single space, gets interpreted as the empty string. See here:
https://mariadb.com/kb/en/char/
" Trailing spaces are removed when CHAR values are retrieved"
You can set the SQL_MODE to include PAD_CHAR_TO_FULL_LENGTH to disable this behaviour and be able to select the chr(32):
You can also use VARCHAR(1) as a type instead of char(1), it doesn't strip trailing spaces and thus does not require setting the SQL_MODE.