Skip to content

Commit

Permalink
docs: add constraints for table names (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
v0y4g3r authored Sep 29, 2024
1 parent 904b20b commit 9449d02
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,35 @@ Therefore, it is important to carefully choose your TIME INDEX column before cre
to time series like [InfluxDB][2].
- Table options: when creating a table, you can specify a set of table options, click [here](/reference/sql/create.md#table-options) for more details.

### Table name constraints

GreptimeDB supports a limited set of special characters in table names, but they must adhere to the following constraints:
- A valid GreptimeDB table name must start with a letter (either lowercase or uppercase) or `-` / `_` / `:`.
- The rest part of table name can be alphanumeric or special characters within: `-` / `_` / `:` / `@` / `#`.
- Any table name containing special characters must be quoted with backquotes.

Here are some examples:
```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);

-- ✅ Ok
create table `a@b` (ts timestamp time index);
```


[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ GreptimeDB 目前不支持在创建表后更改 TIME INDEX 约束,
- 主键:`Primary key`指定的主键列类似于其他时序系统中的 Tag,比如 [InfluxDB][1]。 主键和时间戳列用于唯一地定义一条时间线,这类似于其他时间序列系统中的时间线的概念,如 [InfluxDB][2]
- 表选项:当创建一个表时,可以指定一组表选项,点击[这里](/reference/sql/create.md#table-options)了解更多细节。

### 表名的限制条件

GreptimeDB 支持在表名中使用有限的特殊字符,但必须遵守以下约束:
- 有效的 GreptimeDB 表名必须以字母(小写或大写)或 `-` / `_` / `:` 开头。
- 表名的其余部分可以是字母数字或以下特殊字符:`-` / `_` / `:` / `@` / `#`
- 任何包含特殊字符的表名都必须用反引号括起来。

以下是有效和无效表名的例子:

```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);

-- ✅ Ok
create table `a@b` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,32 @@ GreptimeDB 目前不支持在创建表后更改已有列的数据模型。
- 主键:`Primary key`指定的主键列类似于其他时序系统中的 Tag,比如 [InfluxDB][1]。 主键和时间戳列用于唯一地定义一条时间线,这类似于其他时间序列系统中的时间线的概念,如 [InfluxDB][2]
- 表选项:当创建一个表时,可以指定一组表选项,点击[这里](../reference/sql/create.md#table-options)了解更多细节。

### 表名的限制条件

GreptimeDB 支持在表名中使用有限的特殊字符,但必须遵守以下约束:
- 有效的 GreptimeDB 表名必须以字母(小写或大写)或 `-` / `_` / `:` 开头。
- 表名的其余部分可以是字母数字或以下特殊字符:`-` / `_` / `:`
- 任何包含特殊字符的表名都必须用反引号括起来。

以下是有效和无效表名的例子:

```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,32 @@ GreptimeDB 目前不支持在创建表后更改已有列的数据模型。
- 主键:`Primary key`指定的主键列类似于其他时序系统中的 Tag,比如 [InfluxDB][1]。 主键和时间戳列用于唯一地定义一条时间线,这类似于其他时间序列系统中的时间线的概念,如 [InfluxDB][2]
- 表选项:当创建一个表时,可以指定一组表选项,点击[这里](../reference/sql/create.md#table-options)了解更多细节。

### 表名的限制条件

GreptimeDB 支持在表名中使用有限的特殊字符,但必须遵守以下约束:
- 有效的 GreptimeDB 表名必须以字母(小写或大写)或 `-` / `_` / `:` 开头。
- 表名的其余部分可以是字母数字或以下特殊字符:`-` / `_` / `:`
- 任何包含特殊字符的表名都必须用反引号括起来。

以下是有效和无效表名的例子:

```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,32 @@ GreptimeDB 目前不支持在创建表后更改 TIME INDEX 约束,
- 主键:`Primary key`指定的主键列类似于其他时序系统中的 Tag,比如 [InfluxDB][1]。 主键和时间戳列用于唯一地定义一条时间线,这类似于其他时间序列系统中的时间线的概念,如 [InfluxDB][2]
- 表选项:当创建一个表时,可以指定一组表选项,点击[这里](/reference/sql/create.md#table-options)了解更多细节。

### 表名的限制条件

GreptimeDB 支持在表名中使用有限的特殊字符,但必须遵守以下约束:
- 有效的 GreptimeDB 表名必须以字母(小写或大写)或 `-` / `_` / `:` 开头。
- 表名的其余部分可以是字母数字或以下特殊字符:`-` / `_` / `:`
- 任何包含特殊字符的表名都必须用反引号括起来。

以下是有效和无效表名的例子:

```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,32 @@ GreptimeDB 目前不支持在创建表后更改 TIME INDEX 约束,
- 主键:`Primary key`指定的主键列类似于其他时序系统中的 Tag,比如 [InfluxDB][1]。 主键和时间戳列用于唯一地定义一条时间线,这类似于其他时间序列系统中的时间线的概念,如 [InfluxDB][2]
- 表选项:当创建一个表时,可以指定一组表选项,点击[这里](/reference/sql/create.md#table-options)了解更多细节。

### 表名的限制条件

GreptimeDB 支持在表名中使用有限的特殊字符,但必须遵守以下约束:
- 有效的 GreptimeDB 表名必须以字母(小写或大写)或 `-` / `_` / `:` 开头。
- 表名的其余部分可以是字母数字或以下特殊字符:`-` / `_` / `:`
- 任何包含特殊字符的表名都必须用反引号括起来。

以下是有效和无效表名的例子:

```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
25 changes: 25 additions & 0 deletions versioned_docs/version-0.6/user-guide/table-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,31 @@ Therefore, it is important to carefully design your data model before creating t
to time series like [InfluxDB][2].
- Table options: when creating a table, you can specify a set of table options, click [here](../reference/sql/create.md#table-options) for more details.

### Table name constraints

GreptimeDB supports a limited set of special characters in table names, but they must adhere to the following constraints:
- A valid GreptimeDB table name must start with a letter (either lowercase or uppercase) or `-` / `_` / `:`.
- The rest part of table name can be alphanumeric or special characters within: `-` / `_` / `:`.
- Any table name containing special characters must be quoted with backquotes.

Here are some examples:
```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
25 changes: 25 additions & 0 deletions versioned_docs/version-0.7/user-guide/table-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,31 @@ Therefore, it is important to carefully design your data model before creating t
to time series like [InfluxDB][2].
- Table options: when creating a table, you can specify a set of table options, click [here](../reference/sql/create.md#table-options) for more details.

### Table name constraints

GreptimeDB supports a limited set of special characters in table names, but they must adhere to the following constraints:
- A valid GreptimeDB table name must start with a letter (either lowercase or uppercase) or `-` / `_` / `:`.
- The rest part of table name can be alphanumeric or special characters within: `-` / `_` / `:`.
- Any table name containing special characters must be quoted with backquotes.

Here are some examples:
```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
25 changes: 25 additions & 0 deletions versioned_docs/version-0.8/user-guide/table-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,31 @@ Therefore, it is important to carefully choose your TIME INDEX column before cre
to time series like [InfluxDB][2].
- Table options: when creating a table, you can specify a set of table options, click [here](/reference/sql/create.md#table-options) for more details.

### Table name constraints

GreptimeDB supports a limited set of special characters in table names, but they must adhere to the following constraints:
- A valid GreptimeDB table name must start with a letter (either lowercase or uppercase) or `-` / `_` / `:`.
- The rest part of table name can be alphanumeric or special characters within: `-` / `_` / `:`.
- Any table name containing special characters must be quoted with backquotes.

Here are some examples:
```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down
26 changes: 26 additions & 0 deletions versioned_docs/version-0.9/user-guide/table-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,32 @@ Therefore, it is important to carefully choose your TIME INDEX column before cre
to time series like [InfluxDB][2].
- Table options: when creating a table, you can specify a set of table options, click [here](/reference/sql/create.md#table-options) for more details.


### Table name constraints

GreptimeDB supports a limited set of special characters in table names, but they must adhere to the following constraints:
- A valid GreptimeDB table name must start with a letter (either lowercase or uppercase) or `-` / `_` / `:`.
- The rest part of table name can be alphanumeric or special characters within: `-` / `_` / `:`.
- Any table name containing special characters must be quoted with backquotes.

Here are some examples:
```sql
-- ✅ Ok
create table a (ts timestamp time index);

-- ✅ Ok
create table a0 (ts timestamp time index);

-- 🚫 Invalid table name
create table 0a (ts timestamp time index);

-- 🚫 Invalid table name
create table -a (ts timestamp time index);

-- ✅ Ok
create table `-a` (ts timestamp time index);
```

[1]: https://docs.influxdata.com/influxdb/v1.8/concepts/glossary/#tag-key
[2]: https://docs.influxdata.com/influxdb/v1/concepts/glossary/#series

Expand Down

0 comments on commit 9449d02

Please sign in to comment.