From f3339549ca865d9084d6ba8e78f02a3235b38628 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:32:29 +0000 Subject: [PATCH 01/11] Initial plan From 57348f7a7560ec2002437cdb11077cffaade2208 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:40:25 +0000 Subject: [PATCH 02/11] Update numeric type aliases in documentation - Add INT2 as alias for Int16 (SMALLINT) - Add INT4 as alias for Int32 (INT) - Add INT8 as alias for Int64 (BIGINT) - Add FLOAT4 as alias for Float32 (FLOAT) - Add FLOAT8 as alias for Float64 (DOUBLE) This aligns with the changes from PR #7270 in greptimedb repository. Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com> --- docs/reference/sql/data-types.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index 55e0066ed..7525cb7b0 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -308,15 +308,15 @@ For users migrating from MySQL or PostgreSQL to GreptimeDB, GreptimeDB supports | `String` | `Text`, `TinyText`, `MediumText`, `LongText`, `Varchar`, `Char` | | `Binary` | `Varbinary` | | `Int8` | `TinyInt` | -| `Int16` | `SmallInt` | -| `Int32` | `Int` | -| `Int64` | `BigInt` | +| `Int16` | `SmallInt`, `Int2` | +| `Int32` | `Int`, `Int4` | +| `Int64` | `BigInt`, `Int8` | | `UInt8` | `UnsignedTinyInt` | | `UInt16` | `UnsignedSmallInt` | | `UInt32` | `UnsignedInt` | | `UInt64` | `UnsignedBigInt` | -| `Float32` | `Float` | -| `Float64` | `Double` | +| `Float32` | `Float`, `Float4` | +| `Float64` | `Double`, `Float8` | | `TimestampSecond` | `Timestamp_s`, `Timestamp_sec`, `Timestamp(0)` | | `TimestampMillisecond` | `Timestamp`, `Timestamp_ms`, `Timestamp(3)` | | `TimestampMicroSecond` | `Timestamp_us`, `Timestamp(6)` | From e8da1c7c35d49c85898dfc8a92821125780dfa92 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:43:10 +0000 Subject: [PATCH 03/11] Add breaking change warning for INT8 alias Add a warning callout to document the breaking change where INT8 now maps to BigInt (64-bit) instead of TinyInt (8-bit) to align with PostgreSQL and MySQL conventions. Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com> --- docs/reference/sql/data-types.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index 7525cb7b0..83b909a62 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -322,6 +322,10 @@ For users migrating from MySQL or PostgreSQL to GreptimeDB, GreptimeDB supports | `TimestampMicroSecond` | `Timestamp_us`, `Timestamp(6)` | | `TimestampNanosecond` | `Timestamp_ns`, `Timestamp(9)` | +:::warning Breaking Change +The aliases `Int2`, `Int4`, and `Int8` follow the PostgreSQL and MySQL convention, which differs from previous behavior. Specifically, `Int8` now maps to `BigInt` (64-bit) instead of `TinyInt` (8-bit) to align with PostgreSQL and MySQL standards where the number refers to bytes, not bits. +::: + You can use these alias types when creating tables. For example, use `Varchar` instead of `String`, `Double` instead of `Float64`, and `Timestamp(0)` instead of `TimestampSecond`. From 52da90df91159adb5ce0314e55ca7f2e78ded0d7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:45:51 +0000 Subject: [PATCH 04/11] Improve breaking change warning with detailed explanation - Clarify that Int2, Int4, Int8, Float4, Float8 refer to bytes not bits - Add all new aliases to the warning (including Float4 and Float8) - Explain the difference between native type Int8 and SQL alias INT8 - List specific mappings for all new aliases Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com> --- docs/reference/sql/data-types.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index 83b909a62..cbe9bc69b 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -323,7 +323,16 @@ For users migrating from MySQL or PostgreSQL to GreptimeDB, GreptimeDB supports | `TimestampNanosecond` | `Timestamp_ns`, `Timestamp(9)` | :::warning Breaking Change -The aliases `Int2`, `Int4`, and `Int8` follow the PostgreSQL and MySQL convention, which differs from previous behavior. Specifically, `Int8` now maps to `BigInt` (64-bit) instead of `TinyInt` (8-bit) to align with PostgreSQL and MySQL standards where the number refers to bytes, not bits. +The type aliases `Int2`, `Int4`, `Int8`, `Float4`, and `Float8` follow the PostgreSQL and MySQL convention where these identifiers refer to the number of **bytes** (not bits) in the type. + +Specifically: +- `Int2` = 2 bytes = `SmallInt` (16-bit) +- `Int4` = 4 bytes = `Int` (32-bit) +- `Int8` = 8 bytes = `BigInt` (64-bit) - **Breaking**: Previously mapped to `TinyInt` (8-bit) +- `Float4` = 4 bytes = `Float` (32-bit) +- `Float8` = 8 bytes = `Double` (64-bit) + +Note: GreptimeDB's native type `Int8` (an 8-bit integer) is different from the SQL alias `INT8` (which maps to 64-bit `BigInt`). ::: You can use these alias types when creating tables. From 03427d92dd2cc18ef2713868b0a684e1c3742182 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:48:07 +0000 Subject: [PATCH 05/11] Fix trailing whitespace in warning Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com> --- docs/reference/sql/data-types.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index cbe9bc69b..cb5981646 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -323,11 +323,11 @@ For users migrating from MySQL or PostgreSQL to GreptimeDB, GreptimeDB supports | `TimestampNanosecond` | `Timestamp_ns`, `Timestamp(9)` | :::warning Breaking Change -The type aliases `Int2`, `Int4`, `Int8`, `Float4`, and `Float8` follow the PostgreSQL and MySQL convention where these identifiers refer to the number of **bytes** (not bits) in the type. +The type aliases `Int2`, `Int4`, `Int8`, `Float4`, and `Float8` follow the PostgreSQL and MySQL convention where these identifiers refer to the number of **bytes** (not bits) in the type. Specifically: - `Int2` = 2 bytes = `SmallInt` (16-bit) -- `Int4` = 4 bytes = `Int` (32-bit) +- `Int4` = 4 bytes = `Int` (32-bit) - `Int8` = 8 bytes = `BigInt` (64-bit) - **Breaking**: Previously mapped to `TinyInt` (8-bit) - `Float4` = 4 bytes = `Float` (32-bit) - `Float8` = 8 bytes = `Double` (64-bit) From 667fce06b64df81de9ff773b543747734597a30e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:01:18 +0000 Subject: [PATCH 06/11] Update Chinese documentation for numeric type aliases - Add Int2, Int4, Int8, Float4, Float8 aliases to Chinese docs - Add warning callout in Chinese explaining breaking changes - Mirror changes from English version to maintain consistency Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com> --- .../current/reference/sql/data-types.md | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md index c53606921..fc68692c0 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md @@ -308,20 +308,33 @@ INSERT INTO bools(b) VALUES (TRUE), (FALSE); | `String` | `Text`, `TinyText`, `MediumText`, `LongText`, `Varchar`, `Char` | | `Binary` | `Varbinary` | | `Int8` | `TinyInt` | -| `Int16` | `SmallInt` | -| `Int32` | `Int` | -| `Int64` | `BigInt` | +| `Int16` | `SmallInt`, `Int2` | +| `Int32` | `Int`, `Int4` | +| `Int64` | `BigInt`, `Int8` | | `UInt8` | `UnsignedTinyInt` | | `UInt16` | `UnsignedSmallInt` | | `UInt32` | `UnsignedInt` | | `UInt64` | `UnsignedBigInt` | -| `Float32` | `Float` | -| `Float64` | `Double` | +| `Float32` | `Float`, `Float4` | +| `Float64` | `Double`, `Float8` | | `TimestampSecond` | `Timestamp_s`, `Timestamp_sec`, `Timestamp(0)` | | `TimestampMillisecond` | `Timestamp`, `Timestamp_ms` , `Timestamp(3)` | | `TimestampMicroSecond` | `Timestamp_us`, `Timestamp(6)` | | `TimestampNanosecond` | `Timestamp_ns`, `Timestamp(9)` | +:::warning 破坏性变更 +类型别名 `Int2`、`Int4`、`Int8`、`Float4` 和 `Float8` 遵循 PostgreSQL 和 MySQL 的约定,这些标识符表示类型中的**字节**数(而非位数)。 + +具体来说: +- `Int2` = 2 字节 = `SmallInt`(16 位) +- `Int4` = 4 字节 = `Int`(32 位) +- `Int8` = 8 字节 = `BigInt`(64 位)- **破坏性变更**:之前映射到 `TinyInt`(8 位) +- `Float4` = 4 字节 = `Float`(32 位) +- `Float8` = 8 字节 = `Double`(64 位) + +注意:GreptimeDB 的原生类型 `Int8`(8 位整数)与 SQL 别名 `INT8`(映射到 64 位 `BigInt`)不同。 +::: + 在创建表时也可以使用这些别名类型。 例如,使用 `Varchar` 代替 `String`,使用 `Double` 代替 `Float64`,使用 `Timestamp(0)` 代替 `TimestampSecond`。 From aeffba469ed731b12788a37b55e209399289c01f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:04:28 +0000 Subject: [PATCH 07/11] Improve Chinese translation clarity Specify that Int8 is a signed integer type in Chinese docs for better clarity Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com> --- .../current/reference/sql/data-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md index fc68692c0..28fbaf47d 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md @@ -332,7 +332,7 @@ INSERT INTO bools(b) VALUES (TRUE), (FALSE); - `Float4` = 4 字节 = `Float`(32 位) - `Float8` = 8 字节 = `Double`(64 位) -注意:GreptimeDB 的原生类型 `Int8`(8 位整数)与 SQL 别名 `INT8`(映射到 64 位 `BigInt`)不同。 +注意:GreptimeDB 的原生类型 `Int8`(8 位有符号整数)与 SQL 类型别名 `INT8`(映射到 64 位 `BigInt`)不同。 ::: 在创建表时也可以使用这些别名类型。 From 69d11a01edc5b8f2ba2dfdee4712b55a5c6a0cc9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 20:13:14 +0000 Subject: [PATCH 08/11] Clarify distinction between bit-based and byte-based naming Updated note to explain that GreptimeDB native type names (UInt8, Int32, Int64) use bits, while SQL aliases (Int2, Int4, Int8) use bytes following PostgreSQL/MySQL conventions. Added example comparing Int8 (8-bit) vs INT8 (8-byte). Co-authored-by: killme2008 <14142+killme2008@users.noreply.github.com> --- docs/reference/sql/data-types.md | 2 +- .../current/reference/sql/data-types.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index cb5981646..af1ab194f 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -332,7 +332,7 @@ Specifically: - `Float4` = 4 bytes = `Float` (32-bit) - `Float8` = 8 bytes = `Double` (64-bit) -Note: GreptimeDB's native type `Int8` (an 8-bit integer) is different from the SQL alias `INT8` (which maps to 64-bit `BigInt`). +Note: GreptimeDB's native type names (like `UInt8`, `Int32`, `Int64`) refer to the number of **bits**, while the SQL aliases `Int2`, `Int4`, and `Int8` refer to the number of **bytes** following PostgreSQL/MySQL conventions. For example, the native type `Int8` is an 8-**bit** integer (1 byte), while the SQL alias `INT8` maps to an 8-**byte** integer (`BigInt`, 64-bit). ::: You can use these alias types when creating tables. diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md index 28fbaf47d..8cc75e94a 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md @@ -332,7 +332,7 @@ INSERT INTO bools(b) VALUES (TRUE), (FALSE); - `Float4` = 4 字节 = `Float`(32 位) - `Float8` = 8 字节 = `Double`(64 位) -注意:GreptimeDB 的原生类型 `Int8`(8 位有符号整数)与 SQL 类型别名 `INT8`(映射到 64 位 `BigInt`)不同。 +注意:GreptimeDB 的原生类型名称(如 `UInt8`、`Int32`、`Int64`)表示**位**数,而 SQL 类型别名 `Int2`、`Int4` 和 `Int8` 遵循 PostgreSQL/MySQL 约定表示**字节**数。例如,原生类型 `Int8` 是 8 **位**整数(1 字节),而 SQL 别名 `INT8` 映射到 8 **字节**整数(`BigInt`,64 位)。 ::: 在创建表时也可以使用这些别名类型。 From 16973fce97ecc9199c99959b224acc274b0a46d4 Mon Sep 17 00:00:00 2001 From: Dennis Zhuang Date: Sat, 22 Nov 2025 05:50:27 +0800 Subject: [PATCH 09/11] chore: add note for native types Signed-off-by: Dennis Zhuang --- docs/reference/sql/data-types.md | 8 +++++++- .../current/reference/sql/data-types.md | 11 ++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index af1ab194f..6843529da 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -31,6 +31,12 @@ The maximum capacities of `String` and `Binary` are determined by their encoding | `Float32` | 32-bit IEEE754 floating point values | 4 Bytes | | `Float64` | Double precision IEEE 754 floating point values | 8 Bytes | +:::tip NOTE +The descriptions here refer to **GreptimeDB native type information**, which are measured in **bits**. +However, when using **SQL**, follow the conventions of **PostgreSQL** and **MySQL**, where types like `INT2`, `INT4`, `INT8`, `FLOAT4` and `FLOAT8` are defined in **bytes**. +For example, in an SQL statement, `INT8` actually corresponds to **BigInt** (8 bytes, 64 bits). +::: + ## Decimal Type GreptimeDB supports the `decimal` type, a fixed-point type represented as `decimal(precision, scale)`, where `precision` is the total number of digits, and `scale` is the number of digits in the fractional part. For example, `123.45` has a precision of 5 and a scale of 2. @@ -332,7 +338,7 @@ Specifically: - `Float4` = 4 bytes = `Float` (32-bit) - `Float8` = 8 bytes = `Double` (64-bit) -Note: GreptimeDB's native type names (like `UInt8`, `Int32`, `Int64`) refer to the number of **bits**, while the SQL aliases `Int2`, `Int4`, and `Int8` refer to the number of **bytes** following PostgreSQL/MySQL conventions. For example, the native type `Int8` is an 8-**bit** integer (1 byte), while the SQL alias `INT8` maps to an 8-**byte** integer (`BigInt`, 64-bit). +Note: GreptimeDB's native type names (like `UInt8`, `Int32`, `Int64`) refer to the number of **bits**, while the SQL aliases `Int2`, `Int4`, and `Int8` refer to the number of **bytes** following PostgreSQL/MySQL conventions. For example, the native type `Int8` is an 8-**bit** integer (`TinyInt`, 1 byte), while the SQL alias `INT8` maps to an 8-**byte** integer (`BigInt`, 64-bit). ::: You can use these alias types when creating tables. diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md index 8cc75e94a..dc108ad32 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md @@ -31,6 +31,11 @@ SQL 数据类型定义了列可以存储的数据类型。当您运行 `DESC TAB | `Float32` | 32 位 IEEE 754 浮点数 | 4 字节 | | `Float64` | 双精度 IEEE 754 浮点数 | 8 字节 | +:::tip 注意 +这里的描述指的是 GreptimeDB 原生类型信息,这些类型都是以 位(bits) 为单位的。但是,在使用 SQL 时,请遵循 PostgreSQL 和 MySQL 的惯例,其中 `INT2`、`INT4`、`INT8`、`FLOAT4` 和 `FLOAT8` 等类型都是以 字节(bytes) 为单位定义的。 +例如,在 SQL 语句中,`INT8` 实际上对应 `BigInt`(8 个字节,64 位)。 +::: + ## Decimal 类型 GreptimeDB 支持 `decimal` 类型,这是一种定点类型,表示为 `decimal(precision, scale)`,其中 `precision` 是总位数,`scale` 是小数部分的位数。例如,`123.45` 的总位数为 5,小数位数为 2。 @@ -322,17 +327,17 @@ INSERT INTO bools(b) VALUES (TRUE), (FALSE); | `TimestampMicroSecond` | `Timestamp_us`, `Timestamp(6)` | | `TimestampNanosecond` | `Timestamp_ns`, `Timestamp(9)` | -:::warning 破坏性变更 +:::warning 重要变更 类型别名 `Int2`、`Int4`、`Int8`、`Float4` 和 `Float8` 遵循 PostgreSQL 和 MySQL 的约定,这些标识符表示类型中的**字节**数(而非位数)。 具体来说: - `Int2` = 2 字节 = `SmallInt`(16 位) - `Int4` = 4 字节 = `Int`(32 位) -- `Int8` = 8 字节 = `BigInt`(64 位)- **破坏性变更**:之前映射到 `TinyInt`(8 位) +- `Int8` = 8 字节 = `BigInt`(64 位)- **不兼容变更**:之前映射到 `TinyInt`(8 位) - `Float4` = 4 字节 = `Float`(32 位) - `Float8` = 8 字节 = `Double`(64 位) -注意:GreptimeDB 的原生类型名称(如 `UInt8`、`Int32`、`Int64`)表示**位**数,而 SQL 类型别名 `Int2`、`Int4` 和 `Int8` 遵循 PostgreSQL/MySQL 约定表示**字节**数。例如,原生类型 `Int8` 是 8 **位**整数(1 字节),而 SQL 别名 `INT8` 映射到 8 **字节**整数(`BigInt`,64 位)。 +注意:GreptimeDB 的原生类型名称(如 `UInt8`、`Int32`、`Int64`)表示**位**数,而 SQL 类型别名 `Int2`、`Int4` 和 `Int8` 遵循 PostgreSQL/MySQL 约定表示**字节**数。例如,原生类型 `Int8` 是 8 **位**整数(`TinyInt`, 1 字节),而 SQL 别名 `INT8` 映射到 8 **字节**整数(`BigInt`,64 位)。 ::: 在创建表时也可以使用这些别名类型。 From 6bb378eb6281d008002c71129e669827fbf4dd75 Mon Sep 17 00:00:00 2001 From: Dennis Zhuang Date: Sat, 22 Nov 2025 05:54:55 +0800 Subject: [PATCH 10/11] chore: revert the table columns order Signed-off-by: Dennis Zhuang --- docs/reference/sql/data-types.md | 37 ++++++++++--------- .../current/reference/sql/data-types.md | 36 +++++++++--------- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index 6843529da..c5c294396 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -309,24 +309,25 @@ INSERT INTO bools(b) VALUES (TRUE), (FALSE); For users migrating from MySQL or PostgreSQL to GreptimeDB, GreptimeDB supports the following alias types. -| Data Type | Alias Types | -| ---------------------- | --------------------------------------------------------------- | -| `String` | `Text`, `TinyText`, `MediumText`, `LongText`, `Varchar`, `Char` | -| `Binary` | `Varbinary` | -| `Int8` | `TinyInt` | -| `Int16` | `SmallInt`, `Int2` | -| `Int32` | `Int`, `Int4` | -| `Int64` | `BigInt`, `Int8` | -| `UInt8` | `UnsignedTinyInt` | -| `UInt16` | `UnsignedSmallInt` | -| `UInt32` | `UnsignedInt` | -| `UInt64` | `UnsignedBigInt` | -| `Float32` | `Float`, `Float4` | -| `Float64` | `Double`, `Float8` | -| `TimestampSecond` | `Timestamp_s`, `Timestamp_sec`, `Timestamp(0)` | -| `TimestampMillisecond` | `Timestamp`, `Timestamp_ms`, `Timestamp(3)` | -| `TimestampMicroSecond` | `Timestamp_us`, `Timestamp(6)` | -| `TimestampNanosecond` | `Timestamp_ns`, `Timestamp(9)` | + +| SQL Datatype Alias | Native Datatype | +| --------------------------------------------------------------- | ---------------------- | +| `Text`, `TinyText`, `MediumText`, `LongText`, `Varchar`, `Char` | `String` | +| `Varbinary` | `Binary` | +| `TinyInt` | `Int8` | +| `SmallInt`, `Int2` | `Int16` | +| `Int`, `Int4` | `Int32` | +| `BigInt`, `Int8` | `Int64` | +| `UnsignedTinyInt` | `UInt8` | +| `UnsignedSmallInt` | `UInt16` | +| `UnsignedInt` | `UInt32` | +| `UnsignedBigInt` | `UInt64` | +| `Float`, `Float4` | `Float32` | +| `Double`, `Float8` | `Float64` | +| `Timestamp_s`, `Timestamp_sec`, `Timestamp(0)` | `TimestampSecond` | +| `Timestamp`, `Timestamp_ms`, `Timestamp(3)` | `TimestampMillisecond` | +| `Timestamp_us`, `Timestamp(6)` | `TimestampMicroSecond` | +| `Timestamp_ns`, `Timestamp(9)` | `TimestampNanosecond` | :::warning Breaking Change The type aliases `Int2`, `Int4`, `Int8`, `Float4`, and `Float8` follow the PostgreSQL and MySQL convention where these identifiers refer to the number of **bytes** (not bits) in the type. diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md index dc108ad32..2ad78a39b 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md @@ -308,24 +308,24 @@ INSERT INTO bools(b) VALUES (TRUE), (FALSE); 对于从 MySQL 或 PostgreSQL 迁移到 GreptimeDB 的用户,GreptimeDB 支持以下类型别名。 -| 数据类型 | 别名 | -| ---------------------- | --------------------------------------------------------------- | -| `String` | `Text`, `TinyText`, `MediumText`, `LongText`, `Varchar`, `Char` | -| `Binary` | `Varbinary` | -| `Int8` | `TinyInt` | -| `Int16` | `SmallInt`, `Int2` | -| `Int32` | `Int`, `Int4` | -| `Int64` | `BigInt`, `Int8` | -| `UInt8` | `UnsignedTinyInt` | -| `UInt16` | `UnsignedSmallInt` | -| `UInt32` | `UnsignedInt` | -| `UInt64` | `UnsignedBigInt` | -| `Float32` | `Float`, `Float4` | -| `Float64` | `Double`, `Float8` | -| `TimestampSecond` | `Timestamp_s`, `Timestamp_sec`, `Timestamp(0)` | -| `TimestampMillisecond` | `Timestamp`, `Timestamp_ms` , `Timestamp(3)` | -| `TimestampMicroSecond` | `Timestamp_us`, `Timestamp(6)` | -| `TimestampNanosecond` | `Timestamp_ns`, `Timestamp(9)` | +| SQL 类型别名 | Native 数据类型 | +| --------------------------------------------------------------- | ---------------------- | +| `Text`, `TinyText`, `MediumText`, `LongText`, `Varchar`, `Char` | `String` | +| `Varbinary` | `Binary` | +| `TinyInt` | `Int8` | +| `SmallInt`, `Int2` | `Int16` | +| `Int`, `Int4` | `Int32` | +| `BigInt`, `Int8` | `Int64` | +| `UnsignedTinyInt` | `UInt8` | +| `UnsignedSmallInt` | `UInt16` | +| `UnsignedInt` | `UInt32` | +| `UnsignedBigInt` | `UInt64` | +| `Float`, `Float4` | `Float32` | +| `Double`, `Float8` | `Float64` | +| `Timestamp_s`, `Timestamp_sec`, `Timestamp(0)` | `TimestampSecond` | +| `Timestamp`, `Timestamp_ms`, `Timestamp(3)` | `TimestampMillisecond` | +| `Timestamp_us`, `Timestamp(6)` | `TimestampMicroSecond` | +| `Timestamp_ns`, `Timestamp(9)` | `TimestampNanosecond` | :::warning 重要变更 类型别名 `Int2`、`Int4`、`Int8`、`Float4` 和 `Float8` 遵循 PostgreSQL 和 MySQL 的约定,这些标识符表示类型中的**字节**数(而非位数)。 From cebf256efed2dba3d4f8c55751f919a25af3d04d Mon Sep 17 00:00:00 2001 From: Dennis Zhuang Date: Sat, 22 Nov 2025 07:46:33 +0800 Subject: [PATCH 11/11] chore: remove breaking change Signed-off-by: Dennis Zhuang --- docs/reference/sql/data-types.md | 4 ++-- .../current/reference/sql/data-types.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/reference/sql/data-types.md b/docs/reference/sql/data-types.md index c5c294396..7f1d6800f 100644 --- a/docs/reference/sql/data-types.md +++ b/docs/reference/sql/data-types.md @@ -329,13 +329,13 @@ For users migrating from MySQL or PostgreSQL to GreptimeDB, GreptimeDB supports | `Timestamp_us`, `Timestamp(6)` | `TimestampMicroSecond` | | `Timestamp_ns`, `Timestamp(9)` | `TimestampNanosecond` | -:::warning Breaking Change +:::warning Note The type aliases `Int2`, `Int4`, `Int8`, `Float4`, and `Float8` follow the PostgreSQL and MySQL convention where these identifiers refer to the number of **bytes** (not bits) in the type. Specifically: - `Int2` = 2 bytes = `SmallInt` (16-bit) - `Int4` = 4 bytes = `Int` (32-bit) -- `Int8` = 8 bytes = `BigInt` (64-bit) - **Breaking**: Previously mapped to `TinyInt` (8-bit) +- `Int8` = 8 bytes = `BigInt` (64-bit) - `Float4` = 4 bytes = `Float` (32-bit) - `Float8` = 8 bytes = `Double` (64-bit) diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md index 2ad78a39b..223e1d1b8 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/data-types.md @@ -327,13 +327,13 @@ INSERT INTO bools(b) VALUES (TRUE), (FALSE); | `Timestamp_us`, `Timestamp(6)` | `TimestampMicroSecond` | | `Timestamp_ns`, `Timestamp(9)` | `TimestampNanosecond` | -:::warning 重要变更 +:::warning 注意 类型别名 `Int2`、`Int4`、`Int8`、`Float4` 和 `Float8` 遵循 PostgreSQL 和 MySQL 的约定,这些标识符表示类型中的**字节**数(而非位数)。 具体来说: - `Int2` = 2 字节 = `SmallInt`(16 位) - `Int4` = 4 字节 = `Int`(32 位) -- `Int8` = 8 字节 = `BigInt`(64 位)- **不兼容变更**:之前映射到 `TinyInt`(8 位) +- `Int8` = 8 字节 = `BigInt`(64 位) - `Float4` = 4 字节 = `Float`(32 位) - `Float8` = 8 字节 = `Double`(64 位)