英文:
Oracle 12.1 primary key length
问题
我们正在使用Liquibase并尝试在Oracle 12c发布版(12.1.0.1.0)中创建表格。
尝试创建表格时出现异常:
原因:liquibase.exception.DatabaseException: ORA-00972: 标识符过长
我搜索了一下,发现在版本12.2之前,Oracle中主键列的长度限制为30个字符,而UUID(我们用作主键)是36个字符,包括连字符。
之后,我尝试直接在数据库上执行创建语句,它成功了。我还尝试插入了一些条目,一切都看起来很正常。
如果我们能够手动创建表格和插入记录,那么导致Liquibase抱怨的问题可能是什么?
英文:
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?
答案1
得分: 2
错误信息是:
ORA-00972: 标识符太长
出错的是标识符(即表格、列、约束或索引的名称),而不是存储在列中的值的长度。
您需要查看变更集以及Liquibase为表格生成的DDL语句,看看表格、列、约束或支持主键约束的索引的名称是否太长,并进行修正。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论