Liquibase creates two indexes same name then complains about it

image
image

It doesn’t even check if there already are existent indexes with the same name in the database… another problem

Hello,

Could you provide more information about your issue please? Such as the entity code and the full stack trace of the liquibase error. What DBMS are you using?
It seems that your table and column names are too long and studio doesn’t give them unique names when it shortens them during generation.

The problem exactly. (I’m using postgres)
I have a lot of tables that have similar long names. liquibase keeps throwing errors and i have to go the SQL and manually change these things.

  • It generates a lot of duplicate index names without adding a number to distinguish. it just truncates it.
  • it doesn’t check if the index already exists

Thank you

Caused by: liquibase.exception.DatabaseException: ERROR: relation “idx_aptbusinessp_businessproc” already exists [Failed SQL: (0) CREATE INDEX IDX_APTBUSINESSP_BUSINESSPROC ON public.APT_BUSINESS_PROCESS_TYPE_TA_1(BUSINESS_PROCESS_TYPE_TASK_ID)]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:397)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:83)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:151)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1279)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1261)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:661)
… 46 more
Caused by: org.postgresql.util.PSQLException: ERROR: relation “idx_aptbusinessp_businessproc” already exists
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2365)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:355)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:490)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:408)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:329)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:315)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:291)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:286)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:393)
… 51 more

Is there a solution in the meantime?

I am experiencing the same issue in a Jmix 2.8.2 project (using Jmix Studio 3.0.1-261).

Are the index names generated by Liquibase or by the Jmix Studio Designer?

P.S. Once having (re)generated a Liquibase changelog with duplicate indexes, the Studio plugin refuses to display the Index tab on the entity. I have to manipulate the index name in the source file.