Error Code 23503
Contents |
a foreign key of
Sql Error: -530, Sqlstate: 23503
the object table; however, this value was not equal to some db2 sql error: sqlcode=-531, sqlstate=23504 value of the parent key of the parent table. When a row is inserted into a dependent table,
Sqlcode=-551 Db2
the insert value of a foreign key must be equal to the value of the parent key of some row of the parent table in the associated relationship. When the value of the foreign key the insert or update value of the foreign key is not equal to any value of the parent key is updated, the update value of a foreign key must be equal to the value of the parent key of some row of the parent table of the associated relationship. System action: The UPDATE or INSERT statement cannot be executed. The object table is unchanged. Programmer response: Examine the insert or update value of the foreign key first, and then compare it with each of the parent key values of the parent table to determine the cause of the problem. <- BACK TO INDEX This is a free Service. I assume no warranty for misprints, and for the correctness and completeness of information and entries.
Nonexistent foreign key value detected in sqlstate: 23502 FK-PK join [string]; value [string] Note: The myVertica portal's Solutions tab http://www.sqlerror.de/db2_sql_error_-530_sqlstate_23503.html contains helpful troubleshooting information that may help you resolve these errors. Was this topic helpful?YesNoThank you for your feedback!Thank you for your feedback! How https://my.vertica.com/docs/7.1.x/HTML/Content/Authoring/ErrorCodes/SqlState-23503.htm can we improve this topic?Thanks! Your feedback helps to improve this topic for everyone. © 2006 - 2015Hewlett-Packard Development Company, L.P. Send documentation feedback to HP Close We welcome your comments! To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to vertica-docfeedback@hp.com. Help Topic ID: Product: Topic Title: Feedback:
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 more about Stack Overflow the company Business 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 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, http://www.dsxchange.com/viewtopic.php?t=97677 helping each other. Join them; it only takes a minute: Sign up Why do I get SQL state:23503 when I try to add a constraint to an existing table in Postgres? up vote 0 down vote favorite I sql error: 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: 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 db2 sql error: 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,519104071 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,1641216 But I'm saying that advisor.user_id should refer to user.id right? That's what the script is saying as far as I know?! I understand the error, I just don't understand why and you are basically telling me what I already understand :) –Loolooii Oct 28 '13 at 18:03 And about "user", thanks.
No error codes being returned from DB2 View next topic View previous topic Add To Favorites This topic has been marked "Resolved." This topic is not resolved, but there is a WORKAROUND. Post new topic Reply to topic DSXchange Forum Index » IBM® DataStage Enterprise Edition (Formerly Parallel Extender/PX) Author Message asorrell Site Admin Group memberships:Premium Members, DSXchange Team, Inner Circle, Server to Parallel Transition Group Joined: 04 Apr 2003 Posts: 1542 Location: Colleyville, Texas Points: 20791 Posted: Tue Jan 10, 2006 1:48 am Reply with quote Back to top DataStage Release: 7x Job Type: Server OS: Unix This is a problem with some Server jobs that are created on the EE version of DataStage (version 7.5.1.a) with DB2 8.2.2 on AIX. What is happening is that we aren't getting any reject rows from the DB2 table inserts on AIX. We've also checked all of the error codes and they are coming back zero or blank. A quick check of the Ascential eServices knowledgebase informed me that this is a "known issue" - and at this point no workaround or fix is posted. Has anyone encountered this before and figured out a workaround? _________________ Andy Sorrell Certified DataStage Consultant IBM Analytics Champion 2009 - 2016 View user's profile Send private message ArndW Participant Group memberships:Premium Members, Inner Circle, Australia Usergroup Joined: 16 Nov 2004 Posts: 16257 Location: Germany Points: 92174 Posted: Tue Jan 10, 2006 2:02 am Reply with quote Back to top Andy, are you using the reject link functionality with an error link coming out of the DB/2 stage in your job? Also, what is triggering the rejects - just one error code/reason or several? I know ... What's this? _________________ View user's profile Send private message Send e-mail Visit poster's website Rate this response: 0 1 2 3 4 5 Not yet rated ray.wurlod Participant Group memberships:Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group Joined: 23 Oct 2002 Posts: 53692 Location: Sydney, Australia Points: 291371 Posted: Tue Jan 10, 2006 2:59 am Reply with quote Back to top Would you be prepared to try using an Enterprise ODBC stage, just to determine whether the symptom is database related or client software related? _________________RXP Services Ltd Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane currently hiring: Canberra, Sydney and Melbourne View user's profile Send private message Send e-mail Visit poster's website Rate this response