> Wietse Venema via Postfix-users <postfix-users@postfix.org>: > >>> My conclusion to hard-solve this issue on my system is transform all >>> tables to utf8mb4. >>> >>> But: > >>> - I don't see any option to change default charset on mysql_table >>> connector, maybe should be interesting add this option on configuration >>> file. >> >> Is there such an API? > > Based on documentation, perhaps mysql_set_character_set() can do that. > https://dev.mysql.com/doc/c-api/8.0/en/mysql-set-character-set.html > > Attached is patch 20230417-mysql-charset-patch.txt that adds a > "charset" parameter to the Postfix MySQL configuration file.
I've patched postfix 3.7.4 on a low volume server. "charset" has to be present and defined in all mysql configs, otherwise startup fails: (no backwards compatibility) postfix/proxymap[3996]: fatal: /etc/postfix/test.mysql.cf: bad string length 0 < 1: charset = postfix/smtpd[3995]: warning: dict_proxy_open: service proxymap: Application error postfix/master[3989]: warning: process /usr/libexec/postfix/proxymap pid 3996 exit status 1 postfix/master[3989]: warning: /usr/libexec/postfix/proxymap: bad command startup -- throttling Setting "charset" to the non-default cp1250 works (from mysql general_log): (terminal encoding utf8) # postmap -q "blü.com" mysql:/etc/postfix/relay_domains.mysql.cf Connect postfix@localhost on postfix using Socket Query SET NAMES cp1250 Query SELECT destination as relaydestination FROM relay WHERE domain = 'blü.com' Quit (postfix restart) (terminal encoding latin1) # postmap -q "bl?.com" mysql:/etc/postfix/relay_domains.mysql.cf Connect postfix@localhost on postfix using Socket Query SET NAMES cp1250 Query SELECT destination as relaydestination FROM relay WHERE domain = 'blü.com' Unfortunately I can't help with mix collation error as this mysql 8 instance is configured with utf8mb4/utf8_bin, skip-character-set-client-handshake and all tables are utf8mb4. I could not trigger a collation error. +++ ./proto/mysql_table 2023-04-17 11:24:16.000000000 -0400 @@ -79,6 +79,11 @@ # .nf # dbname = customer_database # .fi +# .IP "\fBcharset\fR (empty for backwards compatibility)" +# The default client character set (and implicitly, the +# collation order). According to MySQL documentation the +# built-in default is "latin1"; for SMTP, "utf8" would be +# more appropriate. As of mysql 8.0 the default character set is utf8mb4: https://dev.mysql.com/blog-archive/mysql-8-0-collations-migrating-from-older-collations/ Historically utf8 had been a mysql alias for utf8mb3: https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html Best regards, Gerald _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org