Ivo*_*sov 2 sql postgresql sql-view
我用 sql 语句在 postgres sql 中创建一个视图
CREATE OR REPLACE VIEW {ViewName} as
Select
.....
Run Code Online (Sandbox Code Playgroud)
我问有什么方法可以为视图中的列创建注释。创建视图后,在向列中添加注释时会生成错误:
错误:“{ViewName}”不是表、复合类型或外部表。
要定义对列(或视图)的评论,请使用comment on:
create view some_view
as
select x as col1, y as col2, z as col3
from some_table;
Run Code Online (Sandbox Code Playgroud)
然后:
comment on view some_view is 'Some View';
comment on column some_view.col1 is 'Originally column X';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3075 次 |
| 最近记录: |