Prevent username shadowing due to case-sensitive name checks in PostgreSQL

Signed-off-by: Milosz Gaczkowski <milosz@omgomg.eu>

Currently, PostgreSQL will allow case-insensitive logins but
case-sensitive registrations. A critical consequence of that is that
UsErNaMe may easily shadow username, rendering username unable to log in
until UsErNaMe is renamed or deleted.

Overall, it's worth keeping in mind that PostgreSQL's LIKE is
case-sensitive, unlike MySQL's LIKE. Since we claim to support
PostgreSQL, we should be conscious of this and ensure that the
case-insensitive ILIKE is used when needed.
Merge pull request #2622 from sexwarrior/fix-postgresql-usernames

Prevent username shadowing due to case-sensitive name checks in PostgreSQL