8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 00:03:03 +01:00

Fixed CORE-945 - Bad error message when trying to create FK to non-existent table

This commit is contained in:
asfernandes 2006-09-30 16:17:24 +00:00
parent 1f6c1a942d
commit 597cd7844c
3 changed files with 23 additions and 3 deletions

View File

@ -2314,8 +2314,27 @@ void DYN_define_index(Global* gbl,
}
}
else {
DYN_error_punt(false, 18, NULL, NULL, NULL, NULL, NULL);
// msg 18: "could not find UNIQUE or PRIMARY KEY constraint with specified fields"
jrd_req* request2 = NULL;
found = false;
FOR(REQUEST_HANDLE request2 TRANSACTION_HANDLE gbl->gbl_transaction)
X IN RDB$RELATIONS
WITH X.RDB$RELATION_NAME EQ referenced_relation.c_str()
found = true;
END_FOR
CMP_release(tdbb, request2);
if (found)
{
DYN_error_punt(false, 18, NULL, NULL, NULL, NULL, NULL);
// msg 18: "could not find UNIQUE or PRIMARY KEY constraint with specified fields"
}
else
{
DYN_error_punt(false, 241, referenced_relation.c_str(), NULL, NULL, NULL, NULL);
// msg 241: "Table %s not found"
}
}
}
else if (referenced_relation.length()) {

View File

@ -9,7 +9,7 @@ INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('19
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('1996-11-07 13:39:40', 'GRST', 6, 1);
*/
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('2005-09-02 13:09:00', 'DSQL', 7, 30);
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('2006-09-05 04:53:01', 'DYN', 8, 241);
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('2006-09-30 13:25:01', 'DYN', 8, 242);
/*
INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES ('1996-11-07 13:39:40', 'FRED', 9, 1);
*/

View File

@ -3075,5 +3075,6 @@ INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FL
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('array_max_dimensions', 'scalar', 'evl.cpp', NULL, 0, 553, NULL, 'Array data type can use up to %d dimensions', NULL, NULL);
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('dsql_only_can_subscript_array', 'MAKE_field', 'make.cpp', NULL, 13, 926, NULL, 'scalar operator used on field %s which is not an array', NULL, NULL);
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('dsql_max_sort_items', 'pass1_sort', 'pass1.cpp', NULL, 13, 927, NULL, 'cannot sort on more than 255 items', NULL, NULL);
INSERT INTO MESSAGES (SYMBOL, ROUTINE, MODULE, TRANS_NOTES, FAC_CODE, NUMBER, FLAGS, TEXT, "ACTION", EXPLANATION) VALUES ('', '', 'dyn_def.epp', NULL, 8, 241, NULL, 'Table %s not found', NULL, NULL);
COMMIT WORK;