Property not read and causing exception

I am having an issue when using a property in yaml.

The following was defined in the yaml

  - property:
      name: datetime
      value: timestamp
      dbms: oracle,h2
  - property:
      name: datetime
      value: datetime
      dbms: mssql
  - property:
      name: datetime
      dbms: postgresql

When using it in a changeset, liquibase gives the following error

              - column:
                  remarks: Date created
                  name: CREATED_DATE
                  type: ${datetime)

If I change it to hard code the time for postgres, it ran ok

Caused by: liquibase.exception.LiquibaseException: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at ~[liquibase-core-4.5.0.jar:?]
	at liquibase.changelog.DatabaseChangeLog.validate( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Liquibase.lambda$update$1( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Scope.lambda$child$0( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Scope.child( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Scope.child( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Scope.child( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Liquibase.runInScope( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Liquibase.update( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.Liquibase.update( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.integration.spring.SpringLiquibase.performUpdate( ~[liquibase-core-4.5.0.jar:?]
	at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet( ~[liquibase-core-4.5.0.jar:?]
	at ~[spring-beans-5.3.13.jar:5.3.13]
	at ~[spring-beans-5.3.13.jar:5.3.13]
	... 18 more

Hello, @tom2011!

It’s unclear from your post what the question is. Can you please clarify?


@tom2011 if this is still valid (otherwise, might help the next person who encounters similar issue(s)), these might be two potential root causes of the error here:

  • the name of the property is datetime, which on some RDBMSs it is a reserved syntax keyword. I would choose a different name for the property, for being “safe” no matter what. Go with col_type, dt_col_type, CREATED_DATE_TYPE or even RDBMS.datetime (yes, that should work too, having a dot in the name).
  • the value of the PostgreSQL case (TIMESTAMP WITHOUT TIME ZONE) might also cause the error. You could try wrapping that TIMESTAMP WITHOUT TIME ZONE value in " and see if this resolves the issue. Actually, why not use just TIMESTAMP (as the two are equivalent)?

Hope this helps,