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

jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ea3052d1a3 Fix: Adding the time column is prohibited. (#17215)
6ea3052d1a3 is described below

commit 6ea3052d1a3087bb50278f89beffb71d72c37dae
Author: alpass163 <[email protected]>
AuthorDate: Tue Feb 24 15:17:36 2026 +0800

    Fix: Adding the time column is prohibited. (#17215)
---
 .../it/schema/IoTDBTableWithDefinedTimeIT.java     | 22 ++++++++++++++++++++++
 .../execution/config/TableConfigTaskVisitor.java   |  3 +++
 2 files changed, 25 insertions(+)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableWithDefinedTimeIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableWithDefinedTimeIT.java
index 0d37085ad48..6d260f1af54 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableWithDefinedTimeIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableWithDefinedTimeIT.java
@@ -227,4 +227,26 @@ public class IoTDBTableWithDefinedTimeIT {
       fail(e.getMessage());
     }
   }
+
+  @Test
+  public void testAddTimeColumn() {
+    try (final Connection connection =
+            EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
+        final Statement statement = connection.createStatement()) {
+      statement.execute("use " + TABLE_DATABASE);
+
+      try {
+        statement.execute(
+            "create table table_time(device string tag, s1 int32 field, 
record_time timestamp time)");
+        statement.execute("alter table table_time add column d_datetime 
timestamp time");
+        fail("Add the TIME column should not be supported");
+      } catch (SQLException e) {
+        assertEquals("701: Adding TIME column is not supported.", 
e.getMessage());
+      }
+
+    } catch (SQLException e) {
+      e.printStackTrace();
+      fail(e.getMessage());
+    }
+  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
index aa1f43d95ea..c2f903398e2 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
@@ -722,6 +722,9 @@ public class TableConfigTaskVisitor extends 
AstVisitor<IConfigTask, MPPQueryCont
         context.getSession().getUserName(), new QualifiedObjectName(database, 
tableName), context);
 
     final ColumnDefinition definition = node.getColumn();
+    if (definition.getColumnCategory() == TsTableColumnCategory.TIME) {
+      throw new SemanticException("Adding TIME column is not supported.");
+    }
     return new AlterTableAddColumnTask(
         database,
         tableName,

Reply via email to