From 6f83de163b311f05aa95c5d79879425fa1326535 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 18:52:19 +0200 Subject: [PATCH 01/10] Dmitri please review. Fix for BUG#10417 "CREATE TRIGGER not written to binlog": writing DROP and CREATE TRIGGER to binlog, disabling binlogging of substatements, testing. mysql-test/r/rpl_sp.result: result update mysql-test/t/rpl_sp.test: removing useless lines, plus testing replication of triggers sql/sql_trigger.cc: trigger can be used to destroy slave, so only SUPER can create it by default. If create|drop goes ok, binlog CREATE TRIGGER and DROP TRIGGER. sql/sql_trigger.h: disable binlogging of substatements of triggers (even if now triggers can't do updates) --- mysql-test/r/rpl_sp.result | 35 +++++++++++++++++++++++++++++------ mysql-test/t/rpl_sp.test | 36 ++++++++++++++++++++++++++++++++++-- sql/sql_trigger.cc | 26 +++++++++++++++++++++++++- sql/sql_trigger.h | 8 ++++++++ 4 files changed, 96 insertions(+), 9 deletions(-) diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index 6e5fccfe4e2..7b3249d553a 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -158,9 +158,6 @@ a select * from t2; a 3 -select if(compte<>3,"this is broken but documented","this unexpectedly works?") from (select count(*) as compte from t2) as aggreg; -if(compte<>3,"this is broken but documented","this unexpectedly works?") -this is broken but documented select * from mysql.proc where name="foo4" and db='mysqltest1'; db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES INVOKER begin @@ -197,9 +194,6 @@ a select * from t1; a 21 -select if(compte<>1,"this is broken but documented","this unexpectedly works?") from (select count(*) as compte from t1 where a=20) as aggreg; -if(compte<>1,"this is broken but documented","this unexpectedly works?") -this is broken but documented select * from t2; a 23 @@ -230,6 +224,35 @@ db name type specific_name language sql_data_access is_deterministic security_ty mysqltest1 fn1 FUNCTION fn1 SQL CONTAINS_SQL YES DEFINER int(11) begin return unix_timestamp(); end @ # # +create trigger trg before insert on t1 for each row set new.a= 10; +ERROR 42000: Access denied; you need the SUPER privilege for this operation +flush logs; +delete from t1; +create trigger trg before insert on t1 for each row set new.a= 10; +insert into t1 values (1); +select * from t1; +a +10 +select * from t1; +a +10 +delete from t1; +drop trigger t1.trg; +insert into t1 values (1); +select * from t1; +a +1 +show binlog events in 'master-bin.000002' from 98; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000002 # Query 1 # use `mysqltest1`; create trigger trg before insert on t1 for each row set new.a= 10 +master-bin.000002 # Query 1 # use `mysqltest1`; insert into t1 values (1) +master-bin.000002 # Query 1 # use `mysqltest1`; delete from t1 +master-bin.000002 # Query 1 # use `mysqltest1`; drop trigger t1.trg +master-bin.000002 # Query 1 # use `mysqltest1`; insert into t1 values (1) +select * from t1; +a +1 drop function fn1; drop database mysqltest1; drop user "zedjzlcsjhd"@127.0.0.1; diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index b8dc381630b..e2a8982ebaa 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -157,7 +157,6 @@ select * from t2; sync_slave_with_master; select * from t1; select * from t2; -select if(compte<>3,"this is broken but documented","this unexpectedly works?") from (select count(*) as compte from t2) as aggreg; # Test of DROP PROCEDURE @@ -194,7 +193,6 @@ select * from t1; select * from t2; sync_slave_with_master; select * from t1; -select if(compte<>1,"this is broken but documented","this unexpectedly works?") from (select count(*) as compte from t1 where a=20) as aggreg; select * from t2; connection master; @@ -225,6 +223,40 @@ select * from t1; --replace_column 13 # 14 # select * from mysql.proc where db='mysqltest1'; +# And now triggers + +connection con1; +--error 1227; +create trigger trg before insert on t1 for each row set new.a= 10; + +connection master; +# fn1() above uses timestamps, so in !ps-protocol, the timezone will be +# binlogged, but in --ps-protocol it will not be (BUG#9359) so +# the binlog offsets get shifted which spoils SHOW BINLOG EVENTS. +# To be immune, we take a new binlog. +flush logs; +delete from t1; +# TODO: when triggers can contain an update, test that this update +# does not go into binlog. +# I'm not setting user vars in the trigger, because replication of user vars +# would take care of propagating the user var's value to slave, so even if +# the trigger was not executed on slave it would not be discovered. +create trigger trg before insert on t1 for each row set new.a= 10; +insert into t1 values (1); +select * from t1; +sync_slave_with_master; +select * from t1; + +connection master; +delete from t1; +drop trigger t1.trg; +insert into t1 values (1); +select * from t1; +--replace_column 2 # 5 # +show binlog events in 'master-bin.000002' from 98; +sync_slave_with_master; +select * from t1; + # Clean up connection master; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 5b6f12eab52..ebf46a34896 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -98,6 +98,21 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) if (wait_if_global_read_lock(thd, 0, 0)) DBUG_RETURN(TRUE); + /* + There is no DETERMINISTIC clause for triggers, so can't check it. + But a trigger can in theory be used to do nasty things (if it supported + DROP for example) so we do the check for privileges. For now there is + already a stronger test above (see start of the function); but when this + stronger test will be removed, the test below will hold. + */ + if (!trust_routine_creators && mysql_bin_log.is_open() && + !(thd->master_access & SUPER_ACL)) + { + my_message(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER, + ER(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER), MYF(0)); + DBUG_RETURN(TRUE); + } + VOID(pthread_mutex_lock(&LOCK_open)); result= (create ? table->triggers->create_trigger(thd, tables): @@ -109,7 +124,16 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) start_waiting_global_read_lock(thd); if (!result) - send_ok(thd); + { + if (mysql_bin_log.is_open()) + { + thd->clear_error(); + /* Such a statement can always go directly to binlog, no trans cache */ + Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE); + mysql_bin_log.write(&qinfo); + } + send_ok(thd); + } DBUG_RETURN(result); } diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 7dd6734eb89..26cfb114cde 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -52,7 +52,15 @@ public: FIXME: We should juggle with security context here (because trigger should be invoked with creator rights). */ + /* + Guilhem puts code to disable binlogging, as in SP/functions, even + though currently triggers can't do updates. When triggers can do + updates, someone should add such a trigger to rpl_sp.test to verify + that the update does NOT go into binlog. + */ + tmp_disable_binlog(thd); res= bodies[event][time_type]->execute_function(thd, 0, 0, 0); + reenable_binlog(thd); #ifndef EMBEDDED_LIBRARY thd->net.no_send_ok= nsok; From bf049c3167b41275c878fe2e66476f4b2e476b53 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 May 2005 19:06:10 +0000 Subject: [PATCH 02/10] Fix for bug #10018:use INFORMATION_SCHEMA works, but show tables in it returns error --- mysql-test/r/information_schema_db.result | 28 ++++++++++ mysql-test/t/information_schema_db.test | 9 +++ sql/sql_show.cc | 68 +++++++++++++++-------- 3 files changed, 83 insertions(+), 22 deletions(-) create mode 100644 mysql-test/r/information_schema_db.result create mode 100644 mysql-test/t/information_schema_db.test diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result new file mode 100644 index 00000000000..0ccb22be22a --- /dev/null +++ b/mysql-test/r/information_schema_db.result @@ -0,0 +1,28 @@ +use INFORMATION_SCHEMA; +show tables; +Tables_in_INFORMATION_SCHEMA +SCHEMATA +TABLES +COLUMNS +CHARACTER_SETS +COLLATIONS +COLLATION_CHARACTER_SET_APPLICABILITY +ROUTINES +STATISTICS +VIEWS +USER_PRIVILEGES +SCHEMA_PRIVILEGES +TABLE_PRIVILEGES +COLUMN_PRIVILEGES +TABLE_CONSTRAINTS +KEY_COLUMN_USAGE +show tables from INFORMATION_SCHEMA like 'T%'; +Tables_in_INFORMATION_SCHEMA (T%) +TABLES +TABLE_PRIVILEGES +TABLE_CONSTRAINTS +create database `inf%`; +use `inf%`; +show tables; +Tables_in_inf% +drop database `inf%`; diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test new file mode 100644 index 00000000000..f88d04c2783 --- /dev/null +++ b/mysql-test/t/information_schema_db.test @@ -0,0 +1,9 @@ +-- source include/testdb_only.inc + +use INFORMATION_SCHEMA; +show tables; +show tables from INFORMATION_SCHEMA like 'T%'; +create database `inf%`; +use `inf%`; +show tables; +drop database `inf%`; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index cf0050a774b..fe3a2590817 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1777,32 +1777,64 @@ enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table) /* - Add 'information_schema' name to db_names list + Create db names list. Information schema name always is first in list SYNOPSIS - schema_db_add() + make_db_list() thd thread handler files list of db names wild wild string + idx_field_vals idx_field_vals->db_name contains db name or + wild string with_i_schema returns 1 if we added 'IS' name to list otherwise returns 0 + is_wild_value if value is 1 then idx_field_vals->db_name is + wild string otherwise it's db name; RETURN 1 error 0 success */ -int schema_db_add(THD *thd, List *files, - const char *wild, bool *with_i_schema) +int make_db_list(THD *thd, List *files, + INDEX_FIELD_VALUES *idx_field_vals, + bool *with_i_schema, bool is_wild_value) { + LEX *lex= thd->lex; *with_i_schema= 0; - if (!wild || !wild_compare(information_schema_name.str, wild, 0)) + get_index_field_values(lex, idx_field_vals); + if (is_wild_value) { - *with_i_schema= 1; - if (files->push_back(thd->strdup(information_schema_name.str))) - return 1; + if (!idx_field_vals->db_value || + !wild_case_compare(system_charset_info, + information_schema_name.str, + idx_field_vals->db_value)) + { + *with_i_schema= 1; + if (files->push_back(thd->strdup(information_schema_name.str))) + return 1; + } + return mysql_find_files(thd, files, NullS, mysql_data_home, + idx_field_vals->db_value, 1); } - return 0; + + if (lex->orig_sql_command != SQLCOM_END) + { + if (!idx_field_vals->db_value || + !my_strcasecmp(system_charset_info, + information_schema_name.str, + idx_field_vals->db_value)) + { + *with_i_schema= 1; + return files->push_back(thd->strdup(information_schema_name.str)); + } + return files->push_back(thd->strdup(idx_field_vals->db_value)); + } + + if (files->push_back(thd->strdup(information_schema_name.str))) + return 1; + *with_i_schema= 1; + return mysql_find_files(thd, files, NullS, mysql_data_home, NullS, 1); } @@ -1880,14 +1912,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) if (schema_table_idx == SCH_TABLES) lock_type= TL_READ; - get_index_field_values(lex, &idx_field_vals); - /* information schema name always is first in list */ - if (schema_db_add(thd, &bases, idx_field_vals.db_value, &with_i_schema)) - goto err; - - if (mysql_find_files(thd, &bases, NullS, mysql_data_home, - idx_field_vals.db_value, 1)) + if (make_db_list(thd, &bases, &idx_field_vals, + &with_i_schema, 0)) goto err; partial_cond= make_cond_for_info_schema(cond, tables); @@ -2022,13 +2049,10 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond) TABLE *table= tables->table; DBUG_ENTER("fill_schema_shemata"); - get_index_field_values(thd->lex, &idx_field_vals); - /* information schema name always is first in list */ - if (schema_db_add(thd, &files, idx_field_vals.db_value, &with_i_schema)) - DBUG_RETURN(1); - if (mysql_find_files(thd, &files, NullS, mysql_data_home, - idx_field_vals.db_value, 1)) + if (make_db_list(thd, &files, &idx_field_vals, + &with_i_schema, 1)) DBUG_RETURN(1); + List_iterator_fast it(files); while ((file_name=it++)) { From 203b8d6aa2d3340a204ed1ffbc141422dda08dee Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 May 2005 18:37:59 +0200 Subject: [PATCH 03/10] merge --- ndb/test/run-test/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/ndb/test/run-test/Makefile.am b/ndb/test/run-test/Makefile.am index dfd0a8b2b0a..60d64a7697f 100644 --- a/ndb/test/run-test/Makefile.am +++ b/ndb/test/run-test/Makefile.am @@ -6,7 +6,6 @@ include $(top_srcdir)/ndb/config/type_util.mk.am include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am test_PROGRAMS = atrt -test_DATA=daily-basic-tests.txt daily-devel-tests.txt test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt \ conf-daily-basic-ndbmaster.txt \ conf-daily-basic-shark.txt \ From 818e3ef30ab94f23bc8dce665ba347d777a3b45b Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 May 2005 14:59:49 +0200 Subject: [PATCH 04/10] bug#10471 - ndb - potential inconsistent backup whith some multi update scenarios Make sure to init GCI on correct operation before firering operation ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp: Init gci, to make sure that fire_trig_ord gets correct GCI --- ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp b/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp index cbd56c3281f..470b98fd04c 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp @@ -443,6 +443,7 @@ Dbtup::commitRecord(Signal* signal, saveAttributeMask.bitOR(befOpPtr.p->changeMask); befOpPtr.p->changeMask.clear(); befOpPtr.p->changeMask.bitOR(attributeMask); + befOpPtr.p->gci = regOperPtr->gci; operPtr.p = befOpPtr.p; checkDetachedTriggers(signal, @@ -480,6 +481,7 @@ Dbtup::commitRecord(Signal* signal, befOpPtr.p->pageOffset = befOpPtr.p->pageOffsetC; befOpPtr.p->fragPageId = befOpPtr.p->fragPageIdC; befOpPtr.p->pageIndex = befOpPtr.p->pageIndexC; + befOpPtr.p->gci = regOperPtr->gci; operPtr.p = befOpPtr.p; checkDetachedTriggers(signal, From d03e4637b6e94d189313200830179f1cab1e94cf Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 May 2005 21:59:03 +0200 Subject: [PATCH 05/10] Add compiler settings for Pentium M BUILD/check-cpu: Pentium M --- BUILD/check-cpu | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BUILD/check-cpu b/BUILD/check-cpu index dfdf96d6b29..3cce4b1ab3d 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -55,6 +55,9 @@ case "$cpu_family--$model_name" in *Pentium*III*CPU*) cpu_flag="pentium3"; ;; + *Pentium*M*pro*) + cpu_flag="pentium-m"; + ;; *Athlon*64*) cpu_flag="athlon64"; cpu_flag_old="athlon"; From 4a1b6c010212c2b29ecd509b030d457bfdd17603 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 00:40:41 +0200 Subject: [PATCH 06/10] Fix for BUG#10070: Make the test not to produce warnings if InnoDB is not available --- mysql-test/t/range.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 3d3d4748fe3..b51a79fba77 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -448,6 +448,7 @@ explain select * from t1 where a='aaa' collate latin1_german1_ci; drop table t1; # Test for BUG#9348 "result for WHERE A AND (B OR C) differs from WHERE a AND (C OR B)" +--disable_warnings CREATE TABLE t1 ( `CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000', `ARG1` char(3) character set latin1 collate latin1_bin NOT NULL default '', @@ -456,6 +457,7 @@ CREATE TABLE t1 ( `FUNCTINT` int(11) NOT NULL default '0', KEY `VERI_CLNT~2` (`ARG1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; +--enable_warnings INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0), ('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0), From 6037cd1775552b505536110eea71c9b7f7614447 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 09:25:25 +0300 Subject: [PATCH 07/10] Fixed Bug#10232: update with subquery, precision math, another column gets rotten value. mysql-test/r/type_newdecimal.result: Added a test case for Bug#10232: update with subquery, precision math, another column gets rotten value. mysql-test/t/type_newdecimal.test: Added a test case for Bug#10232: update with subquery, precision math, another column gets rotten value. --- mysql-test/r/type_newdecimal.result | 13 +++++++++++++ mysql-test/t/type_newdecimal.test | 14 ++++++++++++++ strings/decimal.c | 9 ++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 86c905b83a2..35bd8d73675 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -863,3 +863,16 @@ select 0.190287977636363637 + 0.040372670 * 0 - 0; select -0.123 * 0; -0.123 * 0 0.000 +CREATE TABLE t1 (f1 DECIMAL (12,9), f2 DECIMAL(2,2)); +INSERT INTO t1 VALUES (10.5, 0); +UPDATE t1 SET f1 = 4.5; +SELECT * FROM t1; +f1 f2 +4.500000000 0.00 +DROP TABLE t1; +CREATE TABLE t1 (f1 DECIMAL (64,20), f2 DECIMAL(2,2)); +INSERT INTO t1 VALUES (9999999999999999999999999999999999, 0); +SELECT * FROM t1; +f1 f2 +9999999999999999999999999999999999.00000000000000000000 0.00 +DROP TABLE t1; diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 5ceb704eaf7..45a2034e8cc 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -892,3 +892,17 @@ select 0.190287977636363637 + 0.040372670 * 0 - 0; # Bug #9527 # select -0.123 * 0; + +# +# Bug #10232 +# + +CREATE TABLE t1 (f1 DECIMAL (12,9), f2 DECIMAL(2,2)); +INSERT INTO t1 VALUES (10.5, 0); +UPDATE t1 SET f1 = 4.5; +SELECT * FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (f1 DECIMAL (64,20), f2 DECIMAL(2,2)); +INSERT INTO t1 VALUES (9999999999999999999999999999999999, 0); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/strings/decimal.c b/strings/decimal.c index 3fa06132cf1..1e62333ee66 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -1162,6 +1162,8 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) isize0=intg0*sizeof(dec1)+dig2bytes[intg0x], fsize0=frac0*sizeof(dec1)+dig2bytes[frac0x], fsize1=frac1*sizeof(dec1)+dig2bytes[frac1x]; + const int orig_isize0= isize0; + const int orig_fsize0= fsize0; char *orig_to= to; buf1= remove_leading_zeroes(from, &from_intg); @@ -1252,10 +1254,15 @@ int decimal2bin(decimal_t *from, char *to, int precision, int frac) } if (fsize0 > fsize1) { - while (fsize0-- > fsize1) + char *to_end= orig_to + orig_fsize0 + orig_isize0; + + while (fsize0-- > fsize1 && to < to_end) *to++=(uchar)mask; } orig_to[0]^= 0x80; + + /* Check that we have written the whole decimal and nothing more */ + DBUG_ASSERT(to == orig_to + orig_fsize0 + orig_isize0); return error; } From 31d7922823c8cc9d8acfe49b354b02dd7f5021c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 10:45:16 +0200 Subject: [PATCH 08/10] Remove testcode sql/item_strfunc.h: Remove the testcode --- sql/item_strfunc.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index e576b2c2a7e..6f6af415086 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -18,7 +18,6 @@ /* This file defines all string functions */ #ifdef USE_PRAGMA_INTERFACE -#error PRAGMA #pragma interface /* gcc class implementation */ #endif From ba7cf8ca53736d027311fce081af444560a5237a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 15:55:22 +0200 Subject: [PATCH 09/10] comment change (post-review of "replication of triggers"). Btw date_formats segfaults with --ps-protocol - not caused by my changes though; I'll file a bug report. sql/sql_trigger.h: changing comment --- sql/sql_trigger.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 26cfb114cde..90c906fc72f 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -53,10 +53,10 @@ public: should be invoked with creator rights). */ /* - Guilhem puts code to disable binlogging, as in SP/functions, even - though currently triggers can't do updates. When triggers can do - updates, someone should add such a trigger to rpl_sp.test to verify - that the update does NOT go into binlog. + We disable binlogging, as in SP/functions, even though currently + triggers can't do updates. When triggers can do updates, someone + should add such a trigger to rpl_sp.test to verify that the update + does NOT go into binlog. */ tmp_disable_binlog(thd); res= bodies[event][time_type]->execute_function(thd, 0, 0, 0); From 4653d7e16c945ce4a2785f0258c2fa4f14a33ef7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 May 2005 18:34:04 +0000 Subject: [PATCH 10/10] Bug#10018: use INFORMATION_SCHEMA works, but show tables in it returns error additional fix after review --- sql/sql_show.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fe3a2590817..c35687d84a6 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1805,6 +1805,11 @@ int make_db_list(THD *thd, List *files, get_index_field_values(lex, idx_field_vals); if (is_wild_value) { + /* + This part of code is only for SHOW DATABASES command. + idx_field_vals->db_value can be 0 when we don't use + LIKE clause (see also get_index_field_values() function) + */ if (!idx_field_vals->db_value || !wild_case_compare(system_charset_info, information_schema_name.str, @@ -1818,11 +1823,15 @@ int make_db_list(THD *thd, List *files, idx_field_vals->db_value, 1); } + /* + This part of code is for SHOW TABLES, SHOW TABLE STATUS commands. + idx_field_vals->db_value can't be 0 (see get_index_field_values() + function). lex->orig_sql_command can be not equal to SQLCOM_END + only in case of executing of SHOW commands. + */ if (lex->orig_sql_command != SQLCOM_END) { - if (!idx_field_vals->db_value || - !my_strcasecmp(system_charset_info, - information_schema_name.str, + if (!my_strcasecmp(system_charset_info, information_schema_name.str, idx_field_vals->db_value)) { *with_i_schema= 1; @@ -1831,6 +1840,10 @@ int make_db_list(THD *thd, List *files, return files->push_back(thd->strdup(idx_field_vals->db_value)); } + /* + Create list of existing databases. It is used in case + of select from information schema table + */ if (files->push_back(thd->strdup(information_schema_name.str))) return 1; *with_i_schema= 1;