Is there any way to write case-insensitive queries in PostgreSQL, E.g. I want that following 3 queries return same result.
SELECT id FROM groups where name="administrator"
SELECT id FROM groups where name="ADMINISTRATOR"
SELECT id FROM groups where name="Administrator"
1Best Answer
Use LOWER function to convert the strings to lower case before comparing.
Try this:
SELECT id
FROM groups
WHERE LOWER(name)=LOWER('Administrator')