This is an automated email from the ASF dual-hosted git repository.

yuqi1129 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new c60b82cc63 [#12038] improvement(scripts): increase relational store 
column comment length limit to 4096 (#12047)
c60b82cc63 is described below

commit c60b82cc63348336536008f14ed01dc5e70b0c3a
Author: jarred0214 <[email protected]>
AuthorDate: Mon Jul 20 11:10:23 2026 +0800

    [#12038] improvement(scripts): increase relational store column comment 
length limit to 4096 (#12047)
    
    ### What changes were proposed in this pull request?
    
    This PR increases the `table_column_version_info.column_comment` length
    from `VARCHAR(256)` to `VARCHAR(4096)` for all relational store
    backends:
    
    - MySQL
    - H2
    - PostgreSQL
    
    It updates both schema initialization scripts and upgrade scripts so
    newly initialized databases and upgraded existing databases use the same
    column comment length.
    
    ### Why are the changes needed?
    
    Importing an external table can fail when a column comment is longer
    than 256 characters because Gravitino stores column metadata in
    `table_column_version_info.column_comment`.
    
    Increasing the column length to 4096 follows the discussion in #12038
    and avoids import failures for most practical column comments. For
    comments larger than 4096, users can still customize their database
    schema definition.
    
    Fix: #12038
    
    ### Does this PR introduce _any_ user-facing change?
    
    No API or configuration changes.
    
    The relational store schema now supports column comments up to 4096
    characters in `table_column_version_info`.
    
    ### How was this patch tested?
    
    - Verified all `table_column_version_info.column_comment` definitions in
    MySQL, H2, and PostgreSQL schema scripts are updated to `VARCHAR(4096)`.
    - Verified related upgrade scripts include column type migration
    statements.
    - Ran `git diff --check`.
    
    ---------
    
    Co-authored-by: jarred0214 <[email protected]>
---
 scripts/h2/schema-2.0.0-h2.sql                           | 2 +-
 scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql                 | 3 +++
 scripts/mysql/schema-2.0.0-mysql.sql                     | 2 +-
 scripts/mysql/upgrade-1.3.0-to-2.0.0-mysql.sql           | 3 +++
 scripts/postgresql/schema-2.0.0-postgresql.sql           | 2 +-
 scripts/postgresql/upgrade-1.3.0-to-2.0.0-postgresql.sql | 3 +++
 6 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/h2/schema-2.0.0-h2.sql b/scripts/h2/schema-2.0.0-h2.sql
index 8b2bb32b9a..08ea0bcd20 100644
--- a/scripts/h2/schema-2.0.0-h2.sql
+++ b/scripts/h2/schema-2.0.0-h2.sql
@@ -95,7 +95,7 @@ CREATE TABLE IF NOT EXISTS `table_column_version_info` (
     `column_name` VARCHAR(128) NOT NULL COMMENT 'column name',
     `column_position` INT UNSIGNED NOT NULL COMMENT 'column position, starting 
from 0',
     `column_type` CLOB NOT NULL COMMENT 'column type',
-    `column_comment` VARCHAR(256) DEFAULT '' COMMENT 'column comment',
+    `column_comment` VARCHAR(4096) DEFAULT '' COMMENT 'column comment',
     `column_nullable` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'column nullable, 
0 is not nullable, 1 is nullable',
     `column_auto_increment` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'column auto 
increment, 0 is not auto increment, 1 is auto increment',
     `column_default_value` CLOB DEFAULT NULL COMMENT 'column default value',
diff --git a/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql 
b/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql
index a05b05c59c..16ea9b0392 100644
--- a/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql
+++ b/scripts/h2/upgrade-1.3.0-to-2.0.0-h2.sql
@@ -24,3 +24,6 @@ ALTER TABLE `group_meta` ADD COLUMN `external_id` 
VARCHAR(256) DEFAULT NULL COMM
 
 CREATE UNIQUE INDEX IF NOT EXISTS `uk_mid_ueid_del` ON `user_meta` 
(`metalake_id`, `external_id`, `deleted_at`);
 CREATE UNIQUE INDEX IF NOT EXISTS `uk_mid_geid_del` ON `group_meta` 
(`metalake_id`, `external_id`, `deleted_at`);
+
+ALTER TABLE `table_column_version_info`
+    ALTER COLUMN `column_comment` VARCHAR(4096) DEFAULT '';
diff --git a/scripts/mysql/schema-2.0.0-mysql.sql 
b/scripts/mysql/schema-2.0.0-mysql.sql
index a1822aca69..06ac92625b 100644
--- a/scripts/mysql/schema-2.0.0-mysql.sql
+++ b/scripts/mysql/schema-2.0.0-mysql.sql
@@ -90,7 +90,7 @@ CREATE TABLE IF NOT EXISTS `table_column_version_info` (
     `column_name` VARCHAR(128) NOT NULL COMMENT 'column name',
     `column_position` INT UNSIGNED NOT NULL COMMENT 'column position, starting 
from 0',
     `column_type` TEXT NOT NULL COMMENT 'column type',
-    `column_comment` VARCHAR(256) DEFAULT '' COMMENT 'column comment',
+    `column_comment` VARCHAR(4096) DEFAULT '' COMMENT 'column comment',
     `column_nullable` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'column nullable, 
0 is not nullable, 1 is nullable',
     `column_auto_increment` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'column auto 
increment, 0 is not auto increment, 1 is auto increment',
     `column_default_value` TEXT DEFAULT NULL COMMENT 'column default value',
diff --git a/scripts/mysql/upgrade-1.3.0-to-2.0.0-mysql.sql 
b/scripts/mysql/upgrade-1.3.0-to-2.0.0-mysql.sql
index 6d4c22a17e..db34c6e179 100644
--- a/scripts/mysql/upgrade-1.3.0-to-2.0.0-mysql.sql
+++ b/scripts/mysql/upgrade-1.3.0-to-2.0.0-mysql.sql
@@ -26,3 +26,6 @@ ALTER TABLE `group_meta`
 
 CREATE UNIQUE INDEX `uk_mid_ueid_del` ON `user_meta` (`metalake_id`, 
`external_id`, `deleted_at`);
 CREATE UNIQUE INDEX `uk_mid_geid_del` ON `group_meta` (`metalake_id`, 
`external_id`, `deleted_at`);
+
+ALTER TABLE `table_column_version_info`
+    MODIFY COLUMN `column_comment` VARCHAR(4096) DEFAULT '' COMMENT 'column 
comment';
diff --git a/scripts/postgresql/schema-2.0.0-postgresql.sql 
b/scripts/postgresql/schema-2.0.0-postgresql.sql
index b73f94cc5e..a7d82cc547 100644
--- a/scripts/postgresql/schema-2.0.0-postgresql.sql
+++ b/scripts/postgresql/schema-2.0.0-postgresql.sql
@@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS table_column_version_info (
     column_name VARCHAR(128) NOT NULL,
     column_position INT NOT NULL,
     column_type TEXT NOT NULL,
-    column_comment VARCHAR(256) DEFAULT '',
+    column_comment VARCHAR(4096) DEFAULT '',
     column_nullable SMALLINT NOT NULL DEFAULT 1,
     column_auto_increment SMALLINT NOT NULL DEFAULT 0,
     column_default_value TEXT DEFAULT NULL,
diff --git a/scripts/postgresql/upgrade-1.3.0-to-2.0.0-postgresql.sql 
b/scripts/postgresql/upgrade-1.3.0-to-2.0.0-postgresql.sql
index 0d781f2836..8c9cd7556c 100644
--- a/scripts/postgresql/upgrade-1.3.0-to-2.0.0-postgresql.sql
+++ b/scripts/postgresql/upgrade-1.3.0-to-2.0.0-postgresql.sql
@@ -28,3 +28,6 @@ COMMENT ON COLUMN group_meta.external_id IS 'external 
identifier from an upstrea
 
 CREATE UNIQUE INDEX IF NOT EXISTS uk_mid_ueid_del ON user_meta (metalake_id, 
external_id, deleted_at);
 CREATE UNIQUE INDEX IF NOT EXISTS uk_mid_geid_del ON group_meta (metalake_id, 
external_id, deleted_at);
+
+ALTER TABLE table_column_version_info
+    ALTER COLUMN column_comment TYPE VARCHAR(4096);

Reply via email to