PSql case sensitivy in EF Core

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
dgxhubbard
Posts: 47
Joined: Fri 14 Aug 2015 20:58

PSql case sensitivy in EF Core

Post by dgxhubbard » Fri 13 Jul 2018 16:25

Does dotConnect for Postgre have any sort of processing to make a sql statement case sensitive.
Right now we are manually processing our raw sql and double quoting where needed.

Example

Code: Select all

select distinct "Buyers"."Name", "Buyers"."Description" from "MySchema"."Buyers" order by "Name";

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: PSql case sensitivy in EF Core

Post by Shalex » Tue 17 Jul 2018 09:52

ADO.NET: default case in PostgreSQL Server is a lower case. You should either name objects in database in a default (lower) case or quote identifiers' names in the query manually.

EF Core: please set config.Workarounds.DisableQuoting=false; in your EF Core code. Refer to https://devart.com/dotconnect/postgresq ... tions.html.

dgxhubbard
Posts: 47
Joined: Fri 14 Aug 2015 20:58

Re: PSql case sensitivy in EF Core

Post by dgxhubbard » Tue 17 Jul 2018 22:57

I am getting the right behavior from ef core statements and double quotes. I am saying we have manual queries we need to run against sqlite, sql server and postgre. In the dotConnect Postgre porvider is there a general method users can get to and give the method a query and have the table names, schema and column names double quoted for us.
This would be a great feature.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: PSql case sensitivy in EF Core

Post by Shalex » Wed 18 Jul 2018 05:57

We recommend you to use lower case for all names in your PostgreSQL database to avoid the need to quote identifiers.

dgxhubbard
Posts: 47
Joined: Fri 14 Aug 2015 20:58

Re: PSql case sensitivy in EF Core

Post by dgxhubbard » Wed 18 Jul 2018 16:06

The problem is we run against multiple databases and that is not an option.
That is why I asked if you had such a method it would be a great benefit to customers.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: PSql case sensitivy in EF Core

Post by Shalex » Mon 23 Jul 2018 09:23

We think that quoting queries is a task of the code that constructs these queries. For example: PgSqlCommandBuilder, EF engine.

If you initialize cmd.CommandText with some query, the provider should execute the query as it is.

Why don't you want to use the same quoted queries for both SQL Server and PostgreSQL?

Post Reply