云数据库 GAUSSDB-CREATE RESOURCE LABEL:示例
时间:2025-03-12 13:58:07
示例
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
--创建一个表tb_for_label。 openGauss=# CREATE TABLE tb_for_label(col1 text, col2 text, col3 text); --创建一个模式schema_for_label。 openGauss=# CREATE SCHEMA schema_for_label; --创建一个视图view_for_label。 openGauss=# CREATE VIEW view_for_label AS SELECT 1; --创建一个函数func_for_label。 openGauss=# CREATE FUNCTION func_for_label RETURNS TEXT AS $$ SELECT col1 FROM tb_for_label; $$ LANGUAGE SQL; --基于表创建资源标签。 openGauss=# CREATE RESOURCE LABEL IF NOT EXISTS table_label add TABLE(public.tb_for_label); --基于列创建资源标签。 openGauss=# CREATE RESOURCE LABEL IF NOT EXISTS column_label add COLUMN(public.tb_for_label.col1); --基于模式创建资源标签。 openGauss=# CREATE RESOURCE LABEL IF NOT EXISTS schema_label add SCHEMA(schema_for_label); --基于视图创建资源标签。 openGauss=# CREATE RESOURCE LABEL IF NOT EXISTS view_label add VIEW(view_for_label); --基于函数创建资源标签。 openGauss=# CREATE RESOURCE LABEL IF NOT EXISTS func_label add FUNCTION(func_for_label); --删除资源标签。 openGauss=# DROP RESOURCE LABEL func_label, view_label, schema_label, column_label, table_label; --删除函数func_for_label。 openGauss=# DROP FUNCTION func_for_label; --删除视图view_for_label。 openGauss=# DROP VIEW view_for_label; --删除模式schema_for_label。 openGauss=# DROP SCHEMA schema_for_label; --删除表tb_for_label。 openGauss=# DROP TABLE tb_for_label; |
support.huaweicloud.com/distributed-devg-v2-gaussdb/gaussdb-12-0371.html