我使用MariaDB 10.6.16,但照搬了10.3.39的同样行为。 我的问题是这个小 SQL子:
CREATE TABLE problem (
text TEXT
) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
INSERT INTO problem (text) VALUES ( ? );
This results in the error message:
ERROR 1366 (22007) at line 5: Incorrect string value: xF0xA4x8BxAE for column `problem`.`text` at row 1
The bytes xF0xA4x8BxAE
确切地说,这就是说,MariaDB不允许插入这一特殊性。
我所尝试的是:
- checking the character. It’s U+242EE, an ancient Unicode character defined in 2001. So it shouldn’t be a problem with too new a code point for the collation.
- checking two MariaDB versions, as noted above.
- removing the collation and charset from the table definition. No change.
- using other 4 byte characters in the SQL query. They work just fine, it’s only this (and possibly some other random CJK characters, too).
我怎么能说服马里亚行将这种性质插入我的行?