1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

dict0dict.c:

Remove redundant code; parse both the database name and the table name in a FOREIGN KEY constraint with quotes in mind
row0mysql.c, ha_innodb.cc, sql_table.cc:
  Return error message Cannot delete or update a parent row... if we try to drop a table which is referenced by a FOREIGN KEY constraint, and the user has not set foreign_key_checks=0


sql/sql_table.cc:
  Return error message Cannot delete or update a parent row... if we try to drop a table which is referenced by a FOREIGN KEY constraint, and the user has not set foreign_key_checks=0
sql/ha_innodb.cc:
  Return error message Cannot delete or update a parent row... if we try to drop a table which is referenced by a FOREIGN KEY constraint, and the user has not set foreign_key_checks=0
innobase/row/row0mysql.c:
  Return error message Cannot delete or update a parent row... if we try to drop a table which is referenced by a FOREIGN KEY constraint, and the user has not set foreign_key_checks=0
innobase/dict/dict0dict.c:
  Remove redundant code; parse both the database name and the table name in a FOREIGN KEY constraint with quotes in mind
This commit is contained in:
unknown
2004-02-02 00:10:45 +02:00
parent 7eefcb75db
commit 08177508f5
4 changed files with 178 additions and 177 deletions

View File

@ -1804,6 +1804,7 @@ row_drop_table_for_mysql(
char* name, /* in: table name */
trx_t* trx) /* in: transaction handle */
{
dict_foreign_t* foreign;
dict_table_t* table;
que_thr_t* thr;
que_t* graph;
@ -1996,6 +1997,31 @@ row_drop_table_for_mysql(
goto funct_exit;
}
foreign = UT_LIST_GET_FIRST(table->referenced_list);
if (foreign && trx->check_foreigns) {
char* buf = dict_foreign_err_buf;
/* We only allow dropping a referenced table if
FOREIGN_KEY_CHECKS is set to 0 */
err = DB_CANNOT_DROP_CONSTRAINT;
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(buf);
sprintf(buf + strlen(buf),
" Cannot drop table %.500s\n", name);
sprintf(buf + strlen(buf),
"because it is referenced by %.500s\n", foreign->foreign_table_name);
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex);
goto funct_exit;
}
if (table->n_mysql_handles_opened > 0) {
ut_print_timestamp(stderr);