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

缺少 alter column 的描述 #15931

Open
okJiang opened this issue Dec 27, 2023 · 3 comments
Open

缺少 alter column 的描述 #15931

okJiang opened this issue Dec 27, 2023 · 3 comments

Comments

@okJiang
Copy link
Member

okJiang commented Dec 27, 2023

Change Request

This repository is ONLY used to solve problems related to DOCS-CN.
For other issues (TiDB, TiKV, etc), please move to other repositories.

Please answer the following questions before submitting your issue. Thanks!

  1. Describe what you find is inappropriate or missing in the existing docs.

缺少 alter column 的描述,mysql 官方是有的
image

tidb 也是支持的

mysql> show create table t;
+-------+----------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                             |
+-------+----------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> alter table t alter column set default 2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 30 near "set default 2" 
mysql> alter table t alter column a set default 2;
Query OK, 0 rows affected (0.15 sec)

mysql> show create table t;
+-------+----------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                             |
+-------+----------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` int(11) DEFAULT '2'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                   |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.6.0-alpha-599-g24fcf71e7e-dirty
Edition: Community
Git Commit Hash: 24fcf71e7e3419ae5d6064ff2ba6df370fa70574
Git Branch: bdr-bwlist-2
UTC Build Time: 2023-12-27 07:25:23
GoVersion: go1.21.0
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
  1. Describe your suggestion or addition.

补充上

  1. Provide some reference materials (documents, websites, etc) if you could.

https://dev.mysql.com/doc/refman/8.0/en/alter-table.html

@Oreoxmt
Copy link
Collaborator

Oreoxmt commented Dec 27, 2023

在 ALTER TABLE 语法图中有体现 ALTER COLUMN https://docs.pingcap.com/zh/tidb/stable/sql-statement-alter-table image
@xhebox 看看是否需要在 ALTER TABLE 文档中添加 ALTER COLUMN 示例?

@okJiang
Copy link
Member Author

okJiang commented Dec 27, 2023

主要是在文档里搜索也搜索不到😬

@xhebox
Copy link
Contributor

xhebox commented Dec 27, 2023

@xhebox 看看是否需要在 ALTER TABLE 文档中添加 ALTER COLUMN 示例?

我觉得都可.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants