On Tue, 2004-10-19 at 14:04, Keith Worthington wrote:
> I am trying to build a foreign key constraint. The objective is to prevent
> parts from being entered that do not have a valid sales account. When I try
> to build the constraint it fails telling me that there is a violation. I have
> looked at the data and just can't seem to find the problem. Is there a way to
> find the data that is causing the problem? I tried deleting all the data and
> building the constraint. That of course works but then I am unable to load
> the data and I have no better idea of where the problem is located.
You need to show the definitions for the tables involved, how you are
inserting your data and the exact text of error messages. Your
description is far too general for us to help you much.
If you add a constraint after the table is created, the existing data
must satisfy the constraint.
If you add the data after the constraint, it clearly must be added in
the correct order; the sales account data would need to be inserted
first. When you load the dependant table's data, PostgreSQL ought to
tell you which data it is objecting to.
--
Oliver Elphick olly@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"Commit thy way unto the LORD; trust also in him and
he shall bring it to pass." Psalms 37:5