Masking policy: Comply with the length, scale, and precision of a column¶
Attention
This behavior change is in the 2024_04 bundle.
For the current status of the bundle, refer to Bundle History.
The runtime behavior of a masking policy and the masked output in terms of the length, scale, and precision of a column is as follows:
- Before the change:
The masked value as specified in the body of the masking policy does not respect the length, precision, and scale of a column.
For example, consider a column that is defined as VARCHAR(6). The masking policy on the column specifies a masked value of
***MASKED***
. The masked value has a length of 12. The query output for the protected column returns***MASKED***
even though the masked value has a greater length than what the column allows.- After the change:
If you create a new masking policy after enabling the
2024_04
behavior change bundle, set the masking policy on a column, and query the protected column, the following occurs:The query fails when the masked value is greater than the length or precision of the column.
The masked value is truncated to the scale of the column when the scale of the masked value is greater than the scale of the column.
Ref: 1355