'A strange problem with MariaDB text,losing data
In some cases, MariaDB will lose the data of the text field. My table is
create table tt(
id int(11) AUTO_INCREMENT PRIMARY KEY ,
info text
)
My SQL is
update tt join
(select 'StringValue' as info , 1 as id ) a using(id)
set tt.info = a.info
The StringValue is a string data that more than 65535 bytes;
I can execute this SQL successfully using Java JDBC, but only a few bytes can be written.
For example, StringValue is a String data with 65538 bytes, after executing the SQL, tt.info has only 2 bytes.
My MariaDB version is 10.4.7, innodb_page_size is 16kb.
Solution 1:[1]
That seems to be simply this:
UPDATE tt
SET info = 'StringValue'
WHERE id = 1;
But, if the string is bigger than TEXT can hold, it will either give a warning or an error, depending on some setting. Is that what you are asking about? Does the code check for warnings and errors?
If you change the column definition from TEXT to MEDIUMTEXT, the limit is 16MB instead of 64KB. (Both of those numbers are in bytes, not characters.
You say it has 2 bytes -- do they happen to be the last 2 bytes?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
