vertica增加中文字段注释和中文表名注释

迷南。 2022-05-15 04:41 693阅读 0赞

vertica增加中文字段注释

  1. -- Note:Column comments are on the projection columns.
  2. -- eg.
  3. -- dbadmin=> comment on column public.test1.col1 is 'day';
  4. -- ROLLBACK 2639: Column "test1"."col1" does not exist as a projection column
  5. -- step1:Get table's projection name
  6. select min(projection_schema||'.'||projection_name) projection_name
  7. from projections
  8. where projection_schema = 'public' and anchor_table_name = 'test1'
  9. ;
  10. -- step2:Comment on projection column
  11. comment on column public.test1_super.col1 is 'day';
  12. -- check
  13. select comment from comments where object_name = 'test1_super.col1';
  14. -- Examples
  15. dbadmin=> select min(projection_schema||'.'||projection_name) projection_name from projections where projection_schema = 'public' and anchor_table_name = 'test1';
  16. dbadmin-> ;
  17. projection_name
  18. --------------------
  19. public.test1_super
  20. (1 row)
  21. dbadmin=> \d test1
  22. List of Fields by Tables
  23. Schema | Table | Column | Type | Size | Default | Not Null | Primary Key | Foreign Key
  24. --------+-------+--------+-------------+------+----------------------------------+----------+-------------+-------------
  25. public | test1 | col1 | varchar(8) | 8 | to_char("sysdate"(), 'yyyymmdd') | f | f |
  26. public | test1 | col2 | varchar(12) | 12 | | f | f |
  27. public | test1 | col3 | int | 8 | | f | f |
  28. (3 rows)
  29. dbadmin=> select comment from comments where object_name = 'test1_super.col1';
  30. comment
  31. ---------
  32. (0 rows)
  33. dbadmin=> comment on column public.test1.col1 is 'day';
  34. ROLLBACK 2639: Column "test1"."col1" does not exist as a projection column
  35. dbadmin=> comment on column public.test1_super.col1 is 'day';
  36. COMMENT
  37. dbadmin=> select comment from comments where object_name = 'test1_super.col1';
  38. comment
  39. ---------
  40. day
  41. (1 row)

vertica增加中文字段

  1. dbadmin=> comment on table public.test is '测试表';

发表评论

表情:
评论列表 (有 0 条评论,693人围观)

还没有评论,来说两句吧...

相关阅读

    相关 fastadmin 的注释字段注释

    在安装好 fastdamin 之后,看官方的文档,说是创建表的时候,要写表注释和字段注释; 不了解数据库,只知道简单的表和字段的概念,这个注释是什么还真的不了解,于是,学习一