From 51e027eb3d41e1a4725ebfb1a3e14321b3d764bc Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Nov 2005 08:42:36 +0100 Subject: [PATCH 01/12] DbdihMain.cpp: management server performs this check on configuration. If we get this far with something incorrect, something is very wrong. ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: management server performs this check on configuration. If we get this far with something incorrect, something is very wrong. --- ndb/src/kernel/blocks/dbdih/DbdihMain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index ca066b588e7..d666f9d3488 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -10976,7 +10976,8 @@ void Dbdih::initCommonData() cnoReplicas = 1; ndb_mgm_get_int_parameter(p, CFG_DB_NO_REPLICAS, &cnoReplicas); - cnoReplicas = cnoReplicas > 4 ? 4 : cnoReplicas; + progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, + "Only up to four replicas are supported. Check NoOfReplicas."); cgcpDelay = 2000; ndb_mgm_get_int_parameter(p, CFG_DB_GCP_INTERVAL, &cgcpDelay); From 16647d07e067cb2740431cebcad7cb64b89067b4 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Nov 2005 14:29:09 +0100 Subject: [PATCH 02/12] fix spuling mastaeke. Goup is not needed to run cluster ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: s/ownNodeGoup/ownNodeGroup/ --- ndb/src/kernel/blocks/dbdih/DbdihMain.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index d666f9d3488..14ff1003ff2 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -11569,14 +11569,14 @@ void Dbdih::execCHECKNODEGROUPSREQ(Signal* signal) break; case CheckNodeGroups::GetNodeGroupMembers: { ok = true; - Uint32 ownNodeGoup = + Uint32 ownNodeGroup = Sysfile::getNodeGroup(sd->nodeId, SYSFILE->nodeGroups); - sd->output = ownNodeGoup; + sd->output = ownNodeGroup; sd->mask.clear(); NodeGroupRecordPtr ngPtr; - ngPtr.i = ownNodeGoup; + ngPtr.i = ownNodeGroup; ptrAss(ngPtr, nodeGroupRecord); for (Uint32 j = 0; j < ngPtr.p->nodeCount; j++) { jam(); @@ -11584,7 +11584,7 @@ void Dbdih::execCHECKNODEGROUPSREQ(Signal* signal) } #if 0 for (int i = 0; i < MAX_NDB_NODES; i++) { - if (ownNodeGoup == + if (ownNodeGroup == Sysfile::getNodeGroup(i, SYSFILE->nodeGroups)) { sd->mask.set(i); } From db2c1beec157790e212dd0e98bdd987c3f481821 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Nov 2005 14:55:26 +0100 Subject: [PATCH 03/12] ndb_size.pl: fix incorrect quoting of column name ndb/tools/ndb_size.pl: fix incorrect quoting of column name --- ndb/tools/ndb_size.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ndb/tools/ndb_size.pl b/ndb/tools/ndb_size.pl index ece0901e0b2..e0085c619f0 100644 --- a/ndb/tools/ndb_size.pl +++ b/ndb/tools/ndb_size.pl @@ -146,9 +146,9 @@ foreach(@{$tables}) elsif($type =~ /varchar/ || $type =~ /varbinary/) { my $fixed= 1+$size; - my @dynamic=$dbh->selectrow_array("select avg(length(" - .$dbh->quote($name) - .")) from `".$table.'`'); + my @dynamic=$dbh->selectrow_array("select avg(length(`" + .$name. + ."`)) from `".$table.'`'); $dynamic[0]=0 if !$dynamic[0]; @realsize= ($fixed,$fixed,ceil($dynamic[0])); } From 3fe5fe577b4c572427c1557a5ae2138440e0f1ce Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 29 Nov 2005 15:38:39 +0100 Subject: [PATCH 04/12] DbdihMain.cpp: fix small error that jonas pointed out that would mean we always die on assert, intsead of just on error ndb/src/kernel/blocks/dbdih/DbdihMain.cpp: fix small error that jonas pointed out that would mean we always die on assert, intsead of just on error --- ndb/src/kernel/blocks/dbdih/DbdihMain.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index 14ff1003ff2..4b6056aed91 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -10976,8 +10976,11 @@ void Dbdih::initCommonData() cnoReplicas = 1; ndb_mgm_get_int_parameter(p, CFG_DB_NO_REPLICAS, &cnoReplicas); - progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, - "Only up to four replicas are supported. Check NoOfReplicas."); + if (cnoReplicas > 4) + { + progError(__LINE__, NDBD_EXIT_INVALID_CONFIG, + "Only up to four replicas are supported. Check NoOfReplicas."); + } cgcpDelay = 2000; ndb_mgm_get_int_parameter(p, CFG_DB_GCP_INTERVAL, &cgcpDelay); From f632c90498e2ff77caf4caf2874ea3b3de3dbcbe Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Nov 2005 14:18:43 +0100 Subject: [PATCH 05/12] DblqhMain.cpp: Use DBblock_REF instead of calcBLOCKBlockRef(getOwnNodeId()) as they are the same and the former is more efficient. Makes it easier to grep for senders of signals to specific blocks ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Use DBblock_REF instead of calcBLOCKBlockRef(getOwnNodeId()) as they are the same and the former is more efficient. --- ndb/src/kernel/blocks/dblqh/DblqhMain.cpp | 30 +++++++++-------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index b6178227d31..1a02b5feb26 100644 --- a/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -18444,60 +18444,54 @@ void Dblqh::execCREATE_TRIG_REQ(Signal* signal) { jamEntry(); - NodeId myNodeId = getOwnNodeId(); - BlockReference tupref = calcTupBlockRef(myNodeId); - sendSignal(tupref, GSN_CREATE_TRIG_REQ, signal, CreateTrigReq::SignalLength, JBB); + sendSignal(DBTUP_REF, GSN_CREATE_TRIG_REQ, signal, + CreateTrigReq::SignalLength, JBB); } void Dblqh::execCREATE_TRIG_CONF(Signal* signal) { jamEntry(); - NodeId myNodeId = getOwnNodeId(); - BlockReference dictref = calcDictBlockRef(myNodeId); - sendSignal(dictref, GSN_CREATE_TRIG_CONF, signal, CreateTrigConf::SignalLength, JBB); + sendSignal(DBDICT_REF, GSN_CREATE_TRIG_CONF, signal, + CreateTrigConf::SignalLength, JBB); } void Dblqh::execCREATE_TRIG_REF(Signal* signal) { jamEntry(); - NodeId myNodeId = getOwnNodeId(); - BlockReference dictref = calcDictBlockRef(myNodeId); - sendSignal(dictref, GSN_CREATE_TRIG_REF, signal, CreateTrigRef::SignalLength, JBB); + sendSignal(DBDICT_REF, GSN_CREATE_TRIG_REF, signal, + CreateTrigRef::SignalLength, JBB); } void Dblqh::execDROP_TRIG_REQ(Signal* signal) { jamEntry(); - NodeId myNodeId = getOwnNodeId(); - BlockReference tupref = calcTupBlockRef(myNodeId); - sendSignal(tupref, GSN_DROP_TRIG_REQ, signal, DropTrigReq::SignalLength, JBB); + sendSignal(DBTUP_REF, GSN_DROP_TRIG_REQ, signal, + DropTrigReq::SignalLength, JBB); } void Dblqh::execDROP_TRIG_CONF(Signal* signal) { jamEntry(); - NodeId myNodeId = getOwnNodeId(); - BlockReference dictref = calcDictBlockRef(myNodeId); - sendSignal(dictref, GSN_DROP_TRIG_CONF, signal, DropTrigConf::SignalLength, JBB); + sendSignal(DBDICT_REF, GSN_DROP_TRIG_CONF, signal, + DropTrigConf::SignalLength, JBB); } void Dblqh::execDROP_TRIG_REF(Signal* signal) { jamEntry(); - NodeId myNodeId = getOwnNodeId(); - BlockReference dictref = calcDictBlockRef(myNodeId); - sendSignal(dictref, GSN_DROP_TRIG_REF, signal, DropTrigRef::SignalLength, JBB); + sendSignal(DBDICT_REF, GSN_DROP_TRIG_REF, signal, + DropTrigRef::SignalLength, JBB); } Uint32 Dblqh::calcPageCheckSum(LogPageRecordPtr logP){ From a2c7b2a67c88dbb3063fc1f0bee443c0e50c6d3b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Dec 2005 14:55:25 +0100 Subject: [PATCH 06/12] Backup.cpp: convert comment to english ndb/src/kernel/blocks/backup/Backup.cpp: convert comment to english --- ndb/src/kernel/blocks/backup/Backup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/kernel/blocks/backup/Backup.cpp b/ndb/src/kernel/blocks/backup/Backup.cpp index 56af24c5cf0..b26ff63028b 100644 --- a/ndb/src/kernel/blocks/backup/Backup.cpp +++ b/ndb/src/kernel/blocks/backup/Backup.cpp @@ -3769,7 +3769,7 @@ Backup::checkFile(Signal* signal, BackupFilePtr filePtr) req->userReference = reference(); req->varIndex = 0; req->offset = tmp - c_startOfPages; - req->size = sz; // Avrunda uppot + req->size = sz; // Round up sendSignal(NDBFS_REF, GSN_FSAPPENDREQ, signal, FsAppendReq::SignalLength, JBA); From 7402f669c6b84336769c8180e72f1da50194da74 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 11 Dec 2005 15:26:15 +0300 Subject: [PATCH 07/12] Fix for bug #14863 "Triggers: crash if create and there is no current database". Now when we create or drop trigger we check that both trigger name and trigger table always have database part specified. Thus we give an error if it they are not specified explicitly or implicitly via current database. mysql-test/r/trigger.result: Added test for bug #14863 "Triggers: crash if create and there is no current database". mysql-test/t/trigger.test: Added test for bug #14863 "Triggers: crash if create and there is no current database". sql/sql_trigger.cc: mysql_create_or_drop_trigger(): Now we check that both trigger name and trigger table have database part specified (explicitly or implicitly via current database. Note that in latter case sp_name::m_db is already set by parser). Table_triggers_list::create_trigger()/::add_table_for_trigger(): Simplified method/function's code since now they can assume that sp_name::m_db is always filled now. trigname_file_parameters: Removed comment which is no longer true. --- mysql-test/r/trigger.result | 6 ++++++ mysql-test/t/trigger.test | 15 +++++++++++++++ sql/sql_trigger.cc | 27 +++++++++++++++++---------- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index ff92fc543d4..e0048515fed 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -780,3 +780,9 @@ end// CALL p2(); drop procedure p2; drop table t1; +create trigger t1_bi before insert on test.t1 for each row set @a:=0; +ERROR 3D000: No database selected +create trigger test.t1_bi before insert on t1 for each row set @a:=0; +ERROR 3D000: No database selected +drop trigger t1_bi; +ERROR 3D000: No database selected diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index d4fa5268762..b4074897689 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -13,6 +13,8 @@ drop procedure if exists p1; # Create additional connections used through test connect (addconroot1, localhost, root,,); connect (addconroot2, localhost, root,,); +# Connection without current database set +connect (addconwithoutdb, localhost, root,,*NO-ONE*); connection default; create table t1 (i int); @@ -946,3 +948,16 @@ CALL p2(); drop procedure p2; drop table t1; +# +# Test for bug #14863 "Triggers: crash if create and there is no current +# database". We should not crash and give proper error when database for +# trigger or its table is not specified and there is no current database. +# +connection addconwithoutdb; +--error ER_NO_DB_ERROR +create trigger t1_bi before insert on test.t1 for each row set @a:=0; +--error ER_NO_DB_ERROR +create trigger test.t1_bi before insert on t1 for each row set @a:=0; +--error ER_NO_DB_ERROR +drop trigger t1_bi; +connection default; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 779b044696e..13b79821a58 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -78,10 +78,6 @@ const char * const trigname_file_ext= ".TRN"; static File_option trigname_file_parameters[]= { { - /* - FIXME: Length specified for "trigger_table" key is erroneous, problem - caused by this are reported as BUG#14090 and should be fixed ASAP. - */ {STRING_WITH_LEN("trigger_table")}, offsetof(struct st_trigname, trigger_table), FILE_OPTIONS_ESTRING @@ -155,6 +151,17 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) But do we want this ? */ + /* + Note that once we will have check for TRIGGER privilege in place we won't + need second part of condition below, since check_access() function also + checks that db is specified. + */ + if (!thd->lex->spname->m_db.length || create && !tables->db_length) + { + my_error(ER_NO_DB_ERROR, MYF(0)); + DBUG_RETURN(TRUE); + } + if (!create && !(tables= add_table_for_trigger(thd, thd->lex->spname))) DBUG_RETURN(TRUE); @@ -285,6 +292,9 @@ end: definer. The caller is responsible to provide memory for storing LEX_STRING object. + NOTE + Assumes that trigger name is fully qualified. + RETURN VALUE False - success True - error @@ -307,9 +317,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, /* Trigger must be in the same schema as target table. */ - if (my_strcasecmp(table_alias_charset, table->s->db, - lex->spname->m_db.str ? lex->spname->m_db.str : - thd->db)) + if (my_strcasecmp(table_alias_charset, table->s->db, lex->spname->m_db.str)) { my_error(ER_TRG_IN_WRONG_SCHEMA, MYF(0)); return 1; @@ -1010,7 +1018,6 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event, static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig) { - const char *db= !trig->m_db.str ? thd->db : trig->m_db.str; LEX *lex= thd->lex; char path_buff[FN_REFLEN]; LEX_STRING path; @@ -1018,7 +1025,7 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig) struct st_trigname trigname; DBUG_ENTER("add_table_for_trigger"); - strxnmov(path_buff, FN_REFLEN, mysql_data_home, "/", db, "/", + strxnmov(path_buff, FN_REFLEN, mysql_data_home, "/", trig->m_db.str, "/", trig->m_name.str, trigname_file_ext, NullS); path.length= unpack_filename(path_buff, path_buff); path.str= path_buff; @@ -1047,7 +1054,7 @@ static TABLE_LIST *add_table_for_trigger(THD *thd, sp_name *trig) /* We need to reset statement table list to be PS/SP friendly. */ lex->query_tables= 0; lex->query_tables_last= &lex->query_tables; - DBUG_RETURN(sp_add_to_query_tables(thd, lex, db, + DBUG_RETURN(sp_add_to_query_tables(thd, lex, trig->m_db.str, trigname.trigger_table.str, TL_WRITE)); } From 479a02fad565dbe2ef875f949e8306f8fde3e41f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Dec 2005 14:46:54 +0400 Subject: [PATCH 08/12] Bug#12770 DESC cannot display the info. about temporary table Bug#14387 SHOW COLUMNS doesn't work on temporary tables. Bug#15224 SHOW INDEX from temporary table doesn't work. Restore thd->temporary_tables to be able to process temporary tables(only for 'show index' & 'show columns'). This should be changed when processing of temporary tables for I_S tables will be done. mysql-test/r/information_schema.result: Bug#12770 DESC cannot display the info. about temporary table Bug#14387 SHOW COLUMNS doesn't work on temporary tables. Bug#15224 SHOW INDEX from temporary table doesn't work. test case mysql-test/t/information_schema.test: Bug#12770 DESC cannot display the info. about temporary table Bug#14387 SHOW COLUMNS doesn't work on temporary tables. Bug#15224 SHOW INDEX from temporary table doesn't work. test case --- mysql-test/r/information_schema.result | 11 +++++++++++ mysql-test/t/information_schema.test | 11 +++++++++++ sql/sql_show.cc | 8 ++++++++ 3 files changed, 30 insertions(+) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 6224b30b70e..5e34c41dfb2 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1056,3 +1056,14 @@ where table_name="v1"; table_type VIEW drop view v1; +create temporary table t1(f1 int, index(f1)); +show columns from t1; +Field Type Null Key Default Extra +f1 int(11) YES MUL NULL +describe t1; +Field Type Null Key Default Extra +f1 int(11) YES MUL NULL +show indexes from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 f1 1 f1 A NULL NULL NULL YES BTREE +drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index acbc62f1364..b982047cec7 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -748,3 +748,14 @@ drop table t1; select table_type from information_schema.tables where table_name="v1"; drop view v1; + +# +# Bug #14387 SHOW COLUMNS doesn't work on temporary tables +# Bug #15224 SHOW INDEX from temporary table doesn't work +# Bug #12770 DESC cannot display the info. about temporary table +# +create temporary table t1(f1 int, index(f1)); +show columns from t1; +describe t1; +show indexes from t1; +drop table t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 82870d46e6c..dc6c141bef7 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2069,6 +2069,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) bool res; lex->all_selects_list= lsel; + /* + Restore thd->temporary_tables to be able to process + temporary tables(only for 'show index' & 'show columns'). + This should be changed when processing of temporary tables for + I_S tables will be done. + */ + thd->temporary_tables= open_tables_state_backup.temporary_tables; res= open_normal_and_derived_tables(thd, show_table_list, MYSQL_LOCK_IGNORE_FLUSH); /* @@ -2088,6 +2095,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) show_table_list->view_db.str : show_table_list->db), show_table_list->alias)); + thd->temporary_tables= 0; close_thread_tables(thd); show_table_list->table= 0; goto err; From c7a440d1c6d0158a43880745971d20d95bcf6803 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Dec 2005 15:36:03 +0400 Subject: [PATCH 09/12] Fix for bug#14861 aliased column names are not preserved. Create tmp table filed using original item name when it's necessary mysql-test/r/view.result: Fix for bug#14861 aliased column names are not preserved. test case mysql-test/t/view.test: Fix for bug#14861 aliased column names are not preserved. test case --- mysql-test/r/view.result | 16 ++++++++++++++++ mysql-test/t/view.test | 19 +++++++++++++++++++ sql/sql_select.cc | 12 +++++++----- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index e4f2671eb34..7e7d0617b51 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -2456,3 +2456,19 @@ f1() 42 drop view v2,v1; drop function f1; +create table t1 (id numeric, warehouse_id numeric); +create view v1 as select id from t1; +create view v2 as +select t1.warehouse_id, v1.id as receipt_id +from t1, v1 where t1.id = v1.id; +insert into t1 (id, warehouse_id) values(3, 2); +insert into t1 (id, warehouse_id) values(4, 2); +insert into t1 (id, warehouse_id) values(5, 1); +select v2.receipt_id as alias1, v2.receipt_id as alias2 from v2 +order by v2.receipt_id; +alias1 alias2 +3 3 +4 4 +5 5 +drop view v2, v1; +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6d2afb908a4..718e1a9932b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2319,3 +2319,22 @@ CREATE VIEW v2 AS SELECT f1(); select * from v2; drop view v2,v1; drop function f1; + +# +# Bug#14861: aliased column names are not preserved. +# +create table t1 (id numeric, warehouse_id numeric); +create view v1 as select id from t1; +create view v2 as +select t1.warehouse_id, v1.id as receipt_id +from t1, v1 where t1.id = v1.id; + +insert into t1 (id, warehouse_id) values(3, 2); +insert into t1 (id, warehouse_id) values(4, 2); +insert into t1 (id, warehouse_id) values(5, 1); + +select v2.receipt_id as alias1, v2.receipt_id as alias2 from v2 +order by v2.receipt_id; + +drop view v2, v1; +drop table t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9b5b4b90ccb..1485f88610a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8189,7 +8189,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, uint convert_blob_length) { Item::Type orig_type= type; - Item *orig_item; + Item *orig_item= 0; if (type != Item::FIELD_ITEM && item->real_item()->type() == Item::FIELD_ITEM && @@ -8240,10 +8240,12 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, } else result= create_tmp_field_from_field(thd, (*from_field= field->field), - item->name, table, - modify_item ? field : - NULL, - convert_blob_length); + orig_item ? orig_item->name : + item->name, + table, + modify_item ? field : + NULL, + convert_blob_length); if (orig_type == Item::REF_ITEM && orig_modify) ((Item_ref*)orig_item)->set_result_field(result); return result; From d920097af497870f2fca84f059a89a59b77b6e85 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 19 Dec 2005 16:21:02 +0400 Subject: [PATCH 10/12] Fix for bug#14271 I_S: columns has no size for (var)binary columns set character_octet_length, character_maximum_length for binary and varbinary field types mysql-test/r/information_schema.result: Fix for bug#14271 I_S: columns has no size for (var)binary columns test case mysql-test/t/information_schema.test: Fix for bug#14271 I_S: columns has no size for (var)binary columns test case --- mysql-test/r/information_schema.result | 7 +++++++ mysql-test/t/information_schema.test | 8 ++++++++ sql/sql_show.cc | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 5e34c41dfb2..e8d343ad711 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1067,3 +1067,10 @@ show indexes from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 1 f1 1 f1 A NULL NULL NULL YES BTREE drop table t1; +create table t1(f1 binary(32), f2 varbinary(64)); +select character_maximum_length, character_octet_length +from information_schema.columns where table_name='t1'; +character_maximum_length character_octet_length +32 32 +64 64 +drop table t1; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index b982047cec7..b05798b781f 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -759,3 +759,11 @@ show columns from t1; describe t1; show indexes from t1; drop table t1; + +# +# Bug#14271 I_S: columns has no size for (var)binary columns +# +create table t1(f1 binary(32), f2 varbinary(64)); +select character_maximum_length, character_octet_length +from information_schema.columns where table_name='t1'; +drop table t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index dc6c141bef7..1b31e8f7dc3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2616,7 +2616,9 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, table->field[6]->store((const char*) pos, strlen((const char*) pos), cs); is_blob= (field->type() == FIELD_TYPE_BLOB); - if (field->has_charset() || is_blob) + if (field->has_charset() || is_blob || + field->real_type() == MYSQL_TYPE_VARCHAR || // For varbinary type + field->real_type() == MYSQL_TYPE_STRING) // For binary type { longlong char_max_len= is_blob ? (longlong) field->max_length() / field->charset()->mbminlen : From 28999410c865cf38bbaf107a76bd3c66e7b7b414 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 20 Dec 2005 00:47:50 +0100 Subject: [PATCH 11/12] Bug #15772 Aborted YaSSL connections force threads into busyloops - Report error when there is nothing to read after wait. extra/yassl/src/handshake.cpp: Report error if there is nothing to read after a blocking read --- extra/yassl/src/handshake.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index 45dfb6fa032..d7df438b8df 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -656,7 +656,11 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr buffered) { ssl.getSocket().wait(); // wait for input if blocking uint ready = ssl.getSocket().get_ready(); - if (!ready) return buffered; + if (!ready) { + // Nothing to receive after blocking wait => error + ssl.SetError(receive_error); + return buffered= null_buffer; + } // add buffered data if its there uint buffSz = buffered.get() ? buffered.get()->get_size() : 0; From 3b94794f93face2f183f428c349089d66726a607 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 20 Dec 2005 12:42:35 -0600 Subject: [PATCH 12/12] errmsg.txt: Fix typo. sql/share/errmsg.txt: Fix typo. --- sql/share/errmsg.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index efa7860f251..185b4326c5c 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5375,7 +5375,7 @@ ER_WSAS_FAILED eng "WSAStartup Failed" ger "WSAStartup fehlgeschlagen" ER_DIFF_GROUPS_PROC - eng "Can't handle procedures with differents groups yet" + eng "Can't handle procedures with different groups yet" ger "Kann Prozeduren mit unterschiedlichen Gruppen noch nicht verarbeiten" ER_NO_GROUP_FOR_PROC eng "Select must have a group with this procedure"