I am currently doing a Java project which has been in development for a few months. The project is almost complete, and now I realized that Postgres is a case sensitive.
During my login process, it can't differentiate between username
and "UserName". I am using Java base, Hibernate and JPA as the backend implementation, and using Postgres as the database.
I have been searching internet for the solutions, and most of the answer I get were suggesting me using solution:
select loginId from user where
lower(loginId)=loginid.toLowerCase();
or change the data type for the table column to citext.
But is there any faster way of doing this? Or maybe is there any variable in Postgres.conf
able to control case insensitive? Or in hibernate I able to control it easily?
I understand that using method lower(loginId)=loginId.toLowerCase()
is the easiest way to fix the problem, but there is a lot of code that I need to change in my project, which might take a long time to fix. Change the data type to citext is not really a good solution for a project which has implemented long ago.
Is anyone here has a better solution to fix my current issue?