diff options
author | Karthik Kamath <karthik.kamath@oracle.com> | 2017-12-05 19:49:59 +0530 |
---|---|---|
committer | Karthik Kamath <karthik.kamath@oracle.com> | 2017-12-05 19:49:59 +0530 |
commit | 9e1035c64f2db233995082397921f553810bdfbc (patch) | |
tree | 1ed66ef6d8247b0de2ca7ea98326742b66d2f55d /sql/table.cc | |
parent | ecc5a07874d44307b835ff5dbd091343961fbc93 (diff) | |
download | mariadb-git-9e1035c64f2db233995082397921f553810bdfbc.tar.gz |
BUG#26881798: SERVER EXITS WHEN PRIMARY KEY IN MYSQL.PROC
IS DROPPED
ANALYSIS:
=========
It is advised not to tamper with the system tables.
When primary key is dropped from a system table, certain
operations on the table which tries to access the table key
information may lead to server exit.
FIX:
====
An appropriate error is now reported in such a case.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/table.cc b/sql/table.cc index 5bc3ccdbf39..46397b794ee 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3013,7 +3013,7 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def) /* Whether the table definition has already been validated. */ if (table->s->table_field_def_cache == table_def) - DBUG_RETURN(FALSE); + goto end; if (table->s->fields != table_def->count) { @@ -3129,6 +3129,18 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def) if (! error) table->s->table_field_def_cache= table_def; +end: + + if (has_keys && !error && !table->key_info) + { + my_printf_error(ER_UNKNOWN_ERROR, + "The table '%s.%s' does not have the necessary key(s) " + "defined on it. Please check the table definition and " + "create index(s) accordingly.", MYF(0), + table->s->db.str, table->s->table_name.str); + error= TRUE; + } + DBUG_RETURN(error); } |