mirror of
https://github.com/dataelement/bisheng.git
synced 2026-09-01 15:32:50 +08:00
755e67058b
Joining spaces to their members casts Knowledge.id to text, and on MySQL that cast carries `collation_connection` — utf8mb4_0900_ai_ci on a stock MySQL 8 — while space_channel_member.business_id carries the table's utf8mb4_unicode_ci. Two IMPLICIT collations that differ make MySQL raise 1267 rather than run the join, so the endpoint returned a 500. StrJoinKey renders the cast with an EXPLICIT `COLLATE utf8mb4_unicode_ci` on MySQL, which outranks whatever the other side carries; the keys are digit strings, so no utf8mb4 collation orders them differently. Other dialects keep the plain cast — DaMeng has no per-column collation to clash with and would reject the clause outright. The container config was meant to prevent this and did not: - `SET collation_connection = x, NAMES utf8mb4` undoes itself, because `SET NAMES` resets the collation to the charset's default. It becomes one statement: `SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci`. - init_connect is skipped entirely for users with SUPER / CONNECTION_ADMIN, and BiSheng connects as root — so skip-character-set-client-handshake is required, not the optional extra its commented-out line implied. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>