Postgres Autoquery Like is case sensitive


I’m having an issue with %Like% case sensitivity on Postgres.

On northwind both requests return same result sets

while on Postgres (AWS), results are not same due to case sensitivity.


OrmLiteConfig.StripUpperInLike is not set.
Any assistance would be appreciated.

Kind regards

Strange it should be querying with UPPER({Field}) LIKE UPPER({Value}) unless OrmLiteConfig.StripUpperInLike=true:

Can you check what SQL it’s using for the query.

You can override it to use PostgreSQL’s native case-insenstive like with:

var autoquery = new AutoQueryFeature { ... };
autoquery.ImplicitConventions["%Like%"] = "{Field} ILIKE {Value}";

Thank you for your quick response.

WHERE “artikli”.“naziv” LIKE :0
PARAMS: :0=%traka%

When i override it it works as expected.

Same behavior is with StartsWith, EndsWith and Contains but I wasn’t checking if it should behave like that.

Thank you.

(I’ve edited this answer since it contained my wrong observation)

Then the behavior is StripUpperInLike=true which defaults to true in .NET Core builds.

To change it globally (if you want it to be the default in OrmLite):


Or if you just want case-insensitive in AutoQuery:

Plugins.Add(new AutoQueryFeature {
    StripUpperInLike = false
1 Like

It works as expected. Thanks.

1 Like