Wietse Venema via Postfix-users: > Gerald Galster via Postfix-users: > > > > > 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. > > Thank you! > > > "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 = > > Grr. In the patch, > > cfg_get_int(stuff, "charset", "", 1, 0) > > should be > > cfg_get_int(stuff, "charset", "", 0, 0)
That should be cfg_get_str. Wietse > > 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. > > No problem, I am happy that the patch does not break something that > works without the patch. > > > +# .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/ > > I'll delete the comnment about "latin1" as it is MySQL version dependent. > > > Historically utf8 had been a mysql alias for utf8mb3: > > https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8mb3.html > > Again, thanks for what you could test. The error handling should > be better because the new code will no longer skip a connection > for 60s after every errror, but only after an error that involves a > really messed-up connection. > > Wietse > _______________________________________________ > Postfix-users mailing list -- postfix-users@postfix.org > To unsubscribe send an email to postfix-users-le...@postfix.org > _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org