From 31a79ee3d0fd8cde70bad857807c5053f06a938b Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Mon, 17 Oct 2005 17:00:42 -0700 Subject: [PATCH 01/11] Fix Item_func_abs::fix_length_and_dec() to set maybe_null properly. (Bug #14009) --- mysql-test/r/func_math.result | 6 ++++++ mysql-test/t/func_math.test | 10 ++++++++++ sql/item_func.cc | 1 + 3 files changed, 17 insertions(+) diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index b36902d7872..11a3d14fb65 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -145,3 +145,9 @@ insert into t1 values (1); select rand(i) from t1; ERROR HY000: Incorrect arguments to RAND drop table t1; +create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8; +insert into t1 values ('http://www.foo.com/', now()); +select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0)); +a +http://www.foo.com/ +drop table t1; diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index c75454a96d4..a8f62e38e86 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -86,4 +86,14 @@ insert into t1 values (1); select rand(i) from t1; drop table t1; +# +# Bug #14009: use of abs() on null value causes problems with filesort +# +# InnoDB is required to reproduce the fault, but it is okay if we default to +# MyISAM when testing. +create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8; +insert into t1 values ('http://www.foo.com/', now()); +select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0)); +drop table t1; + # End of 4.1 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 288859443ff..5a70e6ba89b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -766,6 +766,7 @@ void Item_func_abs::fix_length_and_dec() hybrid_type= REAL_RESULT; if (args[0]->result_type() == INT_RESULT) hybrid_type= INT_RESULT; + maybe_null= 1; } From 5d2c1d4cc256361b5cf869caf17a06218d416e82 Mon Sep 17 00:00:00 2001 From: "paul@frost.snake.net" <> Date: Wed, 19 Oct 2005 14:40:10 -0500 Subject: [PATCH 02/11] mysqldump.c: Slight change to help message. --- client/mysqldump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 0e7248697c2..e50becda8b2 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -342,7 +342,7 @@ static struct my_option my_long_options[] = {"result-file", 'r', "Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"routines", 'R', "Dump routines FUNCTIONS and PROCEDURES.", + {"routines", 'R', "Dump stored routines (functions and procedures).", (gptr*) &opt_routines, (gptr*) &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"set-charset", OPT_SET_CHARSET, From 56aeee44d39e10c7d86cdbc4eb7cd695a1292763 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Tue, 25 Oct 2005 16:34:03 +0400 Subject: [PATCH 03/11] Fix for BUG#14272: Don't run index scan when we should use quick select. This could cause failures because there are table handlers (like federated) that support quick select scanning but do not support index scanning. --- mysql-test/t/disabled.def | 1 - sql/sql_update.cc | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index bc81f716ec7..fe95a543fb5 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -15,4 +15,3 @@ rpl_relayrotate : Unstable test case, bug#12429 rpl_until : Unstable test case, bug#12429 rpl_deadlock : Unstable test case, bug#12429 kill : Unstable test case, bug#9712 -federated : Broken test case, bug#14272 diff --git a/sql/sql_update.cc b/sql/sql_update.cc index a8e21177338..f0682c1c9cd 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -286,7 +286,7 @@ int mysql_update(THD *thd, if (used_index < MAX_KEY && old_used_keys.is_set(used_index)) { table->key_read=1; - table->file->extra(HA_EXTRA_KEYREAD); //todo: psergey: check + table->file->extra(HA_EXTRA_KEYREAD); } /* note: can actually avoid sorting below.. */ @@ -334,7 +334,7 @@ int mysql_update(THD *thd, /* If quick select is used, initialize it before retrieving rows. */ if (select && select->quick && select->quick->reset()) goto err; - if (used_index == MAX_KEY) + if (used_index == MAX_KEY || (select && select->quick)) init_read_record(&info,thd,table,select,0,1); else init_read_record_idx(&info, thd, table, 1, used_index); From 2219ada7f63f6e528a646864d5e6633857bec801 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Wed, 26 Oct 2005 00:56:17 +0400 Subject: [PATCH 04/11] BUG#14139: When handling "CREATE TABLE(field_X type_spec,...) SELECT smth AS field_X, ...." avoid multiplying length of field_X by charset->mbmaxlen twice when calculating space required for field_X in the new table. --- mysql-test/r/create.result | 11 +++++++++++ mysql-test/t/create.test | 8 ++++++++ sql/field.cc | 12 ++++++++++++ sql/field.h | 8 ++++++++ sql/sql_table.cc | 4 ++-- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 6edd4cbc48f..55ad6e3304a 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -621,3 +621,14 @@ create table if not exists t1 (a int); Warnings: Note 1050 Table 't1' already exists drop table t1; +create table t1 ( +a varchar(112) charset utf8 collate utf8_bin not null, +primary key (a) +) select 'test' as a ; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(112) character set utf8 collate utf8_bin NOT NULL default '', + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 73184853d1a..966be8b58a3 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -526,4 +526,12 @@ create table t1 (a int); create table if not exists t1 (a int); drop table t1; +# BUG#14139 +create table t1 ( + a varchar(112) charset utf8 collate utf8_bin not null, + primary key (a) +) select 'test' as a ; +show create table t1; +drop table t1; + # End of 4.1 tests diff --git a/sql/field.cc b/sql/field.cc index 6d2f92e27ea..35dfa4cac18 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6511,8 +6511,20 @@ bool Field_num::eq_def(Field *field) ** Handling of field and create_field *****************************************************************************/ +/* + Convert create_field::length from number of characters to number of bytes + + SYNOPSIS + create_field::create_length_to_internal_length() + + DESCRIPTION + Convert create_field::length from number of characters to number of bytes, + save original value in chars_length. +*/ + void create_field::create_length_to_internal_length(void) { + chars_length= length; switch (sql_type) { case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: diff --git a/sql/field.h b/sql/field.h index ba963418c7a..04f1bd68c7a 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1180,7 +1180,15 @@ public: LEX_STRING comment; // Comment for field Item *def; // Default value enum enum_field_types sql_type; + /* + At various stages in execution this can be length of field in bytes or + max number of characters. + */ uint32 length; + /* + The value of 'length' before a call to create_length_to_internal_length + */ + uint32 chars_length; uint decimals,flags,pack_length; Field::utype unireg_check; TYPELIB *interval; // Which interval to use diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 01126043764..dcbc2018b49 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -643,8 +643,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->charset= (dup_field->charset ? dup_field->charset : create_info->default_table_charset); - sql_field->length= dup_field->length; - sql_field->pack_length= dup_field->pack_length; + sql_field->length= dup_field->chars_length; + sql_field->pack_length= dup_field->pack_length; sql_field->create_length_to_internal_length(); sql_field->decimals= dup_field->decimals; sql_field->flags= dup_field->flags; From 28cb5aefcf0aba6b8bf37371014a83612c39e881 Mon Sep 17 00:00:00 2001 From: "jani@a193-229-222-105.elisa-laajakaista.fi" <> Date: Fri, 28 Oct 2005 14:01:00 +0300 Subject: [PATCH 05/11] NetWare specific change to use a LibC API instead of a kernel function to prevent CPU hogs. --- include/config-netware.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/config-netware.h b/include/config-netware.h index 310c9bb7db8..e07e972ba4b 100644 --- a/include/config-netware.h +++ b/include/config-netware.h @@ -116,15 +116,12 @@ extern "C" { /* do not use the extended time in LibC sys\stat.h */ #define _POSIX_SOURCE -/* Kernel call on NetWare that will only yield if our time slice is up */ -void kYieldIfTimeSliceUp(void); - /* Some macros for portability */ #define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time(NULL)+(SEC); (ABSTIME).tv_nsec=0; } /* extra protection against CPU Hogs on NetWare */ -#define NETWARE_YIELD kYieldIfTimeSliceUp() +#define NETWARE_YIELD pthread_yield() /* Screen mode for help texts */ #define NETWARE_SET_SCREEN_MODE(A) setscreenmode(A) From cc5d7c07159f92f3a8defa8ea9ea32176ab0e229 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Fri, 28 Oct 2005 15:24:46 +0400 Subject: [PATCH 06/11] Fix bug #14138 ROLLUP and PROCEDURE ANALYSE() hang server Procedure analyse() redefines select's fields_list. setup_copy_fields() assumes that fields_list is a part of all_fields_list. Because select have only 3 columns and analyse() redefines it to have 10 columns, int overrun in setup_copy_fields() occurs and server goes to almost infinite loop. Because fields_list used not only to send data ad fields types, it's wrong to allow procedure redefine it. This patch separates select's fileds_list and procedure's one. Now if procedure is present, copy of fields_list is created in procedure_fields_list and it is used for sending data and fields. --- mysql-test/r/analyse.result | 26 ++++++++++++++++++++++++++ mysql-test/t/analyse.test | 25 +++++++++++++++++++++++++ sql/sql_select.cc | 25 ++++++++++++++----------- sql/sql_select.h | 1 + 4 files changed, 66 insertions(+), 11 deletions(-) diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result index 0ebd4a3e409..f8737d8082b 100644 --- a/mysql-test/r/analyse.result +++ b/mysql-test/r/analyse.result @@ -108,3 +108,29 @@ select * from t1 procedure analyse (1,1); Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype test.t1.d 100000 100000 6 6 0 0 100000 0 MEDIUMINT(6) UNSIGNED NOT NULL drop table t1; +create table t1 (product varchar(32), country_id int not null, year int, +profit int); +insert into t1 values ( 'Computer', 2,2000, 1200), +( 'TV', 1, 1999, 150), +( 'Calculator', 1, 1999,50), +( 'Computer', 1, 1999,1500), +( 'Computer', 1, 2000,1500), +( 'TV', 1, 2000, 150), +( 'TV', 2, 2000, 100), +( 'TV', 2, 2000, 100), +( 'Calculator', 1, 2000,75), +( 'Calculator', 2, 2000,75), +( 'TV', 1, 1999, 100), +( 'Computer', 1, 1999,1200), +( 'Computer', 2, 2000,1500), +( 'Calculator', 2, 2000,75), +( 'Phone', 3, 2003,10) +; +create table t2 (country_id int primary key, country char(20) not null); +insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland'); +select product, sum(profit),avg(profit) from t1 group by product with rollup procedure analyse(); +Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype +test.t1.product Computer TV 2 8 0 0 4.2500 NULL ENUM('Computer','Phone','TV') NOT NULL +sum(profit) 10 6900 2 4 0 0 1946 2868 ENUM('10','275','600','6900') NOT NULL +avg(profit) 10.0000 1380.0000 7 9 0 0 394.6875 570.2003 ENUM('10.0000','68.7500','120.0000','1380.0000') NOT NULL +drop table t1,t2; diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test index e38e43381bc..dfca8f575a4 100644 --- a/mysql-test/t/analyse.test +++ b/mysql-test/t/analyse.test @@ -57,4 +57,29 @@ insert into t1 values (100000); select * from t1 procedure analyse (1,1); drop table t1; +# +# Bug #14138 ROLLUP and PROCEDURE ANALYSE() hang server +# +create table t1 (product varchar(32), country_id int not null, year int, + profit int); +insert into t1 values ( 'Computer', 2,2000, 1200), + ( 'TV', 1, 1999, 150), + ( 'Calculator', 1, 1999,50), + ( 'Computer', 1, 1999,1500), + ( 'Computer', 1, 2000,1500), + ( 'TV', 1, 2000, 150), + ( 'TV', 2, 2000, 100), + ( 'TV', 2, 2000, 100), + ( 'Calculator', 1, 2000,75), + ( 'Calculator', 2, 2000,75), + ( 'TV', 1, 1999, 100), + ( 'Computer', 1, 1999,1200), + ( 'Computer', 2, 2000,1500), + ( 'Calculator', 2, 2000,75), + ( 'Phone', 3, 2003,10) + ; +create table t2 (country_id int primary key, country char(20) not null); +insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland'); +select product, sum(profit),avg(profit) from t1 group by product with rollup procedure analyse(); +drop table t1,t2; # End of 4.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fe5428abf45..f057e30b6eb 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1044,18 +1044,21 @@ JOIN::save_join_tab() void JOIN::exec() { + List *columns_list= &fields_list; int tmp_error; DBUG_ENTER("JOIN::exec"); error= 0; if (procedure) { - if (procedure->change_columns(fields_list) || - result->prepare(fields_list, unit)) + procedure_fields_list= fields_list; + if (procedure->change_columns(procedure_fields_list) || + result->prepare(procedure_fields_list, unit)) { thd->limit_found_rows= thd->examined_row_count= 0; DBUG_VOID_RETURN; } + columns_list= &procedure_fields_list; } else if (test(select_options & OPTION_BUFFER_RESULT) && result && result->prepare(fields_list, unit)) @@ -1072,7 +1075,7 @@ JOIN::exec() (zero_result_cause?zero_result_cause:"No tables used")); else { - result->send_fields(fields_list,1); + result->send_fields(*columns_list, 1); /* We have to test for 'conds' here as the WHERE may not be constant even if we don't have any tables for prepared statements or if @@ -1082,9 +1085,9 @@ JOIN::exec() (!conds || conds->val_int()) && (!having || having->val_int())) { - if (do_send_rows && (procedure ? (procedure->send_row(fields_list) || - procedure->end_of_records()) - : result->send_data(fields_list))) + if (do_send_rows && + (procedure ? (procedure->send_row(procedure_fields_list) || + procedure->end_of_records()) : result->send_data(fields_list))) error= 1; else { @@ -1108,7 +1111,7 @@ JOIN::exec() if (zero_result_cause) { - (void) return_zero_rows(this, result, tables_list, fields_list, + (void) return_zero_rows(this, result, tables_list, *columns_list, send_row_on_empty_set(), select_options, zero_result_cause, @@ -5845,13 +5848,13 @@ do_select(JOIN *join,List *fields,TABLE *table,Procedure *procedure) JOIN_TAB *join_tab; int (*end_select)(JOIN *, struct st_join_table *,bool); DBUG_ENTER("do_select"); - + List *columns_list= procedure ? &join->procedure_fields_list : fields; join->procedure=procedure; /* Tell the client how many fields there are in a row */ if (!table) - join->result->send_fields(*fields,1); + join->result->send_fields(*columns_list, 1); else { VOID(table->file->extra(HA_EXTRA_WRITE_CACHE)); @@ -5913,7 +5916,7 @@ do_select(JOIN *join,List *fields,TABLE *table,Procedure *procedure) error=(*end_select)(join,join_tab,1); } else if (join->send_row_on_empty_set()) - error= join->result->send_data(*join->fields); + error= join->result->send_data(*columns_list); } else { @@ -6612,7 +6615,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), DBUG_RETURN(0); // Didn't match having error=0; if (join->procedure) - error=join->procedure->send_row(*join->fields); + error=join->procedure->send_row(join->procedure_fields_list); else if (join->do_send_rows) error=join->result->send_data(*join->fields); if (error) diff --git a/sql/sql_select.h b/sql/sql_select.h index c7440fe4c3a..fe9bb7d69d3 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -204,6 +204,7 @@ class JOIN :public Sql_alloc //Part, shared with list above, emulate following list List tmp_fields_list1, tmp_fields_list2, tmp_fields_list3; List &fields_list; // hold field list passed to mysql_select + List procedure_fields_list; int error; ORDER *order, *group_list, *proc_param; //hold parameters of mysql_select From c807cd2e26949e741871856fffc598a0638e4efa Mon Sep 17 00:00:00 2001 From: "aivanov@mysql.com" <> Date: Fri, 28 Oct 2005 17:16:22 +0400 Subject: [PATCH 07/11] Fix BUG#10511: Wrong padding of UCS2 CHAR columns in ON UPDATE CASCADE --- innobase/row/row0ins.c | 46 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 5ca1ee51cbd..456bb51d424 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -522,20 +522,50 @@ row_ins_cascade_calc_update_vec( && ufield->new_val.len < dtype_get_fixed_size(type)) { + ulint cset; + ufield->new_val.data = mem_heap_alloc(heap, dtype_get_fixed_size(type)); ufield->new_val.len = dtype_get_fixed_size(type); - ut_a(dtype_get_pad_char(type) - != ULINT_UNDEFINED); - memset(ufield->new_val.data, - (byte)dtype_get_pad_char(type), - dtype_get_fixed_size(type)); - ut_memcpy(ufield->new_val.data, - parent_ufield->new_val.data, - parent_ufield->new_val.len); + /* Handle UCS2 strings differently. + As no new collations will be + introduced in 4.1, we hardcode the + charset-collation codes here. + In 5.0, the logic is based on + mbminlen. */ + cset = dtype_get_charset_coll( + dtype_get_prtype(type)); + + if (cset == 35/*ucs2_general_ci*/ + || cset == 90/*ucs2_bin*/ + || (cset >= 128/*ucs2_unicode_ci*/ + && cset <= 144 + /*ucs2_persian_ci*/)) { + /* space=0x0020 */ + ulint i; + for (i = 0; + i < ufield->new_val.len; + i += 2) { + mach_write_to_2(((byte*) + ufield->new_val.data) + + i, 0x0020); + } + } else { + ut_a(dtype_get_pad_char(type) + != ULINT_UNDEFINED); + + memset(ufield->new_val.data, + (byte)dtype_get_pad_char( + type), + ufield->new_val.len); + } + + memcpy(ufield->new_val.data, + parent_ufield->new_val.data, + parent_ufield->new_val.len); } ufield->extern_storage = FALSE; From 552c208bfe3bd0e7cb1a2a3501d5226b0ac4726c Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Fri, 28 Oct 2005 10:16:44 -0700 Subject: [PATCH 08/11] Update test with changed result after merge --- mysql-test/r/type_newdecimal.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index dbae646c362..45eb8aab89e 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -176,7 +176,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `round(15.4,-1)` decimal(3,0) unsigned NOT NULL default '0', `truncate(-5678.123451,-3)` decimal(4,0) NOT NULL default '0', - `abs(-1.1)` decimal(2,1) NOT NULL default '0.0', + `abs(-1.1)` decimal(2,1) default NULL, `-(-1.1)` decimal(2,1) NOT NULL default '0.0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; From b5d5e9a546879b938e36118875b3648fea39ccd6 Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Sat, 29 Oct 2005 02:07:57 +0400 Subject: [PATCH 09/11] sql_select.cc: After merge fix --- sql/sql_select.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 758167e9382..af2e5879b95 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1671,7 +1671,7 @@ JOIN::exec() { thd->proc_info="Sending data"; DBUG_PRINT("info", ("%s", thd->proc_info)); - result->send_fields(*curr_fields_list, + result->send_fields(*columns_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF); error= do_select(curr_join, curr_fields_list, NULL, procedure); thd->limit_found_rows= curr_join->send_records; @@ -9023,6 +9023,7 @@ do_select(JOIN *join,List *fields,TABLE *table,Procedure *procedure) int rc= 0; enum_nested_loop_state error= NESTED_LOOP_OK; JOIN_TAB *join_tab; + List *columns_list= procedure? &join->procedure_fields_list : fields; DBUG_ENTER("do_select"); join->procedure=procedure; From fd3a3c222432fb8b814bebcf86544eb4b9a2edcf Mon Sep 17 00:00:00 2001 From: "konstantin@mysql.com" <> Date: Sat, 29 Oct 2005 13:11:34 +0400 Subject: [PATCH 10/11] Minor comments. --- sql/sql_lex.h | 2 +- sql/table.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 88d34a81ea8..132a0491968 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -804,7 +804,7 @@ typedef struct st_lex /* A flag that indicates what kinds of derived tables are present in the query (0 if no derived tables, otherwise a combination of flags - DERIVED_SUBQUERY and DERIVED_VIEW. + DERIVED_SUBQUERY and DERIVED_VIEW). */ uint8 derived_tables; uint8 create_view_algorithm; diff --git a/sql/table.h b/sql/table.h index 84476670823..9e94c5fa2f6 100644 --- a/sql/table.h +++ b/sql/table.h @@ -550,13 +550,13 @@ typedef struct st_table_list */ st_table_list *referencing_view; /* - security context (non-zero only for tables which belong - to view with SQL SEQURITY DEFINER) + Security context (non-zero only for tables which belong + to view with SQL SECURITY DEFINER) */ Security_context *security_ctx; /* - this view security context (non-zero only for views with - SQL SEQURITY DEFINER) + This view security context (non-zero only for views with + SQL SECURITY DEFINER) */ Security_context *view_sctx; /* From 4ad3313cd7dc27a9d2186d0e2921110cd8efeed8 Mon Sep 17 00:00:00 2001 From: "sergefp@mysql.com" <> Date: Mon, 31 Oct 2005 09:22:33 +0300 Subject: [PATCH 11/11] BUG#14139 - Merge to 5.0 --- mysql-test/r/create.result | 4 +++- mysql-test/t/create.test | 1 + sql/field.h | 5 ++++- sql/item.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index c0c6acd2c70..1f8c6cb464d 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -645,10 +645,12 @@ create table t1 ( a varchar(112) charset utf8 collate utf8_bin not null, primary key (a) ) select 'test' as a ; +Warnings: +Warning 1364 Field 'a' doesn't have a default value show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(112) character set utf8 collate utf8_bin NOT NULL default '', + `a` varchar(112) character set utf8 collate utf8_bin NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index f461a092de1..67ad3058153 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -550,6 +550,7 @@ create table t1 ( a varchar(112) charset utf8 collate utf8_bin not null, primary key (a) ) select 'test' as a ; +--warning 1364 show create table t1; drop table t1; diff --git a/sql/field.h b/sql/field.h index 319316aad15..ed6bf1c0a9c 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1373,7 +1373,10 @@ public: max number of characters. */ ulong length; - ulong length; + /* + The value of 'length' before a call to create_length_to_internal_length + */ + uint32 chars_length; uint decimals, flags, pack_length, key_length; Field::utype unireg_check; TYPELIB *interval; // Which interval to use diff --git a/sql/item.h b/sql/item.h index 5bff285b9f3..2f753564009 100644 --- a/sql/item.h +++ b/sql/item.h @@ -526,6 +526,7 @@ public: double val_real_from_decimal(); virtual Field *get_tmp_table_field() { return 0; } + /* This is also used to create fields in CREATE ... SELECT: */ virtual Field *tmp_table_field(TABLE *t_arg) { return 0; } virtual const char *full_name() const { return name ? name : "???"; }