question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Collations and Case Sensitivity Causes Error "nondeterministic collations are not supported for LIKE"

See original GitHub issue

Following the section under Database Collation in the following document:

http://www.npgsql.org/efcore/misc/collations-and-case-sensitivity.html?tabs=data-annotations

When EF Core attempts to locate data using LIKE, it produces the error “nondeterministic collations are not supported for LIKE”.

  • The version of PostgreSql is PostgreSQL 13.1 (Debian 13.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
  • The version of EF Core is 5

The code is:

protected override void OnModelCreating(ModelBuilder builder)
{
  builder.HasCollation("case_insensitive_collation", locale: "en-u-ks-primary", provider: "icu", deterministic: false);
  builder.UseDefaultColumnCollation("case_insensitive_collation");
}

When I view the code for LIKE, I can see where the error message is being produced and I am wondering is the documentation wrong and this is unsupported? Or, have I done something incorrectly? Or, is there something else that needs to be configured?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
CorporateActionMancommented, Apr 17, 2023

Hi @roji

it would be great if you could get someone try and implement it to see if it is a useful tool for npgsql developers. Bradley and I would be happy to consult in getting them up and running quickly as the first setup can be finickety because of its flexibility.

All the best!

1reaction
YohDeadfallcommented, Jan 24, 2021

@rabidkitten, we are not responsible for PostgreSQL which limitation you faced. At some point they maybe support that and will mention it their own release notes and docs. Therefore, I see no reason why we should just repeat it and take additional burden by maintaining it too in additional to personal documentation, it would be too much for a free open source project maintained by a few people (EF part is utterly maintained by @roji only). We spend our spare time on it which is limited, so please value what you already have. If you thing there’s something to improve then just go on and open a PR instead of complaining how much time you spent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nondeterministic collations are not supported for LIKE ...
select name from testtable1 WHERE name LIKE '%a%' COLLATE ... But, the = operator is still case-sensitive because the collation as defined ...
Read more >
Nondeterministic collations - PostgreSQL Notes
It's possible to ignore accents but not case by staying at primary strength, but setting a boolean attribute to the collation: colCaseLevel.
Read more >
non-deterministic collations doesn't work with Unique=True ...
utils.NotSupportedError: nondeterministic collations are not supported for operator class "varchar_pattern_ops" when the unique=True is also set on the field.
Read more >
POSTGRESQL CASE-INSENSITIVE PATTERN MATCHING
Case -insensitive collations are not compatible with pattern matching. The first issue is merely annoying; however, the second issue will require further ...
Read more >
PostgreSQL case-insensitive and accent-insensitive search
1 Answer. CREATE COLLATION english_ci_ai ( PROVIDER = icu, DETERMINISTIC = FALSE, LOCALE = "en-US-u-ks-level1" );
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found