title: Postgres search using lower() index
body: <p>I have a Postgres table containing column with stings in upper and lower case characters.</p>
  
  <pre><code>Table: company
  id| name    | department
  ------------------------
  1 | LM Corp | Repair
  2 | BMG Inc | Maintenance
  3 | DFR LLC | shipping
  </code></pre>
  
  <p>Using pgAdmin I created an index on the column as follows:</p>
  
  <pre><code>CREATE INDEX companydepartment_index
  ON public.company (lower(department) ASC NULLS LAST);
  </code></pre>
  
  <p>When I do a query where input string is lowercase 'repair' then I don't get a match.</p>
  
  <pre><code>select company.id from company where company.department = lower($1));
  </code></pre>
  
  <p>Why isn't Postgres using the lowercase index to match the lowercase string?</p>
  
  <p>I don't want to use: ...where lower(company.department) = lower($1)),  because it defeats the purpose of having a lowercase index.</p>