云数据库 GAUSSDB-CREATE RESOURCE LABEL:示例

时间:2024-01-23 20:08:50

示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--创建一个表tb_for_label
postgres=# CREATE TABLE tb_for_label(col1 text, col2 text, col3 text);

--创建一个模式schema_for_label
postgres=# CREATE SCHEMA schema_for_label;

--创建一个视图view_for_label
postgres=# CREATE VIEW view_for_label AS SELECT 1;

--创建一个函数func_for_label
postgres=# CREATE FUNCTION func_for_label RETURNS TEXT AS $$ SELECT col1 FROM tb_for_label; $$ LANGUAGE SQL;

--基于表创建资源标签
postgres=# CREATE RESOURCE LABEL IF NOT EXISTS table_label add TABLE(public.tb_for_label);

--基于列创建资源标签
postgres=# CREATE RESOURCE LABEL IF NOT EXISTS column_label add COLUMN(public.tb_for_label.col1);

--基于模式创建资源标签
postgres=# CREATE RESOURCE LABEL IF NOT EXISTS schema_label add SCHEMA(schema_for_label);

--基于视图创建资源标签
postgres=# CREATE RESOURCE LABEL IF NOT EXISTS view_label add VIEW(view_for_label);

--基于函数创建资源标签
postgres=# CREATE RESOURCE LABEL IF NOT EXISTS func_label add FUNCTION(func_for_label);
support.huaweicloud.com/devg-v1-gaussdb/gaussdb_devg_0548.html