postgres ERROR: insert or update on table "xxxxx" violates foreign key

I found the following message within syslog.

< message >
postgres ERROR: insert or update on table "xxxxx" violates foreign key


I am not developer but manage server.

Would you please tell me the meaning and the solution.
chunziAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
ChristoferDutzCommented:
You are propably inserting a record into a table with foreign key constraints where one of the foreign key vlaues is not a valid key in the related table. Try adding the related record first and adding the data you want to insert after this.
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
segurahCommented:
A foreign key is a data that must exist in a table 'B'  in order to insert or update data on a table 'A' because table 'A' references to this field in table 'B' and a constraint says "do not permint insert or update values in field 'X' of table 'A' while this value is not present in table 'B' "

Happens that you have any value in a specific field of table 'A' that is not present in table 'B', then the constraint reject this transacion a logs to syslog.

Are you batch importing or updating data?
0
 
chunziAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.