title: TypeORM select with case insensitive distinct
body: <p>I'm trying to create a TypeORM query builder that connects to a postgresql DB to get all unique names in the DB. My query looks like this</p>
  <pre><code>names = await this._context.manager
          .getRepository(Names)
          .createQueryBuilder('names')
          .select('DISTINCT ON (names.name) names.name')
          .orderBy('names.name', 'ASC')
          .getRawMany();
  </code></pre>
  <p>Right now this query fetches all names in the DB but it's case sensitive so it can't sort out duplicates like 'Jane Doe' from 'jane doe'. So far i've tried to make the distinct upper/lowercase like this:
  <code>.select('DISTINCT ON LOWER(names.name) names.name')</code> but that doesn't work. I also found a .distinctOn() function but i couldn't make that case insensitive either.</p>
  <p>I'm new to typeORM so i'm at a bit of a loss on where to go from here, any ideas?</p>
  <p>I'm working in Node.JS towards a postgresql DB if that makes a difference.</p>