Open Closed

Error when filtering data #3206


User avatar
0
otee@urvin.finance created

Hello Support,

We get an error when will filter data on the admin section of our application it throws an error as below:

Severity = ERROR InvariantSeverity = ERROR SqlState = 0A000 MessageText = nondeterministic collations are not supported for substring searches File = varlena.c Line = 1209 Routine = text_position_setup

We are using postgres db and we don't get this error in our application because we set the collation used in filtering. We changed our db collation to Provider (icu), Locale(en-u-ks-primary). This ensures our db is case insensitive.

This is one of the points we get this error IdentityUserAppService.GetListAsyncfound in Volo.Abp.Identity namespace

We get same error in other location but once we fix this we can handle others. In this method the error comes up calling UserRepository.GetCountAsync method

In our own code to prevent this error we do something like the code below for filtering:

 queryable = queryable.Where(u => EF.Functions.Collate(u.Name, "default").ToLower().Contains(filter)
              || EF.Functions.Collate(u.Surname, "default").ToLower().Contains(filter));

2 Answer(s)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    This is Database Provider-specific and there is not much we can do about it.

    However, you can override the IIdentityUserRepository repository which is resolved as UserRepository in the IdentityUserAppService. Then, override the GetCountAsync methods and you can write your own filtering.

    Please check overriding existing repository docs for details and sample.

  • User Avatar
    0
    otee@urvin.finance created

    Ok thanks

Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07