Subject Problem when creating FK
Author Leonardo Carneiro
Hi everyone,

My software ran some DDL statements during a upgrade, and the creation of
one FK failed:

26.01.2012 10:18:53.703 | 3360 | INFO | TDBConnectionFirebird[0].ExecSQL:
ALTER TABLE EXCESSOS_VELOCIDADE ADD CONSTRAINT
FK_EXCESSOS_VEL_POSICAO_FINAL FOREIGN KEY (POSICAO_ID_FINAL) REFERENCES
POSICOES (COMUNICACAO_ID)
26.01.2012 10:19:17.233 | 3360 | DBERROR |
TDBConnectionFirebird[0].EndTransaction: violation of FOREIGN KEY
constraint "***unknown***" on table "EXCESSOS_VELOCIDADE"
positive numeric value required

I couldn't find any relevant info around this error. Trying to run this
same statement on IBExpert i got a different error message:


/*******************************************************************************
The next statement causes the following error:

violation of FOREIGN KEY constraint "".
violation of FOREIGN KEY constraint "***unknown***" on table
"EXCESSOS_VELOCIDADE".
Foreign key reference target does not exist.
*******************************************************************************/
ALTER TABLE EXCESSOS_VELOCIDADE ADD CONSTRAINT
FK_EXCESSOS_VEL_POSICAO_FINAL FOREIGN KEY (POSICAO_ID_FINAL) REFERENCES
POSICOES (COMUNICACAO_ID)
;

Which is very odd, because the referece target key does exist and is active.

I'm running firebird 2.1.4 on windows. Already done bkp/restore, but the
error persist.

Tks in advance.


[Non-text portions of this message have been removed]