Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Field TEXT can't accept \u0000 NULL value
Database: Postgres 15
Liferay: DXP 7.4u92
Java class: com.liferay.dynamic.data.mapping.internal.upgrade.v4_1_0.DDMFieldUpgradeProcess
During migration, this class is utilized to separate the JSON data from DDMContent.data_ into DDMField and DDMFieldAttribute.
When DDMContent contains data_ like this:
{"availableLanguageIds":["it_IT"],"defaultLanguageId":"it_IT","fieldValues":[{"instanceId":"L4xqe9dP","name":"ClimateForcast_COMMENT","value":"File written by Adobe Photoshop 4.0\u0000"},{"instanceId":"nq3RkDSI","name":"HttpHeaders_CONTENT_TYPE","value":"image/jpeg"},{"instanceId":"Qbqjc3nB","name":"TIFF_BITS_PER_SAMPLE","value":"8"},{"instanceId":"kMOaW2J4","name":"TIFF_IMAGE_LENGTH","value":"3480"},{"instanceId":"uaqwPXo9","name":"TIFF_IMAGE_WIDTH","value":"2441"}]}
When attempting to insert DDMField and DDMFieldAttribute, the error occurred:
ERROR: invalid byte sequence for encoding "UTF8": 0x00_
In this case, it's important to escape these strings to ensure the migration proceeds without interruption. Alternatively, if this data is generated from existing documents in DL, it there the possibility to clear it before migration and regenerate it in the current Liferay version?
The workaround to complete the migration was:
update ddmcontent set data_ = regexp_replace(data_::text, '(?<!\\)\\u0000', '', 'g')::json
Bug Report Created: https://liferay.atlassian.net/browse/LPD-18801
Powered by Liferay™