diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2009-01-14 18:50:51 +0400 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2009-01-14 18:50:51 +0400 |
commit | 53e42d9ee48ada71dc151dda0dd5119187cf5b5b (patch) | |
tree | 8d77b6ffe39e395be2fd0fc2fdb7c96964c79480 /mysql-test/r/mysqlcheck.result | |
parent | 45140a8ea3b7a05e0deb94b0586d66eaf6794c7a (diff) | |
download | mariadb-git-53e42d9ee48ada71dc151dda0dd5119187cf5b5b.tar.gz |
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
Problem:
1. trigger code didn't assume a table name may have
a "#mysql50#" prefix, that may lead to a failing ASSERT().
2. "ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME" failed
for databases with "#mysql50#" prefix if any trigger.
3. mysqlcheck --fix-table-name didn't use UTF8 as a default
character set that resulted in (parsing) errors for tables with
non-latin symbols in their names and definitions of triggers.
Fix:
1. properly handle table/database names with "#mysql50#" prefix.
2. handle --default-character-set mysqlcheck option;
if mysqlcheck is launched with --fix-table-name or --fix-db-name
set default character set to UTF8 if no --default-character-set
option given.
Note: if given --fix-table-name or --fix-db-name option,
without --default-character-set mysqlcheck option
default character set is UTF8.
client/mysqlcheck.c:
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
- check and set default charset if --default-character-set option
given.
- set default charset to "utf8" if there's
--fix-table-name or --fix-db-name and no --default-character-set.
mysql-test/r/mysqlcheck.result:
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
- test result.
mysql-test/t/mysqlcheck.test:
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
- test case.
sql/mysql_priv.h:
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
- check_n_cut_mysql50_prefix() introduced.
sql/sql_table.cc:
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
- tablename_to_filename() code split into 2 parts
- check_n_cut_mysql50_prefix() introduced to cut #mysql50# prefixes,
used in the trigger code as well.
sql/sql_trigger.cc:
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
- Table_triggers_list::check_n_load() - checking triggers assume
a table/database name given may have "#mysql50#" prefix in some cases.
- Table_triggers_list::change_table_name_in_triggers() -
create .TRG file in new database directory and delete it in old one,
as they may differ in case of
"ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME"
- Table_triggers_list::change_table_name_in_trignames() - remove stale .TRN
files in #mysql50#dbname directory in case of database upgrade
- Table_triggers_list::change_table_name() - allow changing trigger's
database in case of its upgrading
sql/sql_trigger.h:
Fix for
bug#33094: Error in upgrading from 5.0 to 5.1 when table contains
triggers
and
#41385: Crash when attempting to repair a #mysql50# upgraded table
with triggers.
- new old_db_name parameter added in
Table_triggers_list::change_table_name_in_trignames() and
Table_triggers_list::change_table_name_in_triggers()
Diffstat (limited to 'mysql-test/r/mysqlcheck.result')
-rw-r--r-- | mysql-test/r/mysqlcheck.result | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index e222d66c5b6..313cba51ec9 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -130,3 +130,58 @@ v1 v-1 drop view v1, `v-1`; drop table t1; +SET NAMES utf8; +CREATE TABLE `#mysql50#@` (a INT); +SHOW TABLES; +Tables_in_test +#mysql50#@ +SET NAMES DEFAULT; +mysqlcheck --fix-table-names --databases test +SET NAMES utf8; +SHOW TABLES; +Tables_in_test +@ +DROP TABLE `@`; +CREATE TABLE `я` (a INT); +SET NAMES DEFAULT; +mysqlcheck --default-character-set="latin1" --databases test +test.? +Error : Table 'test.?' doesn't exist +error : Corrupt +mysqlcheck --default-character-set="utf8" --databases test +test.я OK +SET NAMES utf8; +DROP TABLE `я`; +SET NAMES DEFAULT; +CREATE DATABASE `#mysql50#a@b`; +USE `#mysql50#a@b`; +CREATE TABLE `#mysql50#c@d` (a INT); +CREATE TABLE t1 (a INT); +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS +WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL #mysql50#a@b tr1 INSERT NULL #mysql50#a@b #mysql50#c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +NULL #mysql50#a@b tr2 INSERT NULL #mysql50#a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +Warnings: +Warning 1603 Triggers for table `#mysql50#a@b`.`#mysql50#c@d` have no creation context +Warning 1603 Triggers for table `#mysql50#a@b`.`t1` have no creation context +mysqlcheck --fix-db-names --fix-table-names --all-databases +USE `a@b`; +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS +WHERE TRIGGER_SCHEMA="a@b" ORDER BY trigger_name; +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL a@b tr1 INSERT NULL a@b c@d 0 NULL SET NEW.a = 10 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci +NULL a@b tr2 INSERT NULL a@b t1 0 NULL SET NEW.a = 100 * NEW.a ROW BEFORE NULL NULL OLD NEW NULL root@localhost utf8 utf8_general_ci latin1_swedish_ci +INSERT INTO `c@d` VALUES (2), (1); +SELECT * FROM `c@d`; +a +20 +10 +INSERT INTO t1 VALUES (3), (5); +SELECT * FROM t1; +a +300 +500 +DROP DATABASE `a@b`; +USE test; +End of 5.1 tests |