This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iotdb-docs.git
The following commit(s) were added to refs/heads/main by this push:
new 6ec8c0b7 custom name time column when creating a table (#1025)
6ec8c0b7 is described below
commit 6ec8c0b7f533199d40535d160f105d2372b18a30
Author: leto-b <[email protected]>
AuthorDate: Tue Mar 31 17:09:10 2026 +0800
custom name time column when creating a table (#1025)
---
.../Table/Basic-Concept/Table-Management_apache.md | 43 ++++++++++++++++------
.../Basic-Concept/Table-Management_timecho.md | 43 ++++++++++++++++------
.../SQL-Manual/SQL-Metadata-Operations_apache.md | 7 ++++
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 7 ++++
.../Table/User-Manual/Tree-to-Table_apache.md | 20 ++++++++++
.../Table/User-Manual/Tree-to-Table_timecho.md | 20 ++++++++++
.../Basic-Concept/Table-Management_apache.md | 43 ++++++++++++++++------
.../Basic-Concept/Table-Management_timecho.md | 43 ++++++++++++++++------
.../SQL-Manual/SQL-Metadata-Operations_apache.md | 7 ++++
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 7 ++++
.../User-Manual/Tree-to-Table_apache.md | 20 ++++++++++
.../User-Manual/Tree-to-Table_timecho.md | 20 ++++++++++
.../Table/Basic-Concept/Table-Management_apache.md | 34 +++++++++++------
.../Basic-Concept/Table-Management_timecho.md | 23 +++++++++---
.../SQL-Manual/SQL-Metadata-Operations_apache.md | 7 ++++
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 7 ++++
.../Table/User-Manual/Tree-to-Table_apache.md | 18 +++++++++
.../Table/User-Manual/Tree-to-Table_timecho.md | 20 ++++++++++
.../Basic-Concept/Table-Management_apache.md | 34 +++++++++++------
.../Basic-Concept/Table-Management_timecho.md | 23 +++++++++---
.../SQL-Manual/SQL-Metadata-Operations_apache.md | 7 ++++
.../SQL-Manual/SQL-Metadata-Operations_timecho.md | 7 ++++
.../User-Manual/Tree-to-Table_apache.md | 18 +++++++++
.../User-Manual/Tree-to-Table_timecho.md | 20 ++++++++++
24 files changed, 420 insertions(+), 78 deletions(-)
diff --git
a/src/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
b/src/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
index 4b9a9c55..6fad824a 100644
--- a/src/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
+++ b/src/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
@@ -66,17 +66,31 @@ comment
**Note:**
-1. If the time column (`TIME`) is not specified, IoTDB automatically adds one.
Other columns can be added using the `enable_auto_create_schema` configuration
or session interface commands.
-2. Column categories default to `FIELD` if not specified. `TAG` and
`ATTRIBUTE` columns must be of type `STRING`.
-3. Table `TTL` defaults to the database `TTL`. You can omit this property or
set it to `default` if the default value is used.
-4. `<TABLE_NAME>`:
- 1. Case-insensitive. After creation, it will be displayed uniformly in
lowercase.
- 2. Can include special characters such as `~!`"`%`, etc.
- 3. Names with special or Chinese characters must be enclosed in double
quotes (`""`).
- 4. Outer double quotes are not retained in the final table name. For
example: `"a""b"` becomes `a"b`.
- 5. Note: In SQL, table or column names with special characters or Chinese
characters must be wrapped in double quotes. However, in the native API, do not
add extra quotes—otherwise, the quotation marks will become part of the name
itself.
-5. **`columnDefinition`**: Column names share the same characteristics as
table names and can include special characters such as `.`.
-6. COMMENT adds comments to the table.
+1. When creating a table, you do not need to specify a time column. IoTDB
automatically adds a column named "time" and places it as the first column. All
other columns can be added by enabling the `enable_auto_create_schema` option
in the database configuration, or through the session interface for automatic
creation or by using table modification statements.
+2. Since version V2.0.8, tables support custom naming of the time column
during creation. The order of the custom time column in the table is determined
by the order in the creation SQL. The related constraints are as follows:
+
+ - When the column category is set to TIME, the data type must be TIMESTAMP.
+ - Each table allows at most one time column (columnCategory = TIME).
+ - If no time column is explicitly defined, no other column can use "time"
as its name to avoid conflicts with the system's default time column naming.
+3. The column category can be omitted and defaults to FIELD. When the column
category is TAG or ATTRIBUTE, the data type must be STRING (can be omitted).
+4. The TTL of a table defaults to the TTL of its database. If the default
value is used, this attribute can be omitted or set to default.
+5. <TABLE_NAME> table name has the following characteristics:
+
+ - It is case-insensitive and, upon successful creation, is uniformly
displayed in lowercase.
+ - The name can include special characters, such as `~!`"%`, etc.
+ - Table names containing special characters or Chinese characters must be
enclosed in double quotation marks ("") during creation.
+
+ - Note: In SQL, special characters or Chinese table names must be
enclosed in double quotes. In the native API, no additional quotes are needed;
otherwise, the table name will include the quote characters.
+ - When naming a table, the outermost double quotation marks (`""`) will not
appear in the actual table name.
+ - ```sql
+ -- In SQL
+ "a""b" --> a"b
+ """""" --> ""
+ -- In API
+ "a""b" --> "a""b"
+ ```
+6. columnDefinition column names have the same characteristics as table names
and can include the special character `.`.
+7. COMMENT adds a comment to the table.
**Examples:**
@@ -101,6 +115,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table.
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git
a/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
b/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
index e42212e7..67e02625 100644
--- a/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
@@ -66,17 +66,31 @@ comment
**Note:**
-1. If the time column (`TIME`) is not specified, IoTDB automatically adds one.
Other columns can be added using the `enable_auto_create_schema` configuration
or session interface commands.
-2. Column categories default to `FIELD` if not specified. `TAG` and
`ATTRIBUTE` columns must be of type `STRING`.
-3. Table `TTL` defaults to the database `TTL`. You can omit this property or
set it to `default` if the default value is used.
-4. `<TABLE_NAME>`:
- 1. Case-insensitive. After creation, it will be displayed uniformly in
lowercase.
- 2. Can include special characters such as `~!`"`%`, etc.
- 3. Names with special or Chinese characters must be enclosed in double
quotes (`""`).
- 4. Outer double quotes are not retained in the final table name. For
example: `"a""b"` becomes `a"b`.
- 5. Note: In SQL, table or column names with special characters or Chinese
characters must be wrapped in double quotes. However, in the native API, do not
add extra quotes—otherwise, the quotation marks will become part of the name
itself.
-5. **`columnDefinition`**: Column names share the same characteristics as
table names and can include special characters such as `.`.
-6. COMMENT adds comments to the table.
+1. When creating a table, you do not need to specify a time column. IoTDB
automatically adds a column named "time" and places it as the first column. All
other columns can be added by enabling the `enable_auto_create_schema` option
in the database configuration, or through the session interface for automatic
creation or by using table modification statements.
+2. Since version V2.0.8, tables support custom naming of the time column
during creation. The order of the custom time column in the table is determined
by the order in the creation SQL. The related constraints are as follows:
+
+ - When the column category is set to TIME, the data type must be TIMESTAMP.
+ - Each table allows at most one time column (columnCategory = TIME).
+ - If no time column is explicitly defined, no other column can use "time"
as its name to avoid conflicts with the system's default time column naming.
+3. The column category can be omitted and defaults to FIELD. When the column
category is TAG or ATTRIBUTE, the data type must be STRING (can be omitted).
+4. The TTL of a table defaults to the TTL of its database. If the default
value is used, this attribute can be omitted or set to default.
+5. <TABLE_NAME> table name has the following characteristics:
+
+ - It is case-insensitive and, upon successful creation, is uniformly
displayed in lowercase.
+ - The name can include special characters, such as `~!`"%`, etc.
+ - Table names containing special characters or Chinese characters must be
enclosed in double quotation marks ("") during creation.
+
+ - Note: In SQL, special characters or Chinese table names must be
enclosed in double quotes. In the native API, no additional quotes are needed;
otherwise, the table name will include the quote characters.
+ - When naming a table, the outermost double quotation marks (`""`) will not
appear in the actual table name.
+ - ```sql
+ -- In SQL
+ "a""b" --> a"b
+ """""" --> ""
+ -- In API
+ "a""b" --> "a""b"
+ ```
+6. columnDefinition column names have the same characteristics as table names
and can include the special character `.`.
+7. COMMENT adds a comment to the table.
**Examples:**
@@ -101,6 +115,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table.
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git
a/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
b/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
index 2246ab60..85b2aac9 100644
--- a/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
+++ b/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table. (Support from V2.0.8-beta)
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git
a/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index 7de33385..8e57817d 100644
--- a/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++ b/src/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table. (Support from V2.0.8)
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git a/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
b/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
index f1de07b9..cc9c798b 100644
--- a/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
+++ b/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
@@ -80,6 +80,11 @@ The name of the view, which follows the same rules as a
table name (for specific
* If a device in the tree model does not contain certain declared
FIELD columns, or if their data types are inconsistent with the declared FIELD
columns, the value for that FIELD column will always be `NULL`when querying
that device.
* If no FIELD columns are specified, the system automatically scans for
all measurements under the `prefixPath`subtree (including all ordinary sequence
measurements and measurements defined in any templates whose mounted paths
overlap with the `prefixPath`) during creation. The column names will use the
measurement names from the tree model.
* The tree model cannot have measurements with the same name
(case-insensitive) but different data types.
+* `TIME`: When creating a view, you do not need to specify a time column.
IoTDB automatically adds a column named "time" and places it as the first
column. Since version V2.0.8-beta, views support **custom naming of the time
column** during creation. The order of the custom time column in the view is
determined by the order in the creation SQL. The related constraints are as
follows:
+ * When the column category is set to `TIME`, the data type must be
`TIMESTAMP`.
+ * Each view allows at most one time column (columnCategory = TIME).
+ * If no time column is explicitly defined, no other column can use `time`
as its name to avoid conflicts with the system's default time column naming.
+
4. **`WITH properties`**
@@ -138,6 +143,21 @@ with (ttl=604800000)
AS root.db.**
```
+When customizing the time column (supported since V2.0.8-beta), the SQL
changes are as follows:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."wind_turbine"
+ (wind_turbine_group String TAG,
+ wind_turbine_number String TAG,
+ voltage DOUBLE FIELD,
+ current DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+with (ttl=604800000)
+AS root.db.**
+```
+
+
### 2.2 Modifying a Table View
#### 2.2.1 Syntax Definition
diff --git a/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
b/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
index 7e047e97..85317f1e 100644
--- a/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
@@ -80,6 +80,11 @@ The name of the view, which follows the same rules as a
table name (for specific
* If a device in the tree model does not contain certain declared
FIELD columns, or if their data types are inconsistent with the declared FIELD
columns, the value for that FIELD column will always be `NULL`when querying
that device.
* If no FIELD columns are specified, the system automatically scans for
all measurements under the `prefixPath`subtree (including all ordinary sequence
measurements and measurements defined in any templates whose mounted paths
overlap with the `prefixPath`) during creation. The column names will use the
measurement names from the tree model.
* The tree model cannot have measurements with the same name
(case-insensitive) but different data types.
+* `TIME`: When creating a view, you do not need to specify a time column.
IoTDB automatically adds a column named "time" and places it as the first
column. Since version V2.0.8-beta, views support **custom naming of the time
column** during creation. The order of the custom time column in the view is
determined by the order in the creation SQL. The related constraints are as
follows:
+ * When the column category is set to `TIME`, the data type must be
`TIMESTAMP`.
+ * Each view allows at most one time column (columnCategory = TIME).
+ * If no time column is explicitly defined, no other column can use `time`
as its name to avoid conflicts with the system's default time column naming.
+
4. **`WITH properties`**
@@ -138,6 +143,21 @@ with (ttl=604800000)
AS root.db.**
```
+When customizing the time column (supported since V2.0.8), the SQL changes are
as follows:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."wind_turbine"
+ (wind_turbine_group String TAG,
+ wind_turbine_number String TAG,
+ voltage DOUBLE FIELD,
+ current DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+with (ttl=604800000)
+AS root.db.**
+```
+
+
### 2.2 Modifying a Table View
#### 2.2.1 Syntax Definition
diff --git
a/src/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
b/src/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
index 4b9a9c55..6fad824a 100644
--- a/src/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
+++ b/src/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
@@ -66,17 +66,31 @@ comment
**Note:**
-1. If the time column (`TIME`) is not specified, IoTDB automatically adds one.
Other columns can be added using the `enable_auto_create_schema` configuration
or session interface commands.
-2. Column categories default to `FIELD` if not specified. `TAG` and
`ATTRIBUTE` columns must be of type `STRING`.
-3. Table `TTL` defaults to the database `TTL`. You can omit this property or
set it to `default` if the default value is used.
-4. `<TABLE_NAME>`:
- 1. Case-insensitive. After creation, it will be displayed uniformly in
lowercase.
- 2. Can include special characters such as `~!`"`%`, etc.
- 3. Names with special or Chinese characters must be enclosed in double
quotes (`""`).
- 4. Outer double quotes are not retained in the final table name. For
example: `"a""b"` becomes `a"b`.
- 5. Note: In SQL, table or column names with special characters or Chinese
characters must be wrapped in double quotes. However, in the native API, do not
add extra quotes—otherwise, the quotation marks will become part of the name
itself.
-5. **`columnDefinition`**: Column names share the same characteristics as
table names and can include special characters such as `.`.
-6. COMMENT adds comments to the table.
+1. When creating a table, you do not need to specify a time column. IoTDB
automatically adds a column named "time" and places it as the first column. All
other columns can be added by enabling the `enable_auto_create_schema` option
in the database configuration, or through the session interface for automatic
creation or by using table modification statements.
+2. Since version V2.0.8, tables support custom naming of the time column
during creation. The order of the custom time column in the table is determined
by the order in the creation SQL. The related constraints are as follows:
+
+ - When the column category is set to TIME, the data type must be TIMESTAMP.
+ - Each table allows at most one time column (columnCategory = TIME).
+ - If no time column is explicitly defined, no other column can use "time"
as its name to avoid conflicts with the system's default time column naming.
+3. The column category can be omitted and defaults to FIELD. When the column
category is TAG or ATTRIBUTE, the data type must be STRING (can be omitted).
+4. The TTL of a table defaults to the TTL of its database. If the default
value is used, this attribute can be omitted or set to default.
+5. <TABLE_NAME> table name has the following characteristics:
+
+ - It is case-insensitive and, upon successful creation, is uniformly
displayed in lowercase.
+ - The name can include special characters, such as `~!`"%`, etc.
+ - Table names containing special characters or Chinese characters must be
enclosed in double quotation marks ("") during creation.
+
+ - Note: In SQL, special characters or Chinese table names must be
enclosed in double quotes. In the native API, no additional quotes are needed;
otherwise, the table name will include the quote characters.
+ - When naming a table, the outermost double quotation marks (`""`) will not
appear in the actual table name.
+ - ```sql
+ -- In SQL
+ "a""b" --> a"b
+ """""" --> ""
+ -- In API
+ "a""b" --> "a""b"
+ ```
+6. columnDefinition column names have the same characteristics as table names
and can include the special character `.`.
+7. COMMENT adds a comment to the table.
**Examples:**
@@ -101,6 +115,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table.
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git
a/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
b/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
index e42212e7..67e02625 100644
--- a/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
@@ -66,17 +66,31 @@ comment
**Note:**
-1. If the time column (`TIME`) is not specified, IoTDB automatically adds one.
Other columns can be added using the `enable_auto_create_schema` configuration
or session interface commands.
-2. Column categories default to `FIELD` if not specified. `TAG` and
`ATTRIBUTE` columns must be of type `STRING`.
-3. Table `TTL` defaults to the database `TTL`. You can omit this property or
set it to `default` if the default value is used.
-4. `<TABLE_NAME>`:
- 1. Case-insensitive. After creation, it will be displayed uniformly in
lowercase.
- 2. Can include special characters such as `~!`"`%`, etc.
- 3. Names with special or Chinese characters must be enclosed in double
quotes (`""`).
- 4. Outer double quotes are not retained in the final table name. For
example: `"a""b"` becomes `a"b`.
- 5. Note: In SQL, table or column names with special characters or Chinese
characters must be wrapped in double quotes. However, in the native API, do not
add extra quotes—otherwise, the quotation marks will become part of the name
itself.
-5. **`columnDefinition`**: Column names share the same characteristics as
table names and can include special characters such as `.`.
-6. COMMENT adds comments to the table.
+1. When creating a table, you do not need to specify a time column. IoTDB
automatically adds a column named "time" and places it as the first column. All
other columns can be added by enabling the `enable_auto_create_schema` option
in the database configuration, or through the session interface for automatic
creation or by using table modification statements.
+2. Since version V2.0.8, tables support custom naming of the time column
during creation. The order of the custom time column in the table is determined
by the order in the creation SQL. The related constraints are as follows:
+
+ - When the column category is set to TIME, the data type must be TIMESTAMP.
+ - Each table allows at most one time column (columnCategory = TIME).
+ - If no time column is explicitly defined, no other column can use "time"
as its name to avoid conflicts with the system's default time column naming.
+3. The column category can be omitted and defaults to FIELD. When the column
category is TAG or ATTRIBUTE, the data type must be STRING (can be omitted).
+4. The TTL of a table defaults to the TTL of its database. If the default
value is used, this attribute can be omitted or set to default.
+5. <TABLE_NAME> table name has the following characteristics:
+
+ - It is case-insensitive and, upon successful creation, is uniformly
displayed in lowercase.
+ - The name can include special characters, such as `~!`"%`, etc.
+ - Table names containing special characters or Chinese characters must be
enclosed in double quotation marks ("") during creation.
+
+ - Note: In SQL, special characters or Chinese table names must be
enclosed in double quotes. In the native API, no additional quotes are needed;
otherwise, the table name will include the quote characters.
+ - When naming a table, the outermost double quotation marks (`""`) will not
appear in the actual table name.
+ - ```sql
+ -- In SQL
+ "a""b" --> a"b
+ """""" --> ""
+ -- In API
+ "a""b" --> "a""b"
+ ```
+6. columnDefinition column names have the same characteristics as table names
and can include the special character `.`.
+7. COMMENT adds a comment to the table.
**Examples:**
@@ -101,6 +115,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table.
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git
a/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
b/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
index 2246ab60..85b2aac9 100644
--- a/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
+++ b/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table. (Support from V2.0.8-beta)
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git
a/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index 7de33385..8e57817d 100644
--- a/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++ b/src/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
"Site" STRING TAG,
"Temperature" int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- Custom time column: named time_test, located in the second column of the
table. (Support from V2.0.8)
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
Note: If your terminal does not support multi-line paste (e.g., Windows CMD),
please reformat the SQL statement into a single line before execution.
diff --git a/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
b/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
index f1de07b9..cc9c798b 100644
--- a/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
+++ b/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
@@ -80,6 +80,11 @@ The name of the view, which follows the same rules as a
table name (for specific
* If a device in the tree model does not contain certain declared
FIELD columns, or if their data types are inconsistent with the declared FIELD
columns, the value for that FIELD column will always be `NULL`when querying
that device.
* If no FIELD columns are specified, the system automatically scans for
all measurements under the `prefixPath`subtree (including all ordinary sequence
measurements and measurements defined in any templates whose mounted paths
overlap with the `prefixPath`) during creation. The column names will use the
measurement names from the tree model.
* The tree model cannot have measurements with the same name
(case-insensitive) but different data types.
+* `TIME`: When creating a view, you do not need to specify a time column.
IoTDB automatically adds a column named "time" and places it as the first
column. Since version V2.0.8-beta, views support **custom naming of the time
column** during creation. The order of the custom time column in the view is
determined by the order in the creation SQL. The related constraints are as
follows:
+ * When the column category is set to `TIME`, the data type must be
`TIMESTAMP`.
+ * Each view allows at most one time column (columnCategory = TIME).
+ * If no time column is explicitly defined, no other column can use `time`
as its name to avoid conflicts with the system's default time column naming.
+
4. **`WITH properties`**
@@ -138,6 +143,21 @@ with (ttl=604800000)
AS root.db.**
```
+When customizing the time column (supported since V2.0.8-beta), the SQL
changes are as follows:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."wind_turbine"
+ (wind_turbine_group String TAG,
+ wind_turbine_number String TAG,
+ voltage DOUBLE FIELD,
+ current DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+with (ttl=604800000)
+AS root.db.**
+```
+
+
### 2.2 Modifying a Table View
#### 2.2.1 Syntax Definition
diff --git a/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
b/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
index 7e047e97..85317f1e 100644
--- a/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
@@ -80,6 +80,11 @@ The name of the view, which follows the same rules as a
table name (for specific
* If a device in the tree model does not contain certain declared
FIELD columns, or if their data types are inconsistent with the declared FIELD
columns, the value for that FIELD column will always be `NULL`when querying
that device.
* If no FIELD columns are specified, the system automatically scans for
all measurements under the `prefixPath`subtree (including all ordinary sequence
measurements and measurements defined in any templates whose mounted paths
overlap with the `prefixPath`) during creation. The column names will use the
measurement names from the tree model.
* The tree model cannot have measurements with the same name
(case-insensitive) but different data types.
+* `TIME`: When creating a view, you do not need to specify a time column.
IoTDB automatically adds a column named "time" and places it as the first
column. Since version V2.0.8-beta, views support **custom naming of the time
column** during creation. The order of the custom time column in the view is
determined by the order in the creation SQL. The related constraints are as
follows:
+ * When the column category is set to `TIME`, the data type must be
`TIMESTAMP`.
+ * Each view allows at most one time column (columnCategory = TIME).
+ * If no time column is explicitly defined, no other column can use `time`
as its name to avoid conflicts with the system's default time column naming.
+
4. **`WITH properties`**
@@ -138,6 +143,21 @@ with (ttl=604800000)
AS root.db.**
```
+When customizing the time column (supported since V2.0.8), the SQL changes are
as follows:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."wind_turbine"
+ (wind_turbine_group String TAG,
+ wind_turbine_number String TAG,
+ voltage DOUBLE FIELD,
+ current DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+with (ttl=604800000)
+AS root.db.**
+```
+
+
### 2.2 Modifying a Table View
#### 2.2.1 Syntax Definition
diff --git
a/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
b/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
index e95978a8..ea6c1559 100644
--- a/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
+++ b/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_apache.md
@@ -66,15 +66,19 @@ comment
**说明:**
-1.
在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过
session 接口自动创建或修改表的语句来添加。
-2. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
-3. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
-4. <TABLE_NAME>表名称,具有以下特性:
- - 大小写不敏感,创建成功后,统一显示为小写
- - 名称可包含特殊字符,如 `~!`"%` 等
- - 包含特殊字符或中文字符的表名创建时必须用双引号 "" 括起来。
- - 注意:SQL中特殊字符或中文表名需加双引号。原生API中无需额外添加,否则表名会包含引号字符。
- - 当为表命名时,最外层的双引号(`""`)不会在实际创建的表名中出现。
+1. 在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列并命名为"time",
且顺序上位于第一列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过 session
接口自动创建或修改表的语句来添加。
+2. 自 V2.0.8-beta 版本起,支持创建表时自定义命名时间列,自定义时间列在表中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+- 当列分类(columnCategory)设为 TIME 时,数据类型(dataType)必须为 TIMESTAMP。
+- 每张表最多允许定义 1个时间列(columnCategory = TIME)。
+- 当未显式定义时间列时,不允许其他列使用 time 作为名称,否则会与系统默认时间列命名冲突。
+3. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
+4. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
+5. <TABLE_NAME>表名称,具有以下特性:
+ - 大小写不敏感,创建成功后,统一显示为小写
+ - 名称可包含特殊字符,如 `~!`"%` 等
+ - 包含特殊字符或中文字符的表名创建时必须用双引号 "" 括起来。
+ - 注意:SQL中特殊字符或中文表名需加双引号。原生API中无需额外添加,否则表名会包含引号字符。
+ - 当为表命名时,最外层的双引号(`""`)不会在实际创建的表名中出现。
- ```shell
-- SQL 中
@@ -83,8 +87,9 @@ comment
-- API 中
"a""b" --> "a""b"
```
-5. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
-6. COMMENT 给表添加注释。
+6. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
+7. COMMENT 给表添加注释。
+
**示例:**
@@ -108,6 +113,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- 自定义时间列:命名为time_test, 位于表的第二列
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git
a/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
b/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
index 201124a9..ec5dab12 100644
--- a/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/zh/UserGuide/Master/Table/Basic-Concept/Table-Management_timecho.md
@@ -66,10 +66,14 @@ comment
**说明:**
-1.
在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过
session 接口自动创建或修改表的语句来添加。
-2. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
-3. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
-4. <TABLE_NAME>表名称,具有以下特性:
+1. 在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列并命名为"time",
且顺序上位于第一列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过 session
接口自动创建或修改表的语句来添加。
+2. 自 V2.0.8 版本起,支持创建表时自定义命名时间列,自定义时间列在表中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+- 当列分类(columnCategory)设为 TIME 时,数据类型(dataType)必须为 TIMESTAMP。
+- 每张表最多允许定义 1个时间列(columnCategory = TIME)。
+- 当未显式定义时间列时,不允许其他列使用 time 作为名称,否则会与系统默认时间列命名冲突。
+3. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
+4. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
+5. <TABLE_NAME>表名称,具有以下特性:
- 大小写不敏感,创建成功后,统一显示为小写
- 名称可包含特殊字符,如 `~!`"%` 等
- 包含特殊字符或中文字符的表名创建时必须用双引号 "" 括起来。
@@ -83,8 +87,8 @@ comment
-- API 中
"a""b" --> "a""b"
```
-5. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
-6. COMMENT 给表添加注释。
+6. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
+7. COMMENT 给表添加注释。
**示例:**
@@ -108,6 +112,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- 自定义时间列:命名为time_test, 位于表的第二列
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git
a/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
b/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
index 7fd5deaf..940eddc9 100644
--- a/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
+++ b/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_apache.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+-- 自定义时间列:命名为time_test, 位于表的第二列 (V2.0.8-beta 起支持)
+CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+);
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git
a/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index 9efc3a54..e99fbeea 100644
---
a/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++
b/src/zh/UserGuide/Master/Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+-- 自定义时间列:命名为time_test, 位于表的第二列 (V2.0.8 起支持)
+CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+);
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git a/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
b/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
index efae2dda..4465dc55 100644
--- a/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
+++ b/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_apache.md
@@ -79,6 +79,10 @@ comment
* 若树模型中的设备不包含某些声明的 FIELD 列,或与声明的 FIELD 列的数据类型不一致,则在查询该设备时,该 FIELD
列的值永远为 NULL。
* 若未指定 FIELD 列,则创建时会自动扫描出`prefixPath`子树下所有的测点(包括定义为所有普通序列的测点,以及挂载路径与
`prefixPath `有所重合的所有模板中的测点),列名使用树模型测点名称。
* 不支持树模型存在名称(含小写)相同但类型不同的测点
+* `TIME`:创建视图时可以不指定时间列(TIME),IoTDB 会自动添加该列并命名为"time", 且顺序上位于第一列。自 V2.0.8-beta
版本起,支持创建视图时**自定义命名时间列**,自定义时间列在视图中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+ * 当列分类(columnCategory)设为 `TIME` 时,数据类型(dataType)必须为 `TIMESTAMP`。
+ * 每个视图最多允许定义 1个时间列(columnCategory = TIME)。
+ * 当未显式定义时间列时,不允许其他列使用 `time` 作为名称,否则会与系统默认时间列命名冲突。
4. **`WITH properties`**
@@ -134,6 +138,20 @@ AS root.db.**
AS root.db.**
with (ttl=604800000)
```
+
+* 当需要自定义时间列(V2.0.8-beta 起支持)时,SQL 变更如下:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."风机表"
+ ("风机组" TAG,
+ "风机号" TAG,
+ "电压" DOUBLE FIELD,
+ "电流" DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+AS root.db.**
+with (ttl=604800000)
+```
### 2.2 修改表视图
#### 2.2.1 语法定义
diff --git a/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
b/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
index d3a0a622..f8ba56c9 100644
--- a/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/zh/UserGuide/Master/Table/User-Manual/Tree-to-Table_timecho.md
@@ -79,6 +79,11 @@ comment
* 若树模型中的设备不包含某些声明的 FIELD 列,或与声明的 FIELD 列的数据类型不一致,则在查询该设备时,该 FIELD
列的值永远为 NULL。
* 若未指定 FIELD 列,则创建时会自动扫描出`prefixPath`子树下所有的测点(包括定义为所有普通序列的测点,以及挂载路径与
`prefixPath `有所重合的所有模板中的测点),列名使用树模型测点名称。
* 不支持树模型存在名称(含小写)相同但类型不同的测点
+* `TIME`:创建视图时可以不指定时间列(TIME),IoTDB 会自动添加该列并命名为"time", 且顺序上位于第一列。自 V2.0.8
版本起,支持创建视图时**自定义命名时间列**,自定义时间列在视图中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+ * 当列分类(columnCategory)设为 `TIME` 时,数据类型(dataType)必须为 `TIMESTAMP`。
+ * 每个视图最多允许定义 1个时间列(columnCategory = TIME)。
+ * 当未显式定义时间列时,不允许其他列使用 `time` 作为名称,否则会与系统默认时间列命名冲突。
+
4. **`WITH properties`**
@@ -135,6 +140,21 @@ AS root.db.**
with (ttl=604800000)
```
+* 当需要自定义时间列(V2.0.8 起支持)时,SQL 变更如下:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."风机表"
+ ("风机组" TAG,
+ "风机号" TAG,
+ "电压" DOUBLE FIELD,
+ "电流" DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+AS root.db.**
+with (ttl=604800000)
+```
+
+
### 2.2 修改表视图
#### 2.2.1 语法定义
diff --git
a/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
b/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
index e95978a8..ea6c1559 100644
--- a/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
+++ b/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_apache.md
@@ -66,15 +66,19 @@ comment
**说明:**
-1.
在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过
session 接口自动创建或修改表的语句来添加。
-2. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
-3. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
-4. <TABLE_NAME>表名称,具有以下特性:
- - 大小写不敏感,创建成功后,统一显示为小写
- - 名称可包含特殊字符,如 `~!`"%` 等
- - 包含特殊字符或中文字符的表名创建时必须用双引号 "" 括起来。
- - 注意:SQL中特殊字符或中文表名需加双引号。原生API中无需额外添加,否则表名会包含引号字符。
- - 当为表命名时,最外层的双引号(`""`)不会在实际创建的表名中出现。
+1. 在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列并命名为"time",
且顺序上位于第一列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过 session
接口自动创建或修改表的语句来添加。
+2. 自 V2.0.8-beta 版本起,支持创建表时自定义命名时间列,自定义时间列在表中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+- 当列分类(columnCategory)设为 TIME 时,数据类型(dataType)必须为 TIMESTAMP。
+- 每张表最多允许定义 1个时间列(columnCategory = TIME)。
+- 当未显式定义时间列时,不允许其他列使用 time 作为名称,否则会与系统默认时间列命名冲突。
+3. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
+4. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
+5. <TABLE_NAME>表名称,具有以下特性:
+ - 大小写不敏感,创建成功后,统一显示为小写
+ - 名称可包含特殊字符,如 `~!`"%` 等
+ - 包含特殊字符或中文字符的表名创建时必须用双引号 "" 括起来。
+ - 注意:SQL中特殊字符或中文表名需加双引号。原生API中无需额外添加,否则表名会包含引号字符。
+ - 当为表命名时,最外层的双引号(`""`)不会在实际创建的表名中出现。
- ```shell
-- SQL 中
@@ -83,8 +87,9 @@ comment
-- API 中
"a""b" --> "a""b"
```
-5. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
-6. COMMENT 给表添加注释。
+6. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
+7. COMMENT 给表添加注释。
+
**示例:**
@@ -108,6 +113,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- 自定义时间列:命名为time_test, 位于表的第二列
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git
a/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
b/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
index 201124a9..ec5dab12 100644
--- a/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
+++ b/src/zh/UserGuide/latest-Table/Basic-Concept/Table-Management_timecho.md
@@ -66,10 +66,14 @@ comment
**说明:**
-1.
在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过
session 接口自动创建或修改表的语句来添加。
-2. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
-3. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
-4. <TABLE_NAME>表名称,具有以下特性:
+1. 在创建表时,可以不指定时间列(TIME),IoTDB会自动添加该列并命名为"time",
且顺序上位于第一列。其他所有列可以通过在数据库配置时启用`enable_auto_create_schema`选项,或通过 session
接口自动创建或修改表的语句来添加。
+2. 自 V2.0.8 版本起,支持创建表时自定义命名时间列,自定义时间列在表中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+- 当列分类(columnCategory)设为 TIME 时,数据类型(dataType)必须为 TIMESTAMP。
+- 每张表最多允许定义 1个时间列(columnCategory = TIME)。
+- 当未显式定义时间列时,不允许其他列使用 time 作为名称,否则会与系统默认时间列命名冲突。
+3. 列的类别可以省略,默认为`FIELD`。当列的类别为`TAG`或`ATTRIBUTE`时,数据类型需为`STRING`(可省略)。
+4. 表的TTL默认为其所在数据库的TTL。如果使用默认值,可以省略此属性,或将其设置为`default`。
+5. <TABLE_NAME>表名称,具有以下特性:
- 大小写不敏感,创建成功后,统一显示为小写
- 名称可包含特殊字符,如 `~!`"%` 等
- 包含特殊字符或中文字符的表名创建时必须用双引号 "" 括起来。
@@ -83,8 +87,8 @@ comment
-- API 中
"a""b" --> "a""b"
```
-5. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
-6. COMMENT 给表添加注释。
+6. columnDefinition 列名称与表名称具有相同特性,并且可包含特殊字符`.`。
+7. COMMENT 给表添加注释。
**示例:**
@@ -108,6 +112,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+ -- 自定义时间列:命名为time_test, 位于表的第二列
+ CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+ );
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git
a/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
b/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
index 7fd5deaf..940eddc9 100644
--- a/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
+++ b/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_apache.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+-- 自定义时间列:命名为time_test, 位于表的第二列 (V2.0.8-beta 起支持)
+CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+);
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git
a/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
b/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
index 9efc3a54..e99fbeea 100644
---
a/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
+++
b/src/zh/UserGuide/latest-Table/SQL-Manual/SQL-Metadata-Operations_timecho.md
@@ -211,6 +211,13 @@ CREATE TABLE tableC (
station STRING TAG,
temperature int32 FIELD COMMENT 'temperature'
) with (TTL=DEFAULT);
+
+-- 自定义时间列:命名为time_test, 位于表的第二列 (V2.0.8 起支持)
+CREATE TABLE table1 (
+ region STRING TAG,
+ time_user_defined TIMESTAMP TIME,
+ temperature FLOAT FIELD
+);
```
注意:若您使用的终端不支持多行粘贴(例如 Windows CMD),请将 SQL 语句调整为单行格式后再执行。
diff --git a/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
b/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
index efae2dda..4465dc55 100644
--- a/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
+++ b/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_apache.md
@@ -79,6 +79,10 @@ comment
* 若树模型中的设备不包含某些声明的 FIELD 列,或与声明的 FIELD 列的数据类型不一致,则在查询该设备时,该 FIELD
列的值永远为 NULL。
* 若未指定 FIELD 列,则创建时会自动扫描出`prefixPath`子树下所有的测点(包括定义为所有普通序列的测点,以及挂载路径与
`prefixPath `有所重合的所有模板中的测点),列名使用树模型测点名称。
* 不支持树模型存在名称(含小写)相同但类型不同的测点
+* `TIME`:创建视图时可以不指定时间列(TIME),IoTDB 会自动添加该列并命名为"time", 且顺序上位于第一列。自 V2.0.8-beta
版本起,支持创建视图时**自定义命名时间列**,自定义时间列在视图中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+ * 当列分类(columnCategory)设为 `TIME` 时,数据类型(dataType)必须为 `TIMESTAMP`。
+ * 每个视图最多允许定义 1个时间列(columnCategory = TIME)。
+ * 当未显式定义时间列时,不允许其他列使用 `time` 作为名称,否则会与系统默认时间列命名冲突。
4. **`WITH properties`**
@@ -134,6 +138,20 @@ AS root.db.**
AS root.db.**
with (ttl=604800000)
```
+
+* 当需要自定义时间列(V2.0.8-beta 起支持)时,SQL 变更如下:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."风机表"
+ ("风机组" TAG,
+ "风机号" TAG,
+ "电压" DOUBLE FIELD,
+ "电流" DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+AS root.db.**
+with (ttl=604800000)
+```
### 2.2 修改表视图
#### 2.2.1 语法定义
diff --git a/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
b/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
index d3a0a622..f8ba56c9 100644
--- a/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
+++ b/src/zh/UserGuide/latest-Table/User-Manual/Tree-to-Table_timecho.md
@@ -79,6 +79,11 @@ comment
* 若树模型中的设备不包含某些声明的 FIELD 列,或与声明的 FIELD 列的数据类型不一致,则在查询该设备时,该 FIELD
列的值永远为 NULL。
* 若未指定 FIELD 列,则创建时会自动扫描出`prefixPath`子树下所有的测点(包括定义为所有普通序列的测点,以及挂载路径与
`prefixPath `有所重合的所有模板中的测点),列名使用树模型测点名称。
* 不支持树模型存在名称(含小写)相同但类型不同的测点
+* `TIME`:创建视图时可以不指定时间列(TIME),IoTDB 会自动添加该列并命名为"time", 且顺序上位于第一列。自 V2.0.8
版本起,支持创建视图时**自定义命名时间列**,自定义时间列在视图中的顺序由创建 SQL 中的顺序决定。相关约束如下:
+ * 当列分类(columnCategory)设为 `TIME` 时,数据类型(dataType)必须为 `TIMESTAMP`。
+ * 每个视图最多允许定义 1个时间列(columnCategory = TIME)。
+ * 当未显式定义时间列时,不允许其他列使用 `time` 作为名称,否则会与系统默认时间列命名冲突。
+
4. **`WITH properties`**
@@ -135,6 +140,21 @@ AS root.db.**
with (ttl=604800000)
```
+* 当需要自定义时间列(V2.0.8 起支持)时,SQL 变更如下:
+
+```SQL
+CREATE OR REPLACE VIEW viewdb."风机表"
+ ("风机组" TAG,
+ "风机号" TAG,
+ "电压" DOUBLE FIELD,
+ "电流" DOUBLE FIELD,
+ time_user_defined TIMESTAMP TIME
+ )
+AS root.db.**
+with (ttl=604800000)
+```
+
+
### 2.2 修改表视图
#### 2.2.1 语法定义