title: Liquibase and functional index
body: <p>If you try to execute a script to create a functional index on the H2 (PostgreSQL-oriented context) when using Liquibase, a suspicious error occurs.</p>
  <p>The script itself looks like this:</p>
  <pre><code>    &lt;changeSet id=&quot;2&quot; author=&quot;...&quot;&gt;
          &lt;createIndex tableName=&quot;test_table&quot; indexName=&quot;test_table_id_idx&quot;&gt;
              &lt;column name=&quot;(date_trunc('day', create_date))&quot;/&gt;
          &lt;/createIndex&gt;
      &lt;/changeSet&gt;
  
  </code></pre>
  <p>Error message:</p>
  <pre><code>Syntax error in SQL statement &quot;CREATE INDEX TEST_TABLE_ID_IDX ON TEST_TABLE(([*]DATE_TRUNC('day', CREATE_DATE)))&quot;; expected &quot;identifier&quot;; 
  SQL statement: CREATE INDEX test_table_id_idx ON test_table((date_trunc('day', create_date))) [42001-200]
  </code></pre>
  <p><a href="https://github.com/inkarnadin/liquibase-h2-index-poc" rel="nofollow noreferrer">PoC on GitHub</a></p>
  <p>To be honest, I do not have ideas from where such a strange supplement of the script appears (about this <code>[*]</code>). Perhaps H2 does not understand which field you need to use and substitutes Vilcard or something like that.</p>
  <p>Yes, I know about possible collisions and differences in the implementation of H2 and the real PostgreSQL (if that, on the PostgreSQL script is performed correctly), but I would like to understand what causes the generation of such a change of the script.</p>