Subject | Re: [firebird-support] Key violation on Primary/Unique key constraint INTEG_55/30 on table(s) |
---|---|
Author | Helen Borrie |
Post date | 2006-03-13T06:46:52Z |
At 04:49 PM 13/03/2006, you wrote:
when you create objects in your database. For example, PRIMARY KEY,
FOREIGN KEY and UNIQUE and NOT NULL are all constraints.
INTEG_30 is the name of some constraint. You can examine the system
table named RDB$RELATION_CONSTRAINTS to find out which table and
columns this constraint applies to.
You will get an exception when something attempts to violate a constraint.
involved. If (as your Subject suggests) you are getting a violation
of a primary or unique key constraint then the possibilities are:
1. that you already have a row in the person table that has the same
primary key
or
2. that you have a UNIQUE constraint on some other column, e.g. a
person's name (which is *not* a wise idea!!)
or
3. a NULL is being passed to something that is constrained as unique
doing....what table the procedure acts upon....but the person who
wrote this has made a mistake if he thought this would generate a key
value for a newly inserted record in PEOPLE. An AFTER INSERT trigger
cannot assign any values to the NEW.* context variables.
So, this is probably the source of the key violation errors. Show us
the content of this trigger.
./heLen
>Hi AllA constraint is a set of rules that you define for a data structure
>
>I have an appication that has a database of various People( Primary Key ID)
>and Samplewords from speech (with the Transcript, Utterance_Number, and
>UtteranceWord_Number as Primary Key).
>
>There are 4 types of people (Parent, Client, Guardian, Professional, and a
>general ALL category). When I try to insert a new entry to the People Table
>using the GUI (having selected one of the People types using the
>radiobuttons), I get the Key constraint INTEG_30.
when you create objects in your database. For example, PRIMARY KEY,
FOREIGN KEY and UNIQUE and NOT NULL are all constraints.
INTEG_30 is the name of some constraint. You can examine the system
table named RDB$RELATION_CONSTRAINTS to find out which table and
columns this constraint applies to.
You will get an exception when something attempts to violate a constraint.
>Sometimes the error doesThe problem will become apparent when you look at the constraints
>not repeat itself and the 'Add new Person' form comes up showing the
>selected option for Person type, however, other times the error comes up,
>and no 'Person Type' is selected.
involved. If (as your Subject suggests) you are getting a violation
of a primary or unique key constraint then the possibilities are:
1. that you already have a row in the person table that has the same
primary key
or
2. that you have a UNIQUE constraint on some other column, e.g. a
person's name (which is *not* a wise idea!!)
or
3. a NULL is being passed to something that is constrained as unique
>The INTEG_55 error occurs when I attempt to insert a second transcript intoINTEG_55 is the name of a different constraint.
>the SampleWords table.
>There is a trigger for the addition of a new Person to the People Table asYou don't tell us what the procedure NewPerson(NEW.ID) is
>folows:
>
>CREATE TRIGGER NEWPERSONTRIGGER FOR PEOPLE
>ACTIVE AFTER INSERT POSITION 0
>AS BEGIN
> EXECUTE PROCEDURE NewPerson(NEW.ID);
> END ^
doing....what table the procedure acts upon....but the person who
wrote this has made a mistake if he thought this would generate a key
value for a newly inserted record in PEOPLE. An AFTER INSERT trigger
cannot assign any values to the NEW.* context variables.
So, this is probably the source of the key violation errors. Show us
the content of this trigger.
>I don't know what the errors are referring to exactly, but I guess theThat sounds far too complicated.
>software may not be selecting the correct radio button option for Person,
>and so creating an error with an ambiguous type that does not fit the table
>definition.
./heLen