LaV*_*che 5 postgresql alter-table generated-columns
我使用的是 postgres 13.3,并且我已经有一个现有的表,其中有一GENERATED列,例如:
CREATE TABLE test_table (
id uuid NOT NULL DEFAULT uuid_generate_v4(),
the_column_to_alter bool NOT NULL GENERATED ALWAYS AS (2 > 1) STORED,
CONSTRAINT test_table2_pkey PRIMARY KEY (id)
);
Run Code Online (Sandbox Code Playgroud)
但我现在改变了主意,我希望它只是一个常规的非生成列,我可以手动编辑......
DROP创建该列这可能吗?ALTER对列执行此操作的查询是什么the_column_to_alter?
以下是原始帖子中示例表的命令:
ALTER TABLE test_table ALTER COLUMN the_column_to_alter DROP EXPRESSION;
Run Code Online (Sandbox Code Playgroud)
postgres 手册页在这里:https ://www.postgresql.org/docs/current/sql-altertable.html
| 归档时间: |
|
| 查看次数: |
2592 次 |
| 最近记录: |