title: Postgres GIN Index Not Creating Through Liquibase Scripts
body: <p>I am trying to create a GIN index through liquibase scripts. </p>
  
  <pre><code>CREATE INDEX IF NOT EXISTS index_name ON schema_name.table_name USING gin (column1, lower(column2) COLLATE pg_catalog."default" gin_trgm_ops)
  </code></pre>
  
  <p>Each time migration for the liquibae changeset fails with the following exception: </p>
  
  <blockquote>
    <p>liquibase.exception.DatabaseException: ERROR: operator class "gin_trgm_ops" does not exist for access method "gin" </p>
  </blockquote>
  
  <p>The problem is that this query works when run directly from pgAdmin query tool. There seems to be some issue when running this query from liquibase scripts. </p>
  
  <p>I had to create the following extensions before creating the index from pgAdmin query tool. I am creating these extensions in the liquibase script too.</p>
  
  <pre><code>CREATE EXTENSION IF NOT EXISTS pg_trgm with schema public;
  
  CREATE EXTENSION IF NOT EXISTS btree_gin with schema public;
  </code></pre>
  
  <p>Following is the part of my liquibase script that is creating the extensions and indexes. <strong>Btree</strong> index creating queries work well with the liquibase scripts. It fails with the above exception when trying to create <strong>GIN</strong> index.</p>
  
  <pre><code>CREATE EXTENSION IF NOT EXISTS pg_trgm with schema public;
  
  CREATE EXTENSION IF NOT EXISTS btree_gin with schema public;
  </code></pre>
  
  <p>The following works:</p>
  
  <pre><code>CREATE INDEX IF NOT EXISTS index_name ON table_name USING btree (col1,col2 COLLATE pg_catalog."default") 
  
  CREATE INDEX IF NOT EXISTS index_name ON table_name USING btree (col1, col2 COLLATE pg_catalog."default")
  </code></pre>
  
  <p>But this fails:</p>
  
  <pre><code>CREATE INDEX IF NOT EXISTS index_name ON table_name USING gin (col1, lower(col2) COLLATE pg_catalog."default" gin_trgm_ops)
  </code></pre>