List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:October 19 2005 2:58pm
Subject:Re: Checking Multiplicity Constraints and Retrieving Details from Error Messages
View as plain text  


> As part of my 4th Year Group Design Project, I am required to build a
> database system that will validate and then store the data. As such I
> am currently investigating different DB, to choose the most suitable
> one. I like many features of MySQL but there are a couple of things I
> am not very clear about that I would need for the project.
>
> First of all, is there any way of limiting the number of rows in a
> table, referencing to the same element of another table? For example,
> force a manager not to have more than 10 employees under his control.
> In a way this can be seen as checking the multiplicity of the
> relation between the two tables. I know one way would be using
> triggers, but I was wondering if there was a way of specifying this
> when the table is constructed.

The way to do this would be via CHECK constraints, but MySQL
doesn't support them.

> Second, is there any way of getting more details out of an error
> message? So for example, when doing a bulk upload to the database,
> rather than just getting "Cannot add or update a child row: a foreign
> key constraint fails" I would like to know which particular insert
> statement (out of the 1000 I have) caused the problem, or which field
> in this statement broke the constraint.

Check for "innodb status" in the documentation.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Thread
Checking Multiplicity Constraints and Retrieving Details from Error MessagesLedina Hido19 Oct
  • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesMartijn Tonies19 Oct
    • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesLedina Hido19 Oct
    • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesJochem van Dieten19 Oct
  • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesMartijn Tonies19 Oct
    • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesJochem van Dieten19 Oct
      • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesLedina Hido19 Oct
  • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesMartijn Tonies20 Oct
    • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesJochem van Dieten20 Oct
  • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesMartijn Tonies20 Oct
  • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesHarald Fuchs20 Oct
    • Re: Checking Multiplicity Constraints and Retrieving Details from Error MessagesJochem van Dieten20 Oct