Replies: 5 comments
-
That's not a good idea to rely on database object name case-sensitivity behavior. Even for SQL Server it is not always true:
If class/member name doesn't match name of object in database, you need to specify database name using mappings. E.g. using mapping attributes: [Table("my_table")]
class MyTable
{
[Column("my_Column")] public string MyColumn { get; set; }
} |
Beta Was this translation helpful? Give feedback.
-
now I have to specify the name even just the case is different, which is kindof annoying. Maybe because I use SQL server before, I never worried about the object name case sensitivity. I understand what you are saying, but it will be great if we have a switch in the engine, that you can simply turn the name to lower case to compare. |
Beta Was this translation helpful? Give feedback.
-
or to say, have a switch, when generating sql, turn everything to lower case, since that's what postgresql do. |
Beta Was this translation helpful? Give feedback.
-
What's really turn me off is: postgresql is not case sensitive on the column name. It's seems Npgsql.NpgsqlConnector problem. Not Linq2DB. It actually read the data in to the data reader. but the Npgsql.NpgsqlConnector is stupid enough to throw error that the column does not exist, because case sensitivity problem. So it's a driver problem. SQL server driver is case insensitive on column names when materialize from data reader, PostgreSql IS. Seems I need to complain on a different board. :-) Thanks. |
Beta Was this translation helpful? Give feedback.
-
If you need all names in lower-case - you can write custom metadata provider, which will do it for you. #2501 (comment) |
Beta Was this translation helpful? Give feedback.
-
I am new to postgressql for linq2db. I have my class defined, but my class member name and db column name is not exactly the same case. for example, in my class, it's ID, and in db, it's id. This worked in SQL server, but won't work in postgresql any more.
Is there a way to configure the postgresql provider to do the case insensitive reading?
Beta Was this translation helpful? Give feedback.
All reactions