Updated on 2024-08-20 GMT+08:00

ALTER RESOURCE LABEL

Description

ALTER RESOURCE LABEL is used to modify a resource label.

Precautions

Only users with the poladmin or sysadmin permission, or the initial user can perform this operation.

Syntax

1
2
ALTER RESOURCE LABEL label_name {ADD|REMOVE} 
  label_item_list[, ...];

  • label_item_list
    1
    resource_type(resource_path[, ...])
    

  • resource_type
    TABLE | COLUMN | SCHEMA | VIEW | FUNCTION

Parameters

  • label_name

    Specifies the resource label name.

    Value range: a string. It must comply with the naming convention.

  • resource_type

    Specifies the type of database resources to be labeled.

  • resource_path

    Specifies the path of database resources.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
-- Create basic table table_for_label.
gaussdb=# CREATE TABLE table_for_label(col1 int, col2 text);

-- Create resource label table_label.
gaussdb=# CREATE RESOURCE LABEL table_label ADD COLUMN(table_for_label.col1);

-- Attach resource label table_label to col2.
gaussdb=# ALTER RESOURCE LABEL table_label ADD COLUMN(table_for_label.col2);

-- Remove table_label from an item.
gaussdb=# ALTER RESOURCE LABEL table_label REMOVE COLUMN(table_for_label.col1);

-- Delete the resource label table_label.
gaussdb=# DROP RESOURCE LABEL table_label;

-- Delete the base table table_for_label.
gaussdb=# DROP TABLE table_for_label;