From dc692283ee3be74a7454475094d432f97d967999 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Jul 2006 14:22:39 +0500 Subject: [PATCH 01/17] bug #19452 (mysql_upgrade reads [client] section but doesn't handle [host] option client/mysql_upgrade.c: "client" group removed from the 'readlist' --- client/mysql_upgrade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 3288b627554..f73d3ea024e 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -65,7 +65,7 @@ static struct my_option my_long_options[]= }; static const char *load_default_groups[]= { - "mysql_upgrade", "client", 0 + "mysql_upgrade", 0 }; #include From 8e1162f830c3b7a19e8632ffc7e1a94a84e171c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 4 Jul 2006 12:56:53 +0500 Subject: [PATCH 02/17] bug #14807 (GeomFromText() should return MYSQL_TYPE_GEOMETRY) we didn't have code creating GEOMETRY-type fields from Items (expression results) So i added this code mysql-test/r/gis.result: test result fixed mysql-test/t/gis.test: testcase added sql/item_geofunc.cc: Item_geometry_func::tmp_table_field implemented sql/item_geofunc.h: tmp_table_field() and get_geometry_type() declared --- mysql-test/r/gis.result | 9 +++++++-- mysql-test/t/gis.test | 8 +++++++- sql/item_geofunc.cc | 28 ++++++++++++++++++++++++++++ sql/item_geofunc.h | 5 +++++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 7a0f689df36..0dd34c16268 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -574,11 +574,11 @@ INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)')); INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)')); INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)')); drop table t1; -create table t1 select POINT(1,3); +create table t1 select GeomFromWKB(POINT(1,3)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `POINT(1,3)` longblob NOT NULL + `GeomFromWKB(POINT(1,3))` geometry NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo` @@ -704,3 +704,8 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def asbinary(g) 252 8192 0 Y 128 0 63 asbinary(g) drop table t1; +create table t1 select GeomFromText('point(1 1)'); +desc t1; +Field Type Null Key Default Extra +GeomFromText('point(1 1)') geometry NO +drop table t1; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 4c6ff9b2fe7..7bba34be3ff 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -281,7 +281,7 @@ INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)')); INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)')); drop table t1; -create table t1 select POINT(1,3); +create table t1 select GeomFromWKB(POINT(1,3)); show create table t1; drop table t1; @@ -416,3 +416,9 @@ select * from t1; select asbinary(g) from t1; --disable_metadata drop table t1; + + +create table t1 select GeomFromText('point(1 1)'); +desc t1; +drop table t1; + diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 2b92e72e728..c5200e26cb7 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -25,6 +25,12 @@ #ifdef HAVE_SPATIAL #include +Field *Item_geometry_func::tmp_table_field(TABLE *t_arg) +{ + return new Field_geom(max_length, maybe_null, name, t_arg, + (Field::geometry_type) get_geometry_type()); +} + void Item_geometry_func::fix_length_and_dec() { collation.set(&my_charset_bin); @@ -32,6 +38,10 @@ void Item_geometry_func::fix_length_and_dec() max_length=MAX_BLOB_WIDTH; } +int Item_geometry_func::get_geometry_type() const +{ + return (int)Field::GEOM_GEOMETRY; +} String *Item_func_geometry_from_text::val_str(String *str) { @@ -152,6 +162,12 @@ String *Item_func_geometry_type::val_str(String *str) } +int Item_func_envelope::get_geometry_type() const +{ + return (int) Field::GEOM_POLYGON; +} + + String *Item_func_envelope::val_str(String *str) { DBUG_ASSERT(fixed == 1); @@ -176,6 +192,12 @@ String *Item_func_envelope::val_str(String *str) } +int Item_func_centroid::get_geometry_type() const +{ + return (int) Field::GEOM_POINT; +} + + String *Item_func_centroid::val_str(String *str) { DBUG_ASSERT(fixed == 1); @@ -310,6 +332,12 @@ err: */ +int Item_func_point::get_geometry_type() const +{ + return (int) Field::GEOM_POINT; +} + + String *Item_func_point::val_str(String *str) { DBUG_ASSERT(fixed == 1); diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 1f64fdba609..4848f59301d 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -33,6 +33,8 @@ public: Item_geometry_func(List &list) :Item_str_func(list) {} void fix_length_and_dec(); enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; } + Field *tmp_table_field(TABLE *t_arg); + virtual int get_geometry_type() const; }; class Item_func_geometry_from_text: public Item_geometry_func @@ -89,6 +91,7 @@ public: Item_func_centroid(Item *a): Item_geometry_func(a) {} const char *func_name() const { return "centroid"; } String *val_str(String *); + int get_geometry_type() const; }; class Item_func_envelope: public Item_geometry_func @@ -97,6 +100,7 @@ public: Item_func_envelope(Item *a): Item_geometry_func(a) {} const char *func_name() const { return "envelope"; } String *val_str(String *); + int get_geometry_type() const; }; class Item_func_point: public Item_geometry_func @@ -106,6 +110,7 @@ public: Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {} const char *func_name() const { return "point"; } String *val_str(String *); + int get_geometry_type() const; }; class Item_func_spatial_decomp: public Item_geometry_func From ff8f68d2d5d10d5415d32abeb81f560059dee4bc Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 11 Jul 2006 12:42:03 -0700 Subject: [PATCH 03/17] Bug #17485: mysql client crashes when connecting to the Instance Manager Using \U or \u in a prompt with the mysql command-line client could crash when connecting to the instance manager, since it does not return information about the user when asked by the client. This is fixed by having the client use what it knowns about the user (or giving up and saying "(unknown)"). client/mysql.cc: init_username() may not retrieve a username (such as from the instance manager), in which case we fall back to what was specified on the command line (or .cnf file) or finally (unknown). --- client/mysql.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 6fcda6d766f..f4abffaf445 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3623,12 +3623,14 @@ static const char* construct_prompt() case 'U': if (!full_username) init_username(); - processed_prompt.append(full_username); + processed_prompt.append(full_username ? full_username : + (current_user ? current_user : "(unknown)")); break; case 'u': if (!full_username) init_username(); - processed_prompt.append(part_username); + processed_prompt.append(part_username ? part_username : + (current_user ? current_user : "(unknown)")); break; case PROMPT_CHAR: processed_prompt.append(PROMPT_CHAR); From 812c9cc84acdde17da62a804c720f465ff72c292 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Jul 2006 12:30:22 -0700 Subject: [PATCH 04/17] Bug #12673: Instance Manager: allows to stop the instance many times The instance manager was not actually checking whether an instance was actually running before trying to stop it. Now it checks first. mysql-test/r/im_life_cycle.result: Add new results mysql-test/t/im_life_cycle.imtest: Add new regression test server-tools/instance-manager/instance.cc: Fix Instance::stop() to report ER_INSTANCE_IS_NOT_STARTED when that is the case. Also removed unnecessary goto. server-tools/instance-manager/messages.cc: Fix messages with missing spaces --- mysql-test/r/im_life_cycle.result | 3 ++ mysql-test/t/im_life_cycle.imtest | 8 ++++ server-tools/instance-manager/instance.cc | 53 ++++++++++++----------- server-tools/instance-manager/messages.cc | 6 +-- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/mysql-test/r/im_life_cycle.result b/mysql-test/r/im_life_cycle.result index a9f78aea7d3..211a82eb9cf 100644 --- a/mysql-test/r/im_life_cycle.result +++ b/mysql-test/r/im_life_cycle.result @@ -74,3 +74,6 @@ START INSTANCE mysqld1,mysqld2,mysqld3; ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use STOP INSTANCE mysqld1,mysqld2,mysqld3; ERROR 42000: You have an error in your command syntax. Check the manual that corresponds to your MySQL Instance Manager version for the right syntax to use +STOP INSTANCE mysqld2; +ERROR HY000: Cannot stop instance. Perhaps the instance is not started, or was started manually, so IM cannot find the pidfile. +End of 5.0 tests diff --git a/mysql-test/t/im_life_cycle.imtest b/mysql-test/t/im_life_cycle.imtest index 2cbe53a7b28..c3a5fb0a648 100644 --- a/mysql-test/t/im_life_cycle.imtest +++ b/mysql-test/t/im_life_cycle.imtest @@ -218,3 +218,11 @@ START INSTANCE mysqld1,mysqld2,mysqld3; --error ER_SYNTAX_ERROR STOP INSTANCE mysqld1,mysqld2,mysqld3; + +# +# Bug #12673: Instance Manager: allows to stop the instance many times +# +--error 3001 +STOP INSTANCE mysqld2; + +--echo End of 5.0 tests diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 39381b457ab..2ed369ba245 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -469,37 +469,38 @@ int Instance::stop() struct timespec timeout; uint waitchild= (uint) DEFAULT_SHUTDOWN_DELAY; - if (options.shutdown_delay_val) - waitchild= options.shutdown_delay_val; - - kill_instance(SIGTERM); - /* sleep on condition to wait for SIGCHLD */ - - timeout.tv_sec= time(NULL) + waitchild; - timeout.tv_nsec= 0; - if (pthread_mutex_lock(&LOCK_instance)) - goto err; - - while (options.get_pid() != 0) /* while server isn't stopped */ + if (is_running()) { - int status; + if (options.shutdown_delay_val) + waitchild= options.shutdown_delay_val; - status= pthread_cond_timedwait(&COND_instance_stopped, - &LOCK_instance, - &timeout); - if (status == ETIMEDOUT || status == ETIME) - break; + kill_instance(SIGTERM); + /* sleep on condition to wait for SIGCHLD */ + + timeout.tv_sec= time(NULL) + waitchild; + timeout.tv_nsec= 0; + if (pthread_mutex_lock(&LOCK_instance)) + return ER_STOP_INSTANCE; + + while (options.get_pid() != 0) /* while server isn't stopped */ + { + int status; + + status= pthread_cond_timedwait(&COND_instance_stopped, + &LOCK_instance, + &timeout); + if (status == ETIMEDOUT || status == ETIME) + break; + } + + pthread_mutex_unlock(&LOCK_instance); + + kill_instance(SIGKILL); + + return 0; } - pthread_mutex_unlock(&LOCK_instance); - - kill_instance(SIGKILL); - - return 0; - return ER_INSTANCE_IS_NOT_STARTED; -err: - return ER_STOP_INSTANCE; } #ifdef __WIN__ diff --git a/server-tools/instance-manager/messages.cc b/server-tools/instance-manager/messages.cc index a9b00b9e01f..d2595638de0 100644 --- a/server-tools/instance-manager/messages.cc +++ b/server-tools/instance-manager/messages.cc @@ -48,8 +48,8 @@ static const char *mysqld_error_message(unsigned sql_errno) case ER_BAD_INSTANCE_NAME: return "Bad instance name. Check that the instance with such a name exists"; case ER_INSTANCE_IS_NOT_STARTED: - return "Cannot stop instance. Perhaps the instance is not started, or was started" - "manually, so IM cannot find the pidfile."; + return "Cannot stop instance. Perhaps the instance is not started, or was" + " started manually, so IM cannot find the pidfile."; case ER_INSTANCE_ALREADY_STARTED: return "The instance is already started"; case ER_CANNOT_START_INSTANCE: @@ -67,7 +67,7 @@ static const char *mysqld_error_message(unsigned sql_errno) return "Cannot open log file"; case ER_GUESS_LOGFILE: return "Cannot guess the log filename. Try specifying full log name" - "in the instance options"; + " in the instance options"; case ER_ACCESS_OPTION_FILE: return "Cannot open the option file to edit. Check permissions"; default: From cbb65b525acc3847613a4e767a1991423c249bb4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Jul 2006 17:02:04 +0500 Subject: [PATCH 05/17] bug #20950 (mysql_upgrade looks for 'mysqlcheck' not for 'mysqlcheck.exe' on Windows. Code added to look for different names on Windows client/mysql_upgrade.c: added conditionally-compiled part to look for different names of tools on Windows --- client/mysql_upgrade.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 3288b627554..ce7eb8dd61b 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -17,6 +17,14 @@ #include "client_priv.h" #include +#ifdef __WIN__ +const char *mysqlcheck_name= "mysqlcheck.exe"; +const char *mysql_name= "mysql.exe"; +#else +const char *mysqlcheck_name= "mysqlcheck"; +const char *mysql_name= "mysql"; +#endif /*__WIN__*/ + static my_bool opt_force= 0, opt_verbose= 0, tty_password= 0; static char *user= (char*) "root", *basedir= 0, *datadir= 0, *opt_password= 0; static my_bool upgrade_defaults_created= 0; @@ -272,7 +280,7 @@ int main(int argc, char **argv) strmake(bindir_end, "/bin", sizeof(bindir) - (int) (bindir_end - bindir)-1); if (!test_file_exists_res - (bindir, "mysqlcheck", mysqlcheck_line, &mysqlcheck_end)) + (bindir, mysqlcheck_name, mysqlcheck_line, &mysqlcheck_end)) { printf("Can't find program '%s'\n", mysqlcheck_line); puts("Please restart with --basedir=mysql-install-directory"); @@ -342,7 +350,8 @@ int main(int argc, char **argv) goto err_exit; fix_priv_tables: - if (!test_file_exists_res(bindir, "mysql", fix_priv_tables_cmd, &fix_cmd_end)) + if (!test_file_exists_res(bindir, mysql_name, + fix_priv_tables_cmd, &fix_cmd_end)) { puts("Could not find MySQL command-line client (mysql)."); puts From 9955388a459cf976796372633497c783eafdf48b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Jul 2006 17:23:25 +0500 Subject: [PATCH 06/17] Bug#20543 select on information_schema strange warnings, view, different schemas/users The fix is: if user has privileges to view fields and user has any (insert,select,delete,update) privileges on underlying view then 'show fields' and select from I_S.COLUMNS table are sucsessful. mysql-test/r/information_schema_db.result: Bug#20543 select on information_schema strange warnings, view, different schemas/users test result mysql-test/t/information_schema_db.test: Bug#20543 select on information_schema strange warnings, view, different schemas/users test case sql/sql_acl.cc: Bug#20543 select on information_schema strange warnings, view, different schemas/users checked that user has privileges on underlying view and if it's true set allowed_show to true for top view. sql/sql_show.cc: Bug#20543 select on information_schema strange warnings, view, different schemas/users removed unnecessary rights check.'tables->allowed_show' check is used instead sql/sql_view.cc: Bug#20543 select on information_schema strange warnings, view, different schemas/users skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during execution of find_field_in_table_ref function. sql/table.h: Bug#20543 select on information_schema strange warnings, view, different schemas/users 'allowed_show' is set during rights check for view. If true then user has privileges for 'show create view', etc --- mysql-test/r/information_schema_db.result | 46 +++++++++++++++++++ mysql-test/t/information_schema_db.test | 56 +++++++++++++++++++++++ sql/sql_acl.cc | 15 ++++++ sql/sql_show.cc | 27 +++-------- sql/sql_view.cc | 3 +- sql/table.h | 1 + 6 files changed, 127 insertions(+), 21 deletions(-) diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 61a10c5f72c..381a773c1e3 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -97,3 +97,49 @@ v2 VIEW View 'test.v2' references invalid table(s) or column(s) or function(s) o drop function f1; drop function f2; drop view v1, v2; +create database testdb_1; +create user testdb_1@localhost; +grant all on testdb_1.* to testdb_1@localhost with grant option; +create user testdb_2@localhost; +grant all on test.* to testdb_2@localhost with grant option; +use testdb_1; +create table t1 (f1 char(4)); +create view v1 as select f1 from t1; +grant insert on v1 to testdb_2@localhost; +create table t3 (f1 char(4), f2 char(4)); +create view v3 as select f1,f2 from t3; +grant insert(f1), insert(f2) on v3 to testdb_2@localhost; +create view v2 as select f1 from testdb_1.v1; +create view v4 as select f1,f2 from testdb_1.v3; +revoke insert(f1) on v3 from testdb_2@localhost; +show create view v4; +ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show fields from v4; +ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table +show fields from v2; +Field Type Null Key Default Extra +f1 char(4) YES NULL +show fields from testdb_1.v1; +Field Type Null Key Default Extra +f1 char(4) YES NULL +show create view v2; +View Create View +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1` +show create view testdb_1.v1; +ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1' +select table_name from information_schema.columns a +where a.table_name = 'v2'; +table_name +v2 +select view_definition from information_schema.views a +where a.table_name = 'v2'; +view_definition +/* ALGORITHM=UNDEFINED */ select `v1`.`f1` AS `f1` from `testdb_1`.`v1` +select view_definition from information_schema.views a +where a.table_name = 'testdb_1.v1'; +view_definition +select * from v2; +ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them +drop view testdb_1.v1,v2, testdb_1.v3, v4; +drop database testdb_1; +drop user testdb_1@localhost; diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test index 2cfa766d799..83ba046423b 100644 --- a/mysql-test/t/information_schema_db.test +++ b/mysql-test/t/information_schema_db.test @@ -98,3 +98,59 @@ where table_schema='test'; drop function f1; drop function f2; drop view v1, v2; + +# +# Bug#20543: select on information_schema strange warnings, view, different +# schemas/users +# +# +create database testdb_1; +create user testdb_1@localhost; +grant all on testdb_1.* to testdb_1@localhost with grant option; + +create user testdb_2@localhost; +grant all on test.* to testdb_2@localhost with grant option; + +connect (testdb_1,localhost,testdb_1,,test); +use testdb_1; +create table t1 (f1 char(4)); +create view v1 as select f1 from t1; +grant insert on v1 to testdb_2@localhost; + +create table t3 (f1 char(4), f2 char(4)); +create view v3 as select f1,f2 from t3; +grant insert(f1), insert(f2) on v3 to testdb_2@localhost; + +connect (testdb_2,localhost,testdb_2,,test); +create view v2 as select f1 from testdb_1.v1; +create view v4 as select f1,f2 from testdb_1.v3; + +connection testdb_1; +revoke insert(f1) on v3 from testdb_2@localhost; +connection testdb_2; + +--error 1345 +show create view v4; +--error 1345 +show fields from v4; + +show fields from v2; +show fields from testdb_1.v1; +show create view v2; +--error 1142 +show create view testdb_1.v1; + +select table_name from information_schema.columns a +where a.table_name = 'v2'; +select view_definition from information_schema.views a +where a.table_name = 'v2'; +select view_definition from information_schema.views a +where a.table_name = 'testdb_1.v1'; + +--error 1356 +select * from v2; + +connection default; +drop view testdb_1.v1,v2, testdb_1.v3, v4; +drop database testdb_1; +drop user testdb_1@localhost; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ae5ea210a47..6e25878671d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3787,9 +3787,24 @@ bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref, if (table_ref->view || table_ref->field_translation) { /* View or derived information schema table. */ + ulong view_privs; grant= &(table_ref->grant); db_name= table_ref->view_db.str; table_name= table_ref->view_name.str; + if (table_ref->belong_to_view && + (thd->lex->sql_command == SQLCOM_SHOW_FIELDS || + thd->lex->sql_command == SQLCOM_SHOW_CREATE)) + { + view_privs= get_column_grant(thd, grant, db_name, table_name, name); + if (view_privs & VIEW_ANY_ACL) + { + table_ref->belong_to_view->allowed_show= TRUE; + return FALSE; + } + table_ref->belong_to_view->allowed_show= FALSE; + my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0)); + return TRUE; + } } else { diff --git a/sql/sql_show.cc b/sql/sql_show.cc index cabb04c5f16..6e78596d679 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3110,31 +3110,18 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, if (tables->view) { Security_context *sctx= thd->security_ctx; - ulong grant= SHOW_VIEW_ACL; -#ifndef NO_EMBEDDED_ACCESS_CHECKS - char *save_table_name= tables->table_name; - if (!my_strcasecmp(system_charset_info, tables->definer.user.str, - sctx->priv_user) && - !my_strcasecmp(system_charset_info, tables->definer.host.str, - sctx->priv_host)) - grant= SHOW_VIEW_ACL; - else + if (!tables->allowed_show) { - tables->table_name= tables->view_name.str; - if (check_access(thd, SHOW_VIEW_ACL , base_name, - &tables->grant.privilege, 0, 1, - test(tables->schema_table))) - grant= get_table_grant(thd, tables); - else - grant= tables->grant.privilege; + if (!my_strcasecmp(system_charset_info, tables->definer.user.str, + sctx->priv_user) && + !my_strcasecmp(system_charset_info, tables->definer.host.str, + sctx->priv_host)) + tables->allowed_show= TRUE; } - tables->table_name= save_table_name; -#endif - restore_record(table, s->default_values); table->field[1]->store(tables->view_db.str, tables->view_db.length, cs); table->field[2]->store(tables->view_name.str, tables->view_name.length, cs); - if (grant & SHOW_VIEW_ACL) + if (tables->allowed_show) { char buff[2048]; String qwe_str(buff, sizeof(buff), cs); diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 1561ade78af..90a6cba53f4 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -934,7 +934,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table) } } else if (!table->prelocking_placeholder && - old_lex->sql_command == SQLCOM_SHOW_CREATE) + old_lex->sql_command == SQLCOM_SHOW_CREATE && + !table->belong_to_view) { if (check_table_access(thd, SHOW_VIEW_ACL, table, 0)) goto err; diff --git a/sql/table.h b/sql/table.h index eb34867c390..41ab7e7bec8 100644 --- a/sql/table.h +++ b/sql/table.h @@ -569,6 +569,7 @@ typedef struct st_table_list tables. Unlike 'next_local', this in this list views are *not* leaves. Created in setup_tables() -> make_leaves_list(). */ + bool allowed_show; st_table_list *next_leaf; Item *where; /* VIEW WHERE clause condition */ Item *check_option; /* WITH CHECK OPTION condition */ From 3aa28a1202894e4af377b57b403d98f1df55411c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Jul 2006 12:47:01 +0500 Subject: [PATCH 07/17] N'xxx' and _utf8'xxx' are not equivalent Problem: Unescaping of '\' characters didn't work when processing N'xxx'. Fix: using get_text() instead of get_token() when scanning nationa strings. mysql-test/r/ctype_utf8.result: Adding test case mysql-test/t/ctype_utf8.test: Adding test case sql/sql_lex.cc: Fixing to process national strings using get_tex(), i.e. the same way with usual strings, to make unescaping work. --- mysql-test/r/ctype_utf8.result | 12 ++++++++++++ mysql-test/t/ctype_utf8.test | 11 +++++++++++ sql/sql_lex.cc | 21 +++++++++------------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 934f56877ac..aa87bfee6a7 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1066,6 +1066,18 @@ LENGTH(bug) 100 DROP TABLE t2; DROP TABLE t1; +CREATE TABLE t1 (item varchar(255)) default character set utf8; +INSERT INTO t1 VALUES (N'\\'); +INSERT INTO t1 VALUES (_utf8'\\'); +INSERT INTO t1 VALUES (N'Cote d\'Ivoire'); +INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire'); +SELECT item FROM t1 ORDER BY item; +item +Cote d'Ivoire +Cote d'Ivoire +\ +\ +DROP TABLE t1; SET NAMES utf8; DROP TABLE IF EXISTS t1; Warnings: diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 77b76a14171..a3dc781de6a 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -878,6 +878,17 @@ SELECT LENGTH(bug) FROM t2; DROP TABLE t2; DROP TABLE t1; +# +# Bug#17313: N'xxx' and _utf8'xxx' are not equivalent +# +CREATE TABLE t1 (item varchar(255)) default character set utf8; +INSERT INTO t1 VALUES (N'\\'); +INSERT INTO t1 VALUES (_utf8'\\'); +INSERT INTO t1 VALUES (N'Cote d\'Ivoire'); +INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire'); +SELECT item FROM t1 ORDER BY item; +DROP TABLE t1; + # # Bug#17705: Corruption of compressed index when index length changes between # 254 and 256 diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7d4dca15608..5a355cedca5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -557,23 +557,20 @@ int MYSQLlex(void *arg, void *yythd) case MY_LEX_IDENT_OR_NCHAR: if (yyPeek() != '\'') - { // Found x'hex-number' + { state= MY_LEX_IDENT; break; } - yyGet(); // Skip ' - while ((c = yyGet()) && (c !='\'')) ; - length=(lex->ptr - lex->tok_start); // Length of hexnum+3 - if (c != '\'') + /* Found N'string' */ + lex->tok_start++; // Skip N + yySkip(); // Skip ' + if (!(yylval->lex_str.str = get_text(lex))) { - return(ABORT_SYM); // Illegal hex constant + state= MY_LEX_CHAR; // Read char by char + break; } - yyGet(); // get_token makes an unget - yylval->lex_str=get_token(lex,length); - yylval->lex_str.str+=2; // Skip x' - yylval->lex_str.length-=3; // Don't count x' and last ' - lex->yytoklen-=3; - return (NCHAR_STRING); + yylval->lex_str.length= lex->yytoklen; + return(NCHAR_STRING); case MY_LEX_IDENT_OR_HEX: if (yyPeek() == '\'') From 29e946ee5a6589755125153dfa1062c27e70a817 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Aug 2006 21:18:58 +0200 Subject: [PATCH 08/17] lowercase_fs_off fails on windows because lower_case_file_system is not being set properly. This patch should fix that. mysqld.cc: Call test_if_case_insensitive in all cases so lower_case_file_system always gets set sql/mysqld.cc: Call test_if_case_insensitive in all cases so lower_case_file_system always gets set --- sql/mysqld.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 786a1ea4f4c..12b445985b8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2738,9 +2738,8 @@ static int init_common_variables(const char *conf_file_name, int argc, get corrupted if accesses with names of different case. */ DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names)); - if (!lower_case_table_names && - (lower_case_file_system= - (test_if_case_insensitive(mysql_real_data_home) == 1))) + lower_case_file_system= test_if_case_insensitive(mysql_real_data_home); + if (!lower_case_table_names && lower_case_file_system == 1) { if (lower_case_table_names_used) { From 46ed9d0b671660b2ca1d9558134344962ed8105f Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Aug 2006 23:15:23 +0200 Subject: [PATCH 09/17] mysql_client_test.c: Moving call that processes select results out of the assert tests/mysql_client_test.c: Moving call that processes select results out of the assert --- tests/mysql_client_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e4b2374a698..0b94b482b7a 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11226,6 +11226,7 @@ static void test_view_insert() for (i= 0; i < 3; i++) { + int rowcount= 0; my_val= i; rc= mysql_stmt_execute(insert_stmt); @@ -11233,7 +11234,8 @@ static void test_view_insert() rc= mysql_stmt_execute(select_stmt); check_execute(select_stmt, rc); - assert(i + 1 == (int) my_process_stmt_result(select_stmt)); + rowcount= (int)my_process_stmt_result(select_stmt); + assert((i+1) == rowcount); } mysql_stmt_close(insert_stmt); mysql_stmt_close(select_stmt); From 5efe5fd82058b3e5a3e08f451f67c7d4d1ee7b32 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 5 Aug 2006 18:58:38 -0500 Subject: [PATCH 10/17] please don't call methods that should always execute inside assert() tests/mysql_client_test.c: fixed lines that are executing methods that should always execute inside assert() --- tests/mysql_client_test.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 0b94b482b7a..2463840bd0c 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -10996,7 +10996,8 @@ static void test_view() { rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert(1 == my_process_stmt_result(stmt)); + rc= my_process_stmt_result(stmt); + assert(1 == rc); } mysql_stmt_close(stmt); @@ -11038,7 +11039,8 @@ static void test_view_where() { rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert(4 == my_process_stmt_result(stmt)); + rc= my_process_stmt_result(stmt); + assert(4 == rc); } mysql_stmt_close(stmt); @@ -11120,7 +11122,8 @@ static void test_view_2where() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert(0 == my_process_stmt_result(stmt)); + rc= my_process_stmt_result(stmt); + assert(0 == rc); mysql_stmt_close(stmt); @@ -11172,7 +11175,8 @@ static void test_view_star() { rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert(0 == my_process_stmt_result(stmt)); + rc= my_process_stmt_result(stmt); + assert(0 == rc); } mysql_stmt_close(stmt); @@ -11275,7 +11279,8 @@ static void test_left_join_view() { rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert(3 == my_process_stmt_result(stmt)); + rc= my_process_stmt_result(stmt); + assert(3 == rc); } mysql_stmt_close(stmt); @@ -11350,7 +11355,8 @@ static void test_view_insert_fields() check_execute(stmt, rc); rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - assert(1 == my_process_stmt_result(stmt)); + rc= my_process_stmt_result(stmt); + assert(1 == rc); mysql_stmt_close(stmt); rc= mysql_query(mysql, "DROP VIEW v1"); From 86a239f5558ee0f5a333e8e8121922b7f3e28535 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Aug 2006 11:56:22 +0500 Subject: [PATCH 11/17] information_schema_db.test fixed mysql-test/t/information_schema_db.test: user dropped --- mysql-test/t/information_schema_db.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test index 83ba046423b..4dfe1ad56b5 100644 --- a/mysql-test/t/information_schema_db.test +++ b/mysql-test/t/information_schema_db.test @@ -154,3 +154,4 @@ connection default; drop view testdb_1.v1,v2, testdb_1.v3, v4; drop database testdb_1; drop user testdb_1@localhost; +drop user testdb_2@localhost; From 1cf5669955ff187724c561f4ba3dbbb360696148 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Aug 2006 12:50:05 +0500 Subject: [PATCH 12/17] result fix --- mysql-test/r/information_schema_db.result | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 381a773c1e3..40773a7afc1 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -143,3 +143,4 @@ ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function drop view testdb_1.v1,v2, testdb_1.v3, v4; drop database testdb_1; drop user testdb_1@localhost; +drop user testdb_2@localhost; From 3bb35e0cbabc167e71dbdc54ed16253f919415ca Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Aug 2006 13:34:27 +0500 Subject: [PATCH 13/17] bug #20910 (NOT NULL reported as NULL for TIMESTAMP) we intentionally reported that for TIMESTAMPS, which isn't right mysql-test/r/type_timestamp.result: result fixed mysql-test/t/type_timestamp.test: testcase added sql/sql_show.cc: remove the check for TIMESTAMP type - all types will report 'NO' if they're defined as NOT NULL --- mysql-test/r/type_timestamp.result | 33 ++++++++++++++++++++++-------- mysql-test/t/type_timestamp.test | 11 ++++++++++ sql/sql_show.cc | 4 +--- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 0817cc3b6c7..445ada578d0 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -201,9 +201,9 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES 2003-01-01 00:00:00 +t1 timestamp NO 2003-01-01 00:00:00 t2 datetime YES NULL -t3 timestamp YES 0000-00-00 00:00:00 +t3 timestamp NO 0000-00-00 00:00:00 drop table t1; create table t1 (t1 timestamp default now(), t2 datetime, t3 timestamp); SET TIMESTAMP=1000000002; @@ -225,9 +225,9 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp NO CURRENT_TIMESTAMP t2 datetime YES NULL -t3 timestamp YES 0000-00-00 00:00:00 +t3 timestamp NO 0000-00-00 00:00:00 drop table t1; create table t1 (t1 timestamp default '2003-01-01 00:00:00' on update now(), t2 datetime); SET TIMESTAMP=1000000004; @@ -251,7 +251,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES 2003-01-01 00:00:00 +t1 timestamp NO 2003-01-01 00:00:00 t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp default now() on update now(), t2 datetime); @@ -276,7 +276,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp NO CURRENT_TIMESTAMP t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp, t2 datetime, t3 timestamp); @@ -302,9 +302,9 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp NO CURRENT_TIMESTAMP t2 datetime YES NULL -t3 timestamp YES 0000-00-00 00:00:00 +t3 timestamp NO 0000-00-00 00:00:00 drop table t1; create table t1 (t1 timestamp default current_timestamp on update current_timestamp, t2 datetime); SET TIMESTAMP=1000000009; @@ -328,7 +328,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp YES CURRENT_TIMESTAMP +t1 timestamp NO CURRENT_TIMESTAMP t2 datetime YES NULL delete from t1; insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00'); @@ -493,3 +493,18 @@ a b c 6 NULL 2006-06-06 06:06:06 drop table t1; set time_zone= @@global.time_zone; +CREATE TABLE t1 ( +`id` int(11) NOT NULL auto_increment, +`username` varchar(80) NOT NULL default '', +`posted_on` timestamp NOT NULL default '0000-00-00 00:00:00', +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; +show fields from t1; +Field Type Null Key Default Extra +id int(11) NO PRI NULL auto_increment +username varchar(80) NO +posted_on timestamp NO 0000-00-00 00:00:00 +select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on'; +is_nullable +NO +drop table t1; diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index ddfc3f11665..7b4af9e0c69 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -328,3 +328,14 @@ drop table t1; # Restore timezone to default set time_zone= @@global.time_zone; + +CREATE TABLE t1 ( +`id` int(11) NOT NULL auto_increment, +`username` varchar(80) NOT NULL default '', +`posted_on` timestamp NOT NULL default '0000-00-00 00:00:00', +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; + +show fields from t1; +select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on'; +drop table t1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 433238cb853..eb78f4fbdae 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2713,9 +2713,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, table->field[5]->store("",0, cs); table->field[5]->set_notnull(); } - pos=(byte*) ((flags & NOT_NULL_FLAG) && - field->type() != FIELD_TYPE_TIMESTAMP ? - "NO" : "YES"); + pos=(byte*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES"); table->field[6]->store((const char*) pos, strlen((const char*) pos), cs); is_blob= (field->type() == FIELD_TYPE_BLOB); From 9672ef612e9d3362e6b9d6b29d77125cea6cc9b3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Aug 2006 14:40:07 +0500 Subject: [PATCH 14/17] Bug#16172 DECIMAL data type processed incorrectly issue an error in case of DECIMAL(M,N) if N > M mysql-test/r/type_newdecimal.result: Bug#16172 DECIMAL data type processed incorrectly result fix & test case mysql-test/t/type_newdecimal.test: Bug#16172 DECIMAL data type processed incorrectly test fix --- mysql-test/r/type_newdecimal.result | 6 +++++- mysql-test/t/type_newdecimal.test | 8 ++++++-- sql/item_create.cc | 9 ++++++++- sql/sql_yacc.yy | 4 ++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 4caec152a1f..33f1ece0390 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -915,9 +915,13 @@ drop table t1; select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)); cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15)) 0.000000000100000 -select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3; +select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3; c1 c2 c3 9.5468126085974 9.547 9.547 +select convert(ln(14000),decimal(2,3)) c1; +ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column ''). +select cast(ln(14000) as decimal(2,3)) c1; +ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column ''). create table t1 (sl decimal(70,30)); ERROR 42000: Too big precision 70 specified for column 'sl'. Maximum is 65. create table t1 (sl decimal(32,31)); diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 35aff8b3c5a..de1ebd74d17 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -947,8 +947,12 @@ select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(3 # # Bug #11708 (conversion to decimal fails in decimal part) # -select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3; - +select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3; +--error 1427 +select convert(ln(14000),decimal(2,3)) c1; +--error 1427 +select cast(ln(14000) as decimal(2,3)) c1; + # # Bug #8449 (Silent column changes) # diff --git a/sql/item_create.cc b/sql/item_create.cc index 7d57757432e..e0e18094705 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -450,6 +450,7 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec, CHARSET_INFO *cs) { Item *res; + int tmp_len; LINT_INIT(res); switch (cast_type) { @@ -460,7 +461,13 @@ Item *create_func_cast(Item *a, Cast_target cast_type, int len, int dec, case ITEM_CAST_TIME: res= new Item_time_typecast(a); break; case ITEM_CAST_DATETIME: res= new Item_datetime_typecast(a); break; case ITEM_CAST_DECIMAL: - res= new Item_decimal_typecast(a, (len>0) ? len : 10, dec ? dec : 2); + tmp_len= (len>0) ? len : 10; + if (tmp_len < dec) + { + my_error(ER_M_BIGGER_THAN_D, MYF(0), ""); + return 0; + } + res= new Item_decimal_typecast(a, tmp_len, dec ? dec : 2); break; case ITEM_CAST_CHAR: res= new Item_char_typecast(a, len, cs ? cs : diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 5d0a583f7d1..d2aca27c836 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4359,6 +4359,8 @@ simple_expr: lex->length ? atoi(lex->length) : -1, lex->dec ? atoi(lex->dec) : 0, lex->charset); + if (!$$) + YYABORT; } | CASE_SYM opt_expr WHEN_SYM when_list opt_else END { $$= new Item_func_case(* $4, $2, $5 ); } @@ -4368,6 +4370,8 @@ simple_expr: Lex->length ? atoi(Lex->length) : -1, Lex->dec ? atoi(Lex->dec) : 0, Lex->charset); + if (!$$) + YYABORT; } | CONVERT_SYM '(' expr USING charset_name ')' { $$= new Item_func_conv_charset($3,$5); } From e12d87e194e068ef5c2a3df730d376b5f7a2a34d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Aug 2006 14:50:54 +0500 Subject: [PATCH 15/17] bug #20910 (NOT NULL column reported as NULL in SHOW FIELDS) two test results changed after the patch mysql-test/r/grant.result: result fixed mysql-test/r/type_ranges.result: result fixed --- mysql-test/r/grant.result | 2 +- mysql-test/r/type_ranges.result | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 3f3325354ee..955af24a2aa 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -525,7 +525,7 @@ Db char(64) NO PRI User char(16) NO PRI Table_name char(64) NO PRI Grantor char(77) NO MUL -Timestamp timestamp YES CURRENT_TIMESTAMP +Timestamp timestamp NO CURRENT_TIMESTAMP Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') NO Column_priv set('Select','Insert','Update','References') NO use test; diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index ec8211dc4bf..e949d734944 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -57,7 +57,7 @@ ushort smallint(5) unsigned zerofill NULL NO MUL 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL YES CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO CURRENT_TIMESTAMP # date_field date NULL YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -229,7 +229,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL YES CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO CURRENT_TIMESTAMP # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -255,7 +255,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO 0 # ulong int(11) unsigned NULL NO 0 # ulonglong bigint(13) unsigned NULL NO 0 # -time_stamp timestamp NULL YES 0000-00-00 00:00:00 # +time_stamp timestamp NULL NO 0000-00-00 00:00:00 # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # From f78ffbf96cf4983acb83cd2ecc73b2db976488ce Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Aug 2006 17:39:01 -0500 Subject: [PATCH 16/17] Some small cleanups that will help get mysql_client_test passing on Windows tests/mysql_client_test.c: set sql_mode to '' in a few places explicitly select myisam table type for fulltext use memcpy instead of strcpy since our src buffer is not zero terminated. --- tests/mysql_client_test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 2463840bd0c..a1208521e8d 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -3976,6 +3976,7 @@ static void test_fetch_date() c7 timestamp(6))"); myquery(rc); + rc= mysql_query(mysql, "SET SQL_MODE=''"); rc= mysql_query(mysql, "INSERT INTO test_bind_result VALUES('2002-01-02', \ '12:49:00', \ '2002-01-02 17:46:59', \ @@ -8350,6 +8351,7 @@ static void test_bug19671() int rc; myheader("test_bug19671"); + mysql_query(mysql, "set sql_mode=''"); rc= mysql_query(mysql, "drop table if exists t1"); myquery(rc); @@ -8920,7 +8922,7 @@ static void test_bug1500() rc= mysql_query(mysql, "DROP TABLE test_bg1500"); myquery(rc); - rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s))"); + rc= mysql_query(mysql, "CREATE TABLE test_bg1500 (s VARCHAR(25), FULLTEXT(s)) engine=MyISAM"); myquery(rc); rc= mysql_query(mysql, @@ -12020,6 +12022,7 @@ static void test_bug6096() rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); myquery(rc); + mysql_query(mysql, "set sql_mode=''"); stmt_text= "create table t1 (c_tinyint tinyint, c_smallint smallint, " " c_mediumint mediumint, c_int int, " " c_bigint bigint, c_float float, " @@ -12904,7 +12907,9 @@ static void test_bug8378() /* No escaping should have actually happened. */ DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0); - sprintf(buf, "SELECT '%s'", out); + strcpy(buf, "SELECT '"); + memcpy(buf+8, out, len); + buf[8+len] = '\''; rc=mysql_real_query(mysql, buf, strlen(buf)); myquery(rc); From cabca09fe585223fc5e7b65cd67d27d79d559b64 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Aug 2006 20:48:37 +0200 Subject: [PATCH 17/17] My previous change of replacing the call to sprintf with some memcpy type routines was not correct. This patch reverts that. mysql_client_test.c: reverting my previous change tests/mysql_client_test.c: reverting my previous change --- tests/mysql_client_test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index a1208521e8d..8a8aae01dab 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -12907,9 +12907,8 @@ static void test_bug8378() /* No escaping should have actually happened. */ DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0); - strcpy(buf, "SELECT '"); - memcpy(buf+8, out, len); - buf[8+len] = '\''; + sprintf(buf, "SELECT '%s'", out); + rc=mysql_real_query(mysql, buf, strlen(buf)); myquery(rc);