Enhancement
Major
Detail
Major
Detail
Bugfix
Major
#26808
Replay migration with H2 fails with long CLOB and BLOB values
Similar to issue #26790, the length restriction of string literals in the H2 SQL dialect causes an SQL dump generated during replay migration to fail to import if the data contains long CLOB or BLOB values.
The SQL is generated correctly, but when it is imported into the new schema, the error Value too long for column "CHARACTER VARYING" occurs and the application does not start up.
Analysis
If you create a database dump with H2 using the built-in tools, the following construct is used to export long CLOB and BLOB values to SQL:
CREATE CACHED LOCAL TEMPORARY TABLE IF NOT EXISTS SYSTEM_LOB_STREAM(ID INT NOT NULL, PART INT NOT NULL, CDATA VARCHAR, BDATA VARBINARY); ALTER TABLE SYSTEM_LOB_STREAM ADD CONSTRAINT SYSTEM_LOB_STREAM_PRIMARY_KEY PRIMARY KEY(ID, PART); CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_CLOB FOR 'org.h2.command.dml.ScriptCommand.combineClob'; CREATE ALIAS IF NOT EXISTS SYSTEM_COMBINE_BLOB FOR 'org.h2.command.dml.ScriptCommand.combineBlob'; INSERT INTO SYSTEM_LOB_STREAM VALUES(4711, 0, "Long value part1", NULL); INSERT INTO SYSTEM_LOB_STREAM VALUES(4711, 1, "Long value part2", NULL); ... INSERT INTO "PUBLIC". "TL_PROPERTIES" VALUES (..., SYSTEM_COMBINE_CLOB(4711)); DROP TABLE IF EXISTS SYSTEM_LOB_STREAM; DROP ALIAS IF EXISTS SYSTEM_COMBINE_CLOB; DROP ALIAS IF EXISTS SYSTEM_COMBINE_BLOB;
The same scheme should be used for the TopLogic dump.
Test
- test-app-rewrite from #26798