You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Adding a stored computed column with ALTER TABLE is not supported yet.
65
66
- When you change the data type of a table's columns, there's a risk of conversion errors. For example, if you try to convert a column with text (String) to numbers (Float), it might cause problems.
66
67
- When you set a masking policy for a column, make sure that the data type (refer to the parameter *arg_type_to_mask* in the syntax of [CREATE MASKING POLICY](../12-mask-policy/create-mask-policy.md)) defined in the policy matches the column.
68
+
- Use the optional `USING` clause when the policy definition expects additional parameters. List the column mapped to each policy argument in order; the first argument always represents the column being masked.
69
+
- If you include `USING`, provide at least the masked column plus any additional columns needed by the policy. The first identifier in `USING (...)` must match the column being modified.
70
+
- Masking policies can only be attached to regular tables. Views, streams, and temporary tables do not allow `SET MASKING POLICY`.
71
+
- A column can belong to at most one security policy (masking or row-level). Remove the existing policy before attaching a new one.
72
+
:::
73
+
74
+
:::caution
75
+
You must `ALTER TABLE ... MODIFY COLUMN <col> UNSET MASKING POLICY` before changing the column definition or dropping the column; otherwise the statement fails because the column is still protected by a security policy.
67
76
:::
68
77
69
78
## Examples
@@ -234,19 +243,20 @@ SHOW CREATE TABLE students_info;
| policy_name | The name of the masking policy to be created. |
28
-
| arg_name_to_mask | The name of the original data parameter that needs to be masked. |
29
-
| arg_type_to_mask | The data type of the original data parameter to be masked. |
30
-
| expression_on_arg_name | An expression that determines how the original data should be treated to generate the masked data. |
31
-
| comment | An optional comment providing information or notes about the masking policy. |
25
+
| Parameter | Description |
26
+
|------------------------|-------------|
27
+
|`policy_name`| Name of the masking policy to be created. |
28
+
|`arg_name_to_mask`| Parameter that represents the column being masked. This argument must appear first and automatically binds to the column referenced in `SET MASKING POLICY`. |
29
+
|`arg_type_to_mask`| Data type of the masked column. It must match the data type of the column where the policy is applied. |
30
+
|`arg_1 ... arg_n`| Optional extra parameters for additional columns that the policy logic depends on. Provide these columns through the `USING` clause when you attach the policy. |
31
+
|`arg_type_1 ... arg_type_n`| Data types for each optional parameter. They must match the columns listed in the `USING` clause. |
32
+
|`expression_on_arg_name`| Expression that determines how the input columns should be treated to generate the masked data. |
33
+
|`comment`| Optional comment that stores notes about the masking policy. |
32
34
33
35
:::note
34
-
Ensure that *arg_type_to_mask* matches the data type of the column where the masking policy will be applied.
36
+
Ensure that *arg_type_to_mask* matches the data type of the column where the masking policy will be applied. When your policy defines multiple parameters, list each referenced column in the same order within the `USING` clause of `ALTER TABLE ... SET MASKING POLICY`.
35
37
:::
36
38
37
39
## Examples
@@ -57,37 +59,37 @@ GRANT ALL ON *.* TO ROLE 'MANAGERS';
57
59
CREATEUSERmanager_user IDENTIFIED BY 'databend';
58
60
GRANT ROLE 'MANAGERS' TO 'manager_user';
59
61
60
-
-- Create a masking policy
61
-
CREATE MASKING POLICY email_mask
62
+
-- Create a masking policy that expects an extra column
0 commit comments