Search code examples
javaoracle-databasejpaliquibase

Oracle 12.1 primary key length


We are using Liquibase and are trying to create a table in Oracle 12c release (12.1.0.1.0).

When trying to create a table I get exception:

Reason: liquibase.exception.DatabaseException: ORA-00972: identifier is too long

I googled and found out that prior to version 12.2 the length of the primary key column in Oracle is restricted to 30 characters and UUID (which we use as a primary key) is 36 including hyphens.

After this I tried to execute create statement directly on the DB itself and it worked. I also tried inserting a few entries and all looks nice.

What could be the issue causing Liquibase to complain if we're able to manually create table and insert entries?


Solution

  • The error is:

    ORA-00972: identifier is too long
    

    It is the identifier (i.e. the name of the table, column, constraint or index) that is too long and not the length of the value being stored in the column.

    You need to look at the changeset and the DDL statements that Liquibase is generating for the table and see whether the name of the table, column, constraint or the index backing the primary key constraint are too long and correct that.