Starts in:
1 DAY
20 HRS
41 MIN
56 SEC
Starts in:
1 D
20 H
41 M
56 S
Open Closed

Exception due to SQL string lengths in ABP base tables #5535


User avatar
0
balessi75 created

ABP Commercial 7.2.1 / Blazor Server / EF / Non tiered / Separate Host and Tenant DBs / Lepton Theme

Hi,

The Role UI allows for a role name with a length up to 256 characters, however, the associated AbpPermissionGrants for the role, only allows for the ProviderKey column to have up to 64 characters. Since the role name is stored in the ProviderKey, an SQL exception can occur with long role names.

2023-08-07 22:16:16.993 +00:00 [ERR] An error occurred while saving the entity changes. See the inner exception for details.
Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details.
 ---> Microsoft.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated in table 'test_Web.dbo.AbpPermissionGrants', column 'ProviderKey'. Truncated value: 'Attendance & personal @#$%^&*()_+,.;'':"<>?/\!Updated to be 12345'.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can change the MaxProviderKeyLength and add a new migration file.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06