Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add support for altering table options in SQL documentation #1253

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/reference/sql/alter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ALTER TABLE [db.]table
| DROP COLUMN name
| MODIFY COLUMN name type
| RENAME name
| SET <option_name>=<option_value> [, ...]
]
```

Expand Down Expand Up @@ -65,6 +66,17 @@ ALTER TABLE monitor MODIFY COLUMN load_15 STRING;

The modified column cannot be a tag (primary key) or time index, and it must be nullable to ensure that the data can be safely converted (returns `NULL` on cast failures).

### Alter table options

`ALTER TABLE` statements can also be used to change the options of tables.

Currently following options are supported:
- `ttl`: the retention time of data in table

```sql
ALTER TABLE monitor SET 'ttl'='1d';
```

### Rename table

Renames the table:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ALTER TABLE [db.]table
| DROP COLUMN name
| MODIFY COLUMN name type
| RENAME name
| SET <option_name>=<option_value> [, ...]
]
```

Expand Down Expand Up @@ -66,6 +67,16 @@ ALTER TABLE monitor MODIFY COLUMN load_15 STRING;

被修改的的列不能是 tag 列(primary key)或 time index 列,同时该列必须允许空值 `NULL` 存在来保证数据能够安全地进行转换(转换失败时返回 `NULL`)。

### 修改表的参数

`ALTER TABLE` 语句也可以用来更改表的选项。
当前支持修改以下表选项:
- `ttl`: 表数据的保留时间

```sql
ALTER TABLE monitor SET 'ttl'='1d';
```

### 重命名表

```sql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ALTER TABLE [db.]table
| DROP COLUMN name
| MODIFY COLUMN name type
| RENAME name
| SET <option_name>=<option_value> [, ...]
]
```

Expand Down Expand Up @@ -66,6 +67,16 @@ ALTER TABLE monitor MODIFY COLUMN load_15 STRING;

被修改的的列不能是 tag 列(primary key)或 time index 列,同时该列必须允许空值 `NULL` 存在来保证数据能够安全地进行转换(转换失败时返回 `NULL`)。

### 修改表的参数

`ALTER TABLE` 语句也可以用来更改表的选项。
当前支持修改以下表选项:
- `ttl`: 表数据的保留时间

```sql
ALTER TABLE monitor SET 'ttl'='1d';
```

### 重命名表

```sql
Expand Down
12 changes: 12 additions & 0 deletions versioned_docs/version-0.9/reference/sql/alter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ALTER TABLE [db.]table
| DROP COLUMN name
| MODIFY COLUMN name type
| RENAME name
| SET <option_name>=<option_value> [, ...]
]
```

Expand Down Expand Up @@ -65,6 +66,17 @@ ALTER TABLE monitor MODIFY COLUMN load_15 STRING;

The modified column cannot be a tag (primary key) or time index, and it must be nullable to ensure that the data can be safely converted (returns `NULL` on cast failures).

### Alter table options

`ALTER TABLE` statements can also be used to change the options of tables.

Currently following options are supported:
- `ttl`: the retention time of data in table

```sql
ALTER TABLE monitor SET 'ttl'='1d';
```

### Rename table

Renames the table:
Expand Down
Loading