title: JSONB ILIKE indexing
body: <p>I have a table <code>people</code> with <code>body</code> column as a <code>jsonb</code> type.</p>
  
  <pre><code>                                        Table "public.people"
       Column      |            Type             | Collation | Nullable |      Default       | Storage  | Stats target | Description
  -----------------+-----------------------------+-----------+----------+--------------------+----------+--------------+-------------
   id              | uuid                        |           | not null | uuid_generate_v4() | plain    |              |
   body            | jsonb                       |           | not null |                    | extended |              |
  
  Indexes:
      "people_pkey" PRIMARY KEY, btree (id)
      "idx_name" gin ((body -&gt;&gt; 'name'::text) gin_trgm_ops)
  </code></pre>
  
  <p>My index looks as follows:</p>
  
  <pre><code>CREATE INDEX idx_name ON people USING gin ((body -&gt;&gt; 'name') gin_trgm_ops);
  </code></pre>
  
  <p>However, when I do:</p>
  
  <pre><code>EXPLAIN ANALYZE SELECT * FROM "people" WHERE ((body -&gt;&gt; 'name') ILIKE '%asd%') LIMIT 40 OFFSET 0;
  </code></pre>
  
  <p>I see:</p>
  
  <pre><code>Limit  (cost=0.00..33.58 rows=40 width=104) (actual time=100.037..4066.964 rows=11 loops=1)                                                     
     -&gt;  Seq Scan on people  (cost=0.00..2636.90 rows=3141 width=104) (actual time=99.980..4066.782 rows=11 loops=1) 
           Filter: ((body -&gt;&gt; 'name'::text) ~~* '%asd%'::text)                                                                                     
           Rows Removed by Filter: 78516                                                                                                           
   Planning time: 0.716 ms                                                                                                                         
   Execution time: 4067.038 ms
  </code></pre>
  
  <p>Why is the index not used there?</p>