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

时间:2023-11-01 16:22:10

示例

 1 2 3 4 5 6 7 8 91011121314151617181920212223242526
--创建一个表tb_for_labelopenGauss=# CREATE TABLE tb_for_label(col1 text, col2 text, col3 text);--创建一个模式schema_for_labelopenGauss=# CREATE SCHEMA schema_for_label;--创建一个视图view_for_labelopenGauss=# CREATE VIEW view_for_label AS SELECT 1;--创建一个函数func_for_labelopenGauss=# 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);
support.huaweicloud.com/centralized-devg-v2-opengauss/devg_03_0563.html