我创建的Postgres SQL视图与SQL语句创建视图的Postgres SQL与评论
CREATE OR REPLACE VIEW {ViewName} as
Select
.....
我问有没有什么方法来创建视图的列注释。 创建视图后,它生成时的注释被添加到列的错误:
ERROR: "{ViewName}" is not a table, composite type, or foreign table.
我创建的Postgres SQL视图与SQL语句创建视图的Postgres SQL与评论
CREATE OR REPLACE VIEW {ViewName} as
Select
.....
我问有没有什么方法来创建视图的列注释。 创建视图后,它生成时的注释被添加到列的错误:
ERROR: "{ViewName}" is not a table, composite type, or foreign table.
要定义上一列(或一视图)注释使用comment on
:
create view some_view
as
select x as col1, y as col2, z as col3
from some_table;
然后:
comment on view some_view is 'Some View';
comment on column some_view.col1 is 'Originally column X';
好吧我设法添加对视图本身的评论,但我得到一个错误 错误:跨数据库引用未实现:“some_view.col1” – IvoAtanasov
@IvoAtanasov:这是一个完全不同的问题,只有当您向我们展示您正在使用的** reall **和** complete **声明时才能回答。但你应该为此创建一个[新问题](https://stackoverflow.com/questions/ask)。 –
它的工作我只是拼错我的专栏名称,对不起。感谢@a_horse_with_no_name – IvoAtanasov
请分享完整的陈述,或至少评论youwant –
的显示例子是什么产生错误的SQL语句? –
创建或更换视图{ViewName}为 选择 column1, column2, .... – IvoAtanasov