Column too narrow
Published 12 December 2023
A column in the database has a maximum size that is smaller than the size defined in the configuration.
The size defined in the configuration is used to limit the length of the generated data values.
Understanding the issue
This occurs when your masking configuration specifies a maxLength
value that exceeds the actual column width in the database. For example:
- Database column:
VARCHAR(10)
- Configuration setting:
"maxLength": 25
The masking tool cannot generate data longer than what the database column can store.
How to fix
Option 1: Adjust the configuration (Recommended)
Update your masking configuration to match the database column size:
{ "tables": [ { "schema": "Person", "name": "Address", "columns": [ { "name": "City", "maxLength": 10, // Match database column width "deterministic": false } ] } ] }
Option 2: Expand the database column
If the column genuinely needs to store longer values:
- Increase the column size in your database schema
- Update the masking configuration to match the new size
- Consider the impact on existing data and applications