Db2 Sql Error Sqlcode=-530 Sqlstate=23503
Contents |
posts / 0 new Log in or register to post comments sqlcode=-551 db2 Last post Tue, 04/30/2013 - 21:02 #1 mindcrime Offline Last db2 sqlcode 803 seen: 3 years 3 months ago Joined: 03/01/2013 - 20:39 Posts: 35 Integrity Constraint
The Insert Or Update Value Of The Foreign Key Is Not Equal To Any Value Of The Parent Key
Violation updating ACT_RU_VARIABLE Hey gang, we're getting the following error using Activiti 5.10. This seems to be happening when we try to update / https://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/codes/src/tpc/n530.html insert variables in a service task, after returning from a web service call. The only real clue I have right now, that might point to the cause, is this stacktrace, and word from the development team that the web-service in question takes a LONG time to return... https://forums.activiti.org/content/integrity-constraint-violation-updating-actruvariable on the order of 3-4 minutes (I know, I know). Any thoughts on what, exactly, would be going on here? ### Error updating database. Cause: com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: The insert or update value of the FOREIGN KEY "ACTDB01_UCB.ACT_RU_VARIABLE.ACT_FK_VAR_PROCINST" is not equal to any value of the parent key of the parent table.. SQLCODE=-530, SQLSTATE=23503, DRIVER=3.64.82 ### The error may involve org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance-Inline ### The error occurred while setting parameters ### SQL: insert into ACT_RU_VARIABLE (ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) values ( ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ### Cause: com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: The insert or update value of the FOREIGN KEY "ACTDB01_UCB.ACT_RU_VARIABLE.ACT_FK_VAR_PROCINST" is not equal to any value of the parent key of the parent table.. SQLCODE=-530, SQLSTATE=23503, DRIVER=3.64.82 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:147) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:134) at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:459) at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:369) at org.activiti.engine.impl.interceptor.CommandContext.flushSes
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn http://stackoverflow.com/questions/19641739/why-do-i-get-sql-state23503-when-i-try-to-add-a-constraint-to-an-existing-table more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why do I get SQL state:23503 when I try db2 sql to add a constraint to an existing table in Postgres? up vote 0 down vote favorite I have table Advisor which is a special Userand contains only id and user_id (for now!) and I'm trying to make user_id a foreign key with the following script: ALTER TABLE advisor ADD CONSTRAINT advisor_user_id_fkey FOREIGN KEY (user_id) REFERENCES "user" (id); Which I think should work, however I get this error: ERROR: db2 sql error insert or update on table "advisor" violates foreign key constraint "advisor_user_id_fkey" SQL state: 23503 Detail: Key (user_id)=(44) is not present in table "user". I thinks this is weird because I'm saying it should refer to user.id and not user.user_id, but obviously I'm doing something wrong. Does anyone have any idea about this? Thanks. update: if anyone is wondering why "user" and not user, well pgAdmin doesn't like user, because it thinks it's the owner of the database. sql postgresql foreign-keys constraints share|improve this question asked Oct 28 '13 at 17:54 Loolooii 2,504104071 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted "user" is a reserved word, that's why pgadmin is having trouble with it. If you have the ability to change that, I recommend it. See reserved words at: http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html. Your error message clearly states that you have an entry in your "advisor" table (44) which does not exist in your "user" table. Your Foreign Key is defined on "advisor" and stipulates that the "user" table is the parent table. Perhaps you have that Foreign Key defined backwards? share|improve this answer answered Oct 28 '13 at 18:00 bma 4,1541216 But I'm saying tha