From bfdc0cdcff7c4e4005fec1887596a6f8c95a1fb3 Mon Sep 17 00:00:00 2001 From: "holyfoot@deer.(none)" <> Date: Mon, 3 Jul 2006 14:22:39 +0500 Subject: [PATCH 01/68] bug #19452 (mysql_upgrade reads [client] section but doesn't handle [host] option --- 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 4b48b356807abfe523e2fce2c6fdfc54cd32e768 Mon Sep 17 00:00:00 2001 From: "holyfoot@deer.(none)" <> Date: Tue, 4 Jul 2006 12:56:53 +0500 Subject: [PATCH 02/68] 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 | 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 b176870cf6e1413001652631c0658a9cf9089e48 Mon Sep 17 00:00:00 2001 From: "petr/cps@mysql.com/owlet." <> Date: Tue, 11 Jul 2006 15:54:52 +0400 Subject: [PATCH 03/68] Fix Bug#15205 "Select from CSV table without the datafile causes crash" --- mysql-test/r/csv.result | 10 ++++++++++ mysql-test/t/csv.test | 24 ++++++++++++++++++++++++ sql/examples/ha_tina.cc | 13 ++++++++----- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 3c87c1f4b92..f3e91a663b8 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5000,3 +5000,13 @@ insert t1 values (1),(2),(3),(4),(5); truncate table t1; affected rows: 0 drop table t1; +create table bug15205 (val int(11) default null) engine=csv; +create table bug15205_2 (val int(11) default null) engine=csv; +select * from bug15205; +ERROR HY000: Got error 1 from storage engine +select * from bug15205_2; +val +select * from bug15205; +val +drop table bug15205; +drop table bug15205_2; diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index a028f6ced6d..8bd48b7da2c 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1384,3 +1384,27 @@ truncate table t1; -- truncate --disable_info drop table t1; +# +# Bug #15205 Select from CSV table without the datafile causes crash +# +# NOTE: the bug is not deterministic + +# The crash happens because the necessary cleanup after an error wasn't +# performed. Namely, the table share, inserted in the hash during table +# open, was not deleted from hash. At the same time the share was freed +# when an error was encountered. Thus, subsequent access to the hash +# resulted in scanning through deleted memory and we were geting a crash. +# that's why we need two tables in the bugtest + +create table bug15205 (val int(11) default null) engine=csv; +create table bug15205_2 (val int(11) default null) engine=csv; +--exec rm $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV +# system error (can't open the datafile) +--error ER_GET_ERRNO +select * from bug15205; +select * from bug15205_2; +--exec touch $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV +select * from bug15205; +drop table bug15205; +drop table bug15205_2; + diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 8ae82f97d0b..ebddfc244b8 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -184,16 +184,18 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) share->table_name_length=length; share->table_name=tmp_name; strmov(share->table_name,table_name); - fn_format(data_file_name, table_name, "", ".CSV",MY_REPLACE_EXT|MY_UNPACK_FILENAME); + fn_format(data_file_name, table_name, "", ".CSV", + MY_REPLACE_EXT | MY_UNPACK_FILENAME); + + if ((share->data_file= my_open(data_file_name, O_RDWR|O_APPEND, + MYF(0))) == -1) + goto error; + if (my_hash_insert(&tina_open_tables, (byte*) share)) goto error; thr_lock_init(&share->lock); pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST); - if ((share->data_file= my_open(data_file_name, O_RDWR|O_APPEND, - MYF(0))) == -1) - goto error2; - /* We only use share->data_file for writing, so we scan to the end to append */ if (my_seek(share->data_file, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR) goto error2; @@ -212,6 +214,7 @@ error3: error2: thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); + hash_delete(&tina_open_tables, (byte*) share); error: pthread_mutex_unlock(&tina_mutex); my_free((gptr) share, MYF(0)); From 9a2a3c6edf3bb462a1456adf1fd7f929b4daf5d7 Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Tue, 11 Jul 2006 12:42:03 -0700 Subject: [PATCH 04/68] 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 | 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 a34f37acdda440322d0b296fa24e17a8b7e29391 Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Wed, 12 Jul 2006 12:30:22 -0700 Subject: [PATCH 05/68] 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 | 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 1f064174a47a2f1aa55494e38c86c40a36484984 Mon Sep 17 00:00:00 2001 From: "holyfoot/hf@mysql.com/deer.(none)" <> Date: Fri, 21 Jul 2006 17:02:04 +0500 Subject: [PATCH 06/68] 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 | 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 36a26abd8f912c18efba651ad4d6f6f99747af15 Mon Sep 17 00:00:00 2001 From: "jimw@rama.(none)" <> Date: Mon, 24 Jul 2006 16:45:26 -0700 Subject: [PATCH 07/68] Bug #10668: CREATE USER does not enforce username length limit This appears to have just been an oversight -- CREATE USER was not enforcing the existing username limitations. --- mysql-test/r/grant.result | 3 +++ mysql-test/t/grant.test | 6 ++++++ sql/sql_acl.cc | 11 ++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 3f3325354ee..bb69202f1df 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -867,3 +867,6 @@ insert into mysql.user select * from t2; flush privileges; drop table t2; drop table t1; +create user mysqltest1_thisisreallytoolong; +ERROR HY000: Operation CREATE USER failed for 'mysqltest1_thisisreallytoolong'@'%' +End of 5.0 tests diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index a9d52f559ca..d025709cc21 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -680,4 +680,10 @@ drop table t2; drop table t1; +# +# Bug #10668: CREATE USER does not enforce username length limit +# +--error ER_CANNOT_USER +create user mysqltest1_thisisreallytoolong; +--echo End of 5.0 tests diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ae5ea210a47..3735f4403de 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -5220,7 +5220,16 @@ bool mysql_create_user(THD *thd, List &list) { result= TRUE; continue; - } + } + + if (user_name->host.length > HOSTNAME_LENGTH || + user_name->user.length > USERNAME_LENGTH) + { + append_user(&wrong_users, user_name); + result= TRUE; + continue; + } + /* Search all in-memory structures and grant tables for a mention of the new user name. From e47b22c6a2d73788d912fffcd3ab7454225a2850 Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/gluh.(none)" <> Date: Tue, 25 Jul 2006 17:23:25 +0500 Subject: [PATCH 08/68] 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 | 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 d19cd9382eb805da4bd59587e5162a56be790191 Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Tue, 25 Jul 2006 17:27:53 +0500 Subject: [PATCH 09/68] Bug#19741 segfault with cp1250 charset + like + primary key + 64bit os LIKE craashed with a pattern having letters in the range 128..255 (e.g. A WITH ACUTE or C WITH CARON) because of wrong cast from signed char to unsigned int. --- mysql-test/r/ctype_cp1250_ch.result | 8 ++++++++ mysql-test/t/ctype_cp1250_ch.test | 10 ++++++++++ strings/ctype-win1250ch.c | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index 533bfb8cb53..b55849e4e12 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -42,3 +42,11 @@ id str 6 aaaaaa 7 aaaaaaa drop table t1; +set names cp1250; +create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a)); +insert into t1 values("abcdefghá"); +insert into t1 values("ááèè"); +select a from t1 where a like "abcdefghá"; +a +abcdefghá +drop table t1; diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test index 2d1e5f0bf9d..65550e0c193 100644 --- a/mysql-test/t/ctype_cp1250_ch.test +++ b/mysql-test/t/ctype_cp1250_ch.test @@ -44,4 +44,14 @@ INSERT INTO t1 VALUES (NULL, 'aaaaaaa'); select * from t1 where str like 'aa%'; drop table t1; +# +# Bug#19741 segfault with cp1250 charset + like + primary key + 64bit os +# +set names cp1250; +create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a)); +insert into t1 values("abcdefghá"); +insert into t1 values("ááèè"); +select a from t1 where a like "abcdefghá"; +drop table t1; + # End of 4.1 tests diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index e936ef1d423..b03bbbc155c 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -634,11 +634,11 @@ my_like_range_win1250ch(CHARSET_INFO *cs __attribute__((unused)), ptr++; /* Skip escape */ else if (*ptr == w_one || *ptr == w_many) /* '_' or '%' in SQL */ break; - *min_str = like_range_prefix_min_win1250ch[(uint)(*ptr)]; + *min_str = like_range_prefix_min_win1250ch[(uint) (uchar) (*ptr)]; if (*min_str != min_sort_char) only_min_found= 0; min_str++; - *max_str++ = like_range_prefix_max_win1250ch[(uint)(*ptr)]; + *max_str++ = like_range_prefix_max_win1250ch[(uint) (uchar) (*ptr)]; } *min_length = (uint) (min_str - min_org); From cf8b64a114b895769f077050212a61c9a90dd46b Mon Sep 17 00:00:00 2001 From: "pgalbraith/patg@buffy.netfrastructure.com" <> Date: Tue, 25 Jul 2006 18:38:09 -0400 Subject: [PATCH 10/68] BUG #15133 "unique index with nullable value not accepted in federated table" Added HA_NULL_IN_KEY to table flags to allow for nullable unique indexes and added test to verify ha_federated.h: BUG #15133 "unique index with nullable value not accepted in federated table" added HA_NULL_IN_KEY to table flags to allow for nullable unique indexes federated.test: BUG #15133 "unique index with nullable value not accepted in federated table" New test to show that nullable unique indexes work federated.result: BUG #15133 "unique index with nullable value not accepted in federated table" New results for new test --- mysql-test/r/federated.result | 27 +++++++++++++++++++++ mysql-test/t/federated.test | 45 +++++++++++++++++++++++++++++++++++ sql/ha_federated.h | 4 +++- 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 5d17afd8cfc..5e827a34e87 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -1784,6 +1784,33 @@ length(a) 5000 drop table t1; drop table t1; +DROP TABLE IF EXISTS federated.test; +CREATE TABLE federated.test ( +`i` int(11) NOT NULL, +`j` int(11) NOT NULL, +`c` varchar(30) default NULL, +PRIMARY KEY (`i`,`j`), +UNIQUE KEY `i` (`i`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.test1; +DROP TABLE IF EXISTS federated.test2; +create table federated.test1 ( +i int not null, +j int not null, +c varchar(30), +primary key (i,j), +unique key (i, c)) +engine = federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; +create table federated.test2 ( +i int default null, +j int not null, +c varchar(30), +key (i)) +engine = federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; +drop table federated.test1, federated.test2; +drop table federated.test; DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test index 38beab605fd..c2218b3451b 100644 --- a/mysql-test/t/federated.test +++ b/mysql-test/t/federated.test @@ -1499,4 +1499,49 @@ drop table t1; connection master; drop table t1; +# +# BUG #15133: unique index with nullable value not accepted in federated table +# + +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.test; +CREATE TABLE federated.test ( + `i` int(11) NOT NULL, + `j` int(11) NOT NULL, + `c` varchar(30) default NULL, + PRIMARY KEY (`i`,`j`), + UNIQUE KEY `i` (`i`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +--enable_warnings + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.test1; +DROP TABLE IF EXISTS federated.test2; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.test1 ( + i int not null, + j int not null, + c varchar(30), + primary key (i,j), + unique key (i, c)) +engine = federated +connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.test2 ( + i int default null, + j int not null, + c varchar(30), + key (i)) +engine = federated +connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; +drop table federated.test1, federated.test2; + +connection slave; +drop table federated.test; + source include/federated_cleanup.inc; diff --git a/sql/ha_federated.h b/sql/ha_federated.h index 85474d142a3..61f5af686a3 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -196,7 +196,9 @@ public: /* fix server to be able to get remote server table flags */ return (HA_NOT_EXACT_COUNT | HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED | HA_REC_NOT_IN_SEQ | - HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS| HA_NO_PREFIX_CHAR_KEYS); + HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS| HA_NO_PREFIX_CHAR_KEYS | + HA_NULL_IN_KEY + ); } /* This is a bitmap of flags that says how the storage engine From f5764cecde5b5eee0035360be7bdd6226ea468d4 Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Wed, 26 Jul 2006 16:33:26 -0600 Subject: [PATCH 11/68] Bug #20402: DROP USER failure logged as ERROR rather than WARNING slave.cc, sql_acl.cc: - remove sql_print_error() for events that are not server errors --- sql/slave.cc | 2 +- sql/sql_acl.cc | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/sql/slave.cc b/sql/slave.cc index b2862a437bb..bceeca1055c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2946,7 +2946,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) rli->is_until_satisfied()) { char buf[22]; - sql_print_error("Slave SQL thread stopped because it reached its" + sql_print_information("Slave SQL thread stopped because it reached its" " UNTIL position %s", llstr(rli->until_pos(), buf)); /* Setting abort_slave flag because we do not want additional message about diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 734bccb6b46..0ad5432f3eb 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3671,17 +3671,11 @@ int mysql_drop_user(THD *thd, List &list) { if (!(acl_user= check_acl_user(user_name, &counter))) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; No such user", - user_name->user.str, - user_name->host.str); result= -1; continue; } if ((acl_user->access & ~0)) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Global privileges exists", - user_name->user.str, - user_name->host.str); result= -1; continue; } @@ -3702,9 +3696,6 @@ int mysql_drop_user(THD *thd, List &list) } if (counter != acl_dbs.elements) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Database privileges exists", - user_name->user.str, - user_name->host.str); result= -1; continue; } @@ -3725,9 +3716,6 @@ int mysql_drop_user(THD *thd, List &list) } if (counter != column_priv_hash.records) { - sql_print_error("DROP USER: Can't drop user: '%s'@'%s'; Table privileges exists", - user_name->user.str, - user_name->host.str); result= -1; continue; } @@ -3793,9 +3781,6 @@ int mysql_revoke_all(THD *thd, List &list) { if (!check_acl_user(lex_user, &counter)) { - sql_print_error("REVOKE ALL PRIVILEGES, GRANT: User '%s'@'%s' not exists", - lex_user->user.str, - lex_user->host.str); result= -1; continue; } From fa695edaba95ba92fb1a2a564aef3cacbe7e0d3f Mon Sep 17 00:00:00 2001 From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <> Date: Mon, 31 Jul 2006 12:47:01 +0500 Subject: [PATCH 12/68] 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 | 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 a1936d28a6c265676584218a01685f8d9fdbb2c8 Mon Sep 17 00:00:00 2001 From: "acurtis/antony@xiphis.org/ltantony.xiphis.org" <> Date: Tue, 1 Aug 2006 09:36:34 -0700 Subject: [PATCH 13/68] Bug#15669 "Test case 'csv' produces incorrect result on OpenBSD" mmapped pages were not being invalidated when writes occurred to the file vi a fd i/o operation. Force explicit invalidation and not rely on implicit invalidation. --- sql/examples/ha_tina.cc | 64 +++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 8ae82f97d0b..524ce5eb693 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -101,13 +101,34 @@ static byte* tina_get_key(TINA_SHARE *share,uint *length, return (byte*) share->table_name; } + +int free_mmap(TINA_SHARE *share) +{ + DBUG_ENTER("ha_tina::free_mmap"); + if (share->mapped_file) + { + /* + Invalidate the mapped in pages. Some operating systems (eg OpenBSD) + would reuse already cached pages even if the file has been altered + using fd based I/O. This may be optimized by perhaps only invalidating + the last page but optimization of deprecated code is not important. + */ + msync(share->mapped_file, 0, MS_INVALIDATE); + if (munmap(share->mapped_file, share->file_stat.st_size)) + DBUG_RETURN(1); + } + share->mapped_file= NULL; + DBUG_RETURN(0); +} + /* Reloads the mmap file. */ int get_mmap(TINA_SHARE *share, int write) { DBUG_ENTER("ha_tina::get_mmap"); - if (share->mapped_file && munmap(share->mapped_file, share->file_stat.st_size)) + + if (free_mmap(share)) DBUG_RETURN(1); if (my_fstat(share->data_file, &share->file_stat, MYF(MY_WME)) == -1) @@ -230,8 +251,7 @@ static int free_share(TINA_SHARE *share) int result_code= 0; if (!--share->use_count){ /* Drop the mapped file */ - if (share->mapped_file) - munmap(share->mapped_file, share->file_stat.st_size); + free_mmap(share); result_code= my_close(share->data_file,MYF(0)); hash_delete(&tina_open_tables, (byte*) share); thr_lock_delete(&share->lock); @@ -493,6 +513,13 @@ int ha_tina::write_row(byte * buf) size= encode_quote(buf); + /* + we are going to alter the file so we must invalidate the in memory pages + otherwise we risk a race between the in memory pages and the disk pages. + */ + if (free_mmap(share)) + DBUG_RETURN(-1); + if (my_write(share->data_file, buffer.ptr(), size, MYF(MY_WME | MY_NABP))) DBUG_RETURN(-1); @@ -534,8 +561,26 @@ int ha_tina::update_row(const byte * old_data, byte * new_data) if (chain_append()) DBUG_RETURN(-1); + /* + we are going to alter the file so we must invalidate the in memory pages + otherwise we risk a race between the in memory pages and the disk pages. + */ + if (free_mmap(share)) + DBUG_RETURN(-1); + if (my_write(share->data_file, buffer.ptr(), size, MYF(MY_WME | MY_NABP))) DBUG_RETURN(-1); + + /* + Ok, this is means that we will be doing potentially bad things + during a bulk update on some OS'es. Ideally, we should extend the length + of the file, redo the mmap and then write all the updated rows. Upon + finishing the bulk update, truncate the file length to the final length. + Since this code is all being deprecated, not point now to optimize. + */ + if (get_mmap(share, 0) > 0) + DBUG_RETURN(-1); + DBUG_RETURN(0); } @@ -812,15 +857,14 @@ int ha_tina::rnd_end() length= length - (size_t)(ptr->end - ptr->begin); } + /* Invalidate all cached mmap pages */ + if (free_mmap(share)) + DBUG_RETURN(-1); + /* Truncate the file to the new size */ if (my_chsize(share->data_file, length, 0, MYF(MY_WME))) DBUG_RETURN(-1); - if (munmap(share->mapped_file, length)) - DBUG_RETURN(-1); - - /* We set it to null so that get_mmap() won't try to unmap it */ - share->mapped_file= NULL; if (get_mmap(share, 0) > 0) DBUG_RETURN(-1); } @@ -838,6 +882,10 @@ int ha_tina::delete_all_rows() if (!records_is_known) return (my_errno=HA_ERR_WRONG_COMMAND); + /* Invalidate all cached mmap pages */ + if (free_mmap(share)) + DBUG_RETURN(-1); + int rc= my_chsize(share->data_file, 0, 0, MYF(MY_WME)); if (get_mmap(share, 0) > 0) From 6c6f435b03113753c92de13f51daa0d8f7871da7 Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Wed, 2 Aug 2006 17:15:50 +0500 Subject: [PATCH 14/68] BUG#14770 - LOAD DATA INFILE doesn't respect default values for columns Fixed confusing warning. Quoting INSERT section of the manual: ---- Inserting NULL into a column that has been declared NOT NULL. For multiple-row INSERT statements or INSERT INTO ... SELECT statements, the column is set to the implicit default value for the column data type. This is 0 for numeric types, the empty string ('') for string types, and the "zero" value for date and time types. INSERT INTO ... SELECT statements are handled the same way as multiple-row inserts because the server does not examine the result set from the SELECT to see whether it returns a single row. (For a single-row INSERT, no warning occurs when NULL is inserted into a NOT NULL column. Instead, the statement fails with an error.) ---- This is also true for LOAD DATA INFILE. For INSERT user can specify DEFAULT keyword as a value to set column default. There is no similiar feature available for LOAD DATA INFILE. --- mysql-test/r/auto_increment.result | 4 ++-- mysql-test/r/create.result | 2 +- mysql-test/r/insert.result | 2 +- mysql-test/r/insert_select.result | 4 ++-- mysql-test/r/key.result | 4 ++-- mysql-test/r/null.result | 18 +++++++++--------- mysql-test/r/null_key.result | 2 +- mysql-test/r/ps_2myisam.result | 2 +- mysql-test/r/ps_3innodb.result | 2 +- mysql-test/r/ps_4heap.result | 2 +- mysql-test/r/ps_5merge.result | 4 ++-- mysql-test/r/ps_6bdb.result | 2 +- mysql-test/r/strict.result | 18 +++++++++--------- mysql-test/r/view.result | 2 +- mysql-test/r/warnings.result | 8 ++++---- sql/share/errmsg.txt | 4 ++-- 16 files changed, 40 insertions(+), 40 deletions(-) diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index afbff905699..d0058118e4c 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -232,7 +232,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=6; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 4 update t1 set a=300 where b=7; SET SQL_MODE=''; insert into t1(a,b)values(NULL,8); @@ -274,7 +274,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=13; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 9 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 9 update t1 set a=500 where b=14; select * from t1 order by b; a b diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index c5b77ea4925..f3dfec3d469 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -13,7 +13,7 @@ Warnings: Note 1050 Table 't1' already exists insert into t1 values (""),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 select * from t1; b diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 82fad8e912c..80723d68b5a 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -63,7 +63,7 @@ insert into t1 values(NULL); ERROR 23000: Column 'id' cannot be null insert into t1 values (1), (NULL), (2); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'id' at row 2 select * from t1; id 1 diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 49d9c3594db..34e3f0ca2e8 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -606,8 +606,8 @@ NULL 2 100 create table t2(No int not null, Field int not null, Count int not null); insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'No' at row 2 select * from t2; No Field Count 0 1 100 diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index 0174ea45935..eea884e4294 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -159,8 +159,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 2 SELECT * FROM t1; c i 1 diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 18eb10f0673..daedfa50b80 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -97,39 +97,39 @@ Warnings: Warning 1265 Data truncated for column 'd' at row 1 UPDATE t1 SET d=NULL; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 1 INSERT INTO t1 (a) values (null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (1/null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2 INSERT INTO t1 (b) values (null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (1/null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 INSERT INTO t1 (c) values (null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (1/null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'c' at row 2 INSERT INTO t1 (d) values (null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (1/null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (null),(null); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'd' at row 2 select * from t1; a b c d 0 0000-00-00 00:00:00 0 diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 7f746a3dbd8..6eb3cf312a0 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -342,7 +342,7 @@ index (id2) ); insert into t1 values(null,null),(1,1); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id2' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'id2' at row 1 select * from t1; id id2 NULL 0 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 207d9ea7475..4f2ba36fd3f 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1304,7 +1304,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 select a,b from t1 order by a; a b 0 two diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 13aa549949c..0b41e1f161a 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1287,7 +1287,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 select a,b from t1 order by a; a b 0 two diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index a08dae945bd..a0b797f2e68 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1288,7 +1288,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 select a,b from t1 order by a; a b 0 two diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index 6682b085097..4164e244457 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1330,7 +1330,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 select a,b from t1 order by a; a b 0 two @@ -4344,7 +4344,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 select a,b from t1 order by a; a b 0 two diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result index dc3b984949d..858cce7d963 100644 --- a/mysql-test/r/ps_6bdb.result +++ b/mysql-test/r/ps_6bdb.result @@ -1287,7 +1287,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 select a,b from t1 order by a; a b 0 two diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index d0cf11d0511..b027709c435 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -989,16 +989,16 @@ ERROR 23000: Column 'col2' cannot be null INSERT INTO t1 VALUES (103,'',NULL); ERROR 23000: Column 'col3' cannot be null UPDATE t1 SET col1=NULL WHERE col1 =100; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1 +ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1 UPDATE t1 SET col2 =NULL WHERE col2 ='hello'; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 UPDATE t1 SET col2 =NULL where col3 IS NOT NULL; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 INSERT IGNORE INTO t1 values (NULL,NULL,NULL); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col3' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col3' at row 1 SELECT * FROM t1; col1 col2 col3 100 hello 2004-08-20 @@ -1023,11 +1023,11 @@ ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO t1 (col1) SELECT 1; ERROR HY000: Field 'col2' doesn't have a default value INSERT INTO t1 SELECT 1,NULL; -ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 INSERT IGNORE INTO t1 values (NULL,NULL); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col1' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'col2' at row 1 INSERT IGNORE INTO t1 (col1) values (3); Warnings: Warning 1364 Field 'col2' doesn't have a default value diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 72cffb9531c..b532aa8ef8a 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1495,7 +1495,7 @@ insert into v3(b) values (10); insert into v3(a) select a from t2; insert into v3(b) select b from t2; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2 insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a); select * from t1; a b diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index f9006ebca37..2b1993bdd90 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -72,7 +72,7 @@ drop table t1; create table t1(a tinyint, b int not null, c date, d char(5)); load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ','; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 3 Warning 1265 Data truncated for column 'c' at row 4 Warning 1261 Row 5 doesn't contain data for all columns @@ -86,7 +86,7 @@ drop table t1; create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5)); insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test'); Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 Warning 1264 Out of range value adjusted for column 'b' at row 2 Warning 1265 Data truncated for column 'c' at row 2 Warning 1264 Out of range value adjusted for column 'a' at row 3 @@ -99,7 +99,7 @@ Warning 1265 Data truncated for column 'c' at row 2 alter table t1 add d char(2); update t1 set a=NULL where a=10; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 2 update t1 set c='mysql ab' where c='test'; Warnings: Warning 1265 Data truncated for column 'c' at row 4 @@ -115,7 +115,7 @@ Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'b' at row 3 -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 4 Warning 1265 Data truncated for column 'b' at row 4 insert into t2(b) values('mysqlab'); Warnings: diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 9b20c37ece2..4b2408be6d0 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -4893,8 +4893,8 @@ ER_WARN_TOO_MANY_RECORDS 01000 por "Conta de registro é maior que a conta de coluna na linha %ld" spa "Línea %ld fué truncada; La misma contine mas datos que las que existen en las columnas de entrada" ER_WARN_NULL_TO_NOTNULL 22004 - eng "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld" - ger "Feld auf Vorgabewert gesetzt, da NULL für NOT-NULL-Feld '%s' in Zeile %ld angegeben" + eng "Column was set to data type implicit default; NULL supplied for NOT NULL column '%s' at row %ld" + ger "Feld auf Datentyp-spezifischen Vorgabewert gesetzt; da NULL für NOT-NULL-Feld '%s' in Zeile %ld angegeben" por "Dado truncado, NULL fornecido para NOT NULL coluna '%s' na linha %ld" spa "Datos truncado, NULL suministrado para NOT NULL columna '%s' en la línea %ld" ER_WARN_DATA_OUT_OF_RANGE 22003 From 35c523a6f8d9a27f1a96b79e618e1aef6f76cf44 Mon Sep 17 00:00:00 2001 From: "tnurnberg@mysql.com/salvation.intern.azundris.com" <> Date: Thu, 3 Aug 2006 14:58:13 +0200 Subject: [PATCH 15/68] Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non privileged view "A SELECT privilege on a view is required for SHOW CREATE VIEW and it will stay that way because of compatibility reasons." (see #20136) a test case to illustrate how the ACLs work in this case (and ensure they will continue to do so in the future) --- mysql-test/r/grant.result | 75 +++++++++++++++++++++++ mysql-test/t/grant.test | 123 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 198 insertions(+) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 3f3325354ee..494c68e5731 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -867,3 +867,78 @@ insert into mysql.user select * from t2; flush privileges; drop table t2; drop table t1; +CREATE DATABASE mysqltest3; +use mysqltest3; +CREATE TABLE t_nn (c1 INT); +CREATE VIEW v_nn AS SELECT * FROM t_nn; +CREATE DATABASE mysqltest2; +use mysqltest2; +CREATE TABLE t_nn (c1 INT); +CREATE VIEW v_nn AS SELECT * FROM t_nn; +CREATE VIEW v_yn AS SELECT * FROM t_nn; +CREATE VIEW v_gy AS SELECT * FROM t_nn; +CREATE VIEW v_ny AS SELECT * FROM t_nn; +CREATE VIEW v_yy AS SELECT * FROM t_nn WHERE c1=55; +GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +SHOW CREATE VIEW mysqltest2.v_nn; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +SHOW CREATE TABLE mysqltest2.v_nn; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +SHOW CREATE VIEW mysqltest2.v_yn; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn' +SHOW CREATE TABLE mysqltest2.v_yn; +ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn' +SHOW CREATE TABLE mysqltest2.v_ny; +View Create View +v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` +SHOW CREATE VIEW mysqltest2.v_ny; +View Create View +v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` +SHOW CREATE VIEW mysqltest3.t_nn; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn' +SHOW CREATE TABLE mysqltest3.t_nn; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn' +SHOW CREATE VIEW mysqltest3.v_nn; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +SHOW CREATE TABLE mysqltest3.v_nn; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' +SHOW CREATE TABLE mysqltest2.t_nn; +Table Create Table +t_nn CREATE TABLE `t_nn` ( + `c1` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE VIEW mysqltest2.t_nn; +ERROR HY000: 'mysqltest2.t_nn' is not VIEW +SHOW CREATE VIEW mysqltest2.v_yy; +View Create View +v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) +SHOW CREATE TABLE mysqltest2.v_yy; +View Create View +v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) +SHOW CREATE TABLE mysqltest2.v_nn; +View Create View +v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` +SHOW CREATE VIEW mysqltest2.v_nn; +View Create View +v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` +SHOW CREATE TABLE mysqltest2.t_nn; +Table Create Table +t_nn CREATE TABLE `t_nn` ( + `c1` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE VIEW mysqltest2.t_nn; +ERROR HY000: 'mysqltest2.t_nn' is not VIEW +DROP VIEW mysqltest2.v_nn; +DROP VIEW mysqltest2.v_yn; +DROP VIEW mysqltest2.v_ny; +DROP VIEW mysqltest2.v_yy; +DROP TABLE mysqltest2.t_nn; +DROP DATABASE mysqltest2; +DROP VIEW mysqltest3.v_nn; +DROP TABLE mysqltest3.t_nn; +DROP DATABASE mysqltest3; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost'; +DROP USER 'mysqltest_1'@'localhost'; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index a9d52f559ca..1156c670934 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -681,3 +681,126 @@ drop table t2; drop table t1; + +# +# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non +# privileged view +# + +connection master; + +CREATE DATABASE mysqltest3; +use mysqltest3; + +CREATE TABLE t_nn (c1 INT); +CREATE VIEW v_nn AS SELECT * FROM t_nn; + +CREATE DATABASE mysqltest2; +use mysqltest2; + +CREATE TABLE t_nn (c1 INT); +CREATE VIEW v_nn AS SELECT * FROM t_nn; +CREATE VIEW v_yn AS SELECT * FROM t_nn; +CREATE VIEW v_gy AS SELECT * FROM t_nn; +CREATE VIEW v_ny AS SELECT * FROM t_nn; +CREATE VIEW v_yy AS SELECT * FROM t_nn WHERE c1=55; + +GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; + +connect (mysqltest_1, localhost, mysqltest_1, mysqltest_1,); + +# fail because of missing SHOW VIEW (have generic SELECT) +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE VIEW mysqltest2.v_nn; +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE TABLE mysqltest2.v_nn; + + + +# fail because of missing SHOW VIEW +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE VIEW mysqltest2.v_yn; +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE TABLE mysqltest2.v_yn; + + + +# succeed (despite of missing SELECT, having SHOW VIEW bails us out) +SHOW CREATE TABLE mysqltest2.v_ny; + +# succeed (despite of missing SELECT, having SHOW VIEW bails us out) +SHOW CREATE VIEW mysqltest2.v_ny; + + + +# fail because of missing (specific or generic) SELECT +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE TABLE mysqltest3.t_nn; + +# fail because of missing (specific or generic) SELECT (not because it's not a view!) +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE VIEW mysqltest3.t_nn; + + + +# fail because of missing missing (specific or generic) SELECT (and SHOW VIEW) +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE VIEW mysqltest3.v_nn; +--error ER_TABLEACCESS_DENIED_ERROR +SHOW CREATE TABLE mysqltest3.v_nn; + + + +# succeed thanks to generic SELECT +SHOW CREATE TABLE mysqltest2.t_nn; + +# fail because it's not a view! (have generic SELECT though) +--error ER_WRONG_OBJECT +SHOW CREATE VIEW mysqltest2.t_nn; + + + +# succeed, have SELECT and SHOW VIEW +SHOW CREATE VIEW mysqltest2.v_yy; + +# succeed, have SELECT and SHOW VIEW +SHOW CREATE TABLE mysqltest2.v_yy; + + + +#clean-up +connection master; + +# succeed, we're root +SHOW CREATE TABLE mysqltest2.v_nn; +SHOW CREATE VIEW mysqltest2.v_nn; + +SHOW CREATE TABLE mysqltest2.t_nn; + +# fail because it's not a view! +--error ER_WRONG_OBJECT +SHOW CREATE VIEW mysqltest2.t_nn; + + + +DROP VIEW mysqltest2.v_nn; +DROP VIEW mysqltest2.v_yn; +DROP VIEW mysqltest2.v_ny; +DROP VIEW mysqltest2.v_yy; + +DROP TABLE mysqltest2.t_nn; + +DROP DATABASE mysqltest2; + + + +DROP VIEW mysqltest3.v_nn; +DROP TABLE mysqltest3.t_nn; + +DROP DATABASE mysqltest3; + +REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost'; +DROP USER 'mysqltest_1'@'localhost'; From 2469667e4bc555251d90b08a6f85076c2255dc56 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Thu, 3 Aug 2006 17:29:35 +0200 Subject: [PATCH 16/68] Bug#20190 Unixware 7.13 port and make test errors - Thanks to cerber for the patch! --- server-tools/instance-manager/portability.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server-tools/instance-manager/portability.h b/server-tools/instance-manager/portability.h index 1a3be5705e3..23a5a5bd14c 100644 --- a/server-tools/instance-manager/portability.h +++ b/server-tools/instance-manager/portability.h @@ -1,7 +1,11 @@ #ifndef INCLUDES_MYSQL_INSTANCE_MANAGER_PORTABILITY_H #define INCLUDES_MYSQL_INSTANCE_MANAGER_PORTABILITY_H -#if defined(_SCO_DS) && !defined(SHUT_RDWR) +#if (defined(_SCO_DS) || defined(UNIXWARE_7)) && !defined(SHUT_RDWR) +/* + SHUT_* functions are defined only if + "(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1)" +*/ #define SHUT_RDWR 2 #endif From 061a91b6aeefa9c7363c07775c97a9e10932ce08 Mon Sep 17 00:00:00 2001 From: "iggy@rolltop.ignatz42.dyndns.org" <> Date: Thu, 3 Aug 2006 16:00:15 -0400 Subject: [PATCH 17/68] Bug #20968: incorrect DBUG_ENTER string in mysqld.cc network_init(void) function --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 57ee7971c8d..22599fd89eb 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1409,7 +1409,7 @@ static void network_init(void) uint waited; uint this_wait; uint retry; - DBUG_ENTER("server_init"); + DBUG_ENTER("network_init"); LINT_INIT(ret); set_ports(); From c1786175f2fa58044c6ff121dbc5a5755662fb34 Mon Sep 17 00:00:00 2001 From: "rburnett@production.mysql.com" <> Date: Fri, 4 Aug 2006 21:18:58 +0200 Subject: [PATCH 18/68] 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 | 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 73c77c00fa920fe01168dd1b4f8d7f70491e97e3 Mon Sep 17 00:00:00 2001 From: "hartmut@mysql.com/linux.site" <> Date: Sat, 5 Aug 2006 13:41:22 +0200 Subject: [PATCH 19/68] relying on loop counter variables being local to the loop body if declared in the 'for' statement is not portable, some compilers still don't implement this ANSI C++ specification (Bug #14995) --- server-tools/instance-manager/listener.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server-tools/instance-manager/listener.cc b/server-tools/instance-manager/listener.cc index 67d798a1700..500b25bec03 100644 --- a/server-tools/instance-manager/listener.cc +++ b/server-tools/instance-manager/listener.cc @@ -88,7 +88,7 @@ Listener_thread::~Listener_thread() void Listener_thread::run() { - int n= 0; + int i, n= 0; #ifndef __WIN__ /* we use this var to check whether we are running on LinuxThreads */ @@ -117,7 +117,7 @@ void Listener_thread::run() #endif /* II. Listen sockets and spawn childs */ - for (int i= 0; i < num_sockets; i++) + for (i= 0; i < num_sockets; i++) n= max(n, sockets[i]); n++; @@ -176,7 +176,7 @@ void Listener_thread::run() log_info("Listener_thread::run(): shutdown requested, exiting..."); - for (int i= 0; i < num_sockets; i++) + for (i= 0; i < num_sockets; i++) close(sockets[i]); #ifndef __WIN__ @@ -189,7 +189,7 @@ void Listener_thread::run() err: // we have to close the ip sockets in case of error - for (int i= 0; i < num_sockets; i++) + for (i= 0; i < num_sockets; i++) close(sockets[i]); thread_registry.unregister_thread(&thread_info); From a73a9da34ba58478200eff2a883e705f094a7c7a Mon Sep 17 00:00:00 2001 From: "rburnett@production.mysql.com" <> Date: Sat, 5 Aug 2006 23:15:23 +0200 Subject: [PATCH 20/68] 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 7a8a33a9416df745def934732800d670e6453dec Mon Sep 17 00:00:00 2001 From: "Reggie@xgeek." <> Date: Sat, 5 Aug 2006 18:58:38 -0500 Subject: [PATCH 21/68] please don't call 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 1d2a5c2e1a77d70fe71088289b10c7f0f123af45 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Sun, 6 Aug 2006 20:58:30 +0200 Subject: [PATCH 22/68] Send output from mysql_client_test to var/log/mysql_client_test.log --- mysql-test/t/mysql_client_test.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index b61deeac001..66a27abd61a 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -8,8 +8,8 @@ # server or run mysql-test-run --debug mysql_client_test and check # var/log/mysql_client_test.trace ---disable_result_log ---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M +--exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1 +--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1 # End of 4.1 tests echo ok; From e33bd1a3097118d566f7654628fa179ff4ddb698 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Sun, 6 Aug 2006 23:56:51 +0200 Subject: [PATCH 23/68] Flush stderr before calling abort() --- tests/mysql_client_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e4b2374a698..b65528eccb6 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -122,6 +122,7 @@ static void client_disconnect(); void die(const char *file, int line, const char *expr) { fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr); + fflush(stderr); abort(); } From f25bf84cf4f3d374dbc3a916bf282f80a8386eb2 Mon Sep 17 00:00:00 2001 From: "tnurnberg@mysql.com/salvation.intern.azundris.com" <> Date: Mon, 7 Aug 2006 04:13:05 +0200 Subject: [PATCH 24/68] grant.result: manual merge --- mysql-test/r/grant.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index c45eb9d20d9..7df3d8d496d 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -897,10 +897,10 @@ v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER SHOW CREATE VIEW mysqltest2.v_ny; View Create View v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` -SHOW CREATE VIEW mysqltest3.t_nn; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn' SHOW CREATE TABLE mysqltest3.t_nn; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn' +SHOW CREATE VIEW mysqltest3.t_nn; +ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn' SHOW CREATE VIEW mysqltest3.v_nn; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' SHOW CREATE TABLE mysqltest3.v_nn; From ffe2a431b5ce7a759eceabf88ca3d146179d3565 Mon Sep 17 00:00:00 2001 From: "holyfoot/hf@mysql.com/deer.(none)" <> Date: Mon, 7 Aug 2006 11:56:22 +0500 Subject: [PATCH 25/68] information_schema_db.test fixed --- 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 2e4dbadf9f7364ac1fa38a2850fd0d4b6cffc882 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 7 Aug 2006 10:16:37 +0200 Subject: [PATCH 26/68] fflush(NULL) before abort so that all pending writes are performed --- tests/mysql_client_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index b65528eccb6..7cdd82f3779 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -122,7 +122,7 @@ static void client_disconnect(); void die(const char *file, int line, const char *expr) { fprintf(stderr, "%s:%d: check failed: '%s'\n", file, line, expr); - fflush(stderr); + fflush(NULL); abort(); } From 68168c8e8fa9dc63732dce14a5aeae56fd8061eb Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 7 Aug 2006 11:29:41 +0200 Subject: [PATCH 27/68] Change the 'sleep' into an explicit FLUSH LOGS command --- 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 7cdd82f3779..89b07143873 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14930,7 +14930,9 @@ static void test_bug17667() myquery(rc); } - sleep(1); /* The server may need time to flush the data to the log. */ + /* Make sure the server has written the logs to disk before reading it */ + rc= mysql_query(mysql, "flush logs"); + myquery(rc); master_log_filename = (char *) malloc(strlen(opt_vardir) + strlen("/log/master.log") + 1); strcpy(master_log_filename, opt_vardir); From 419e4dd46f0be456144f00388e4543341e9ebd2f Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 7 Aug 2006 14:02:57 +0200 Subject: [PATCH 28/68] Add printouts in test case for bug17667 --- tests/mysql_client_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 89b07143873..f5acf179319 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14937,6 +14937,7 @@ static void test_bug17667() master_log_filename = (char *) malloc(strlen(opt_vardir) + strlen("/log/master.log") + 1); strcpy(master_log_filename, opt_vardir); strcat(master_log_filename, "/log/master.log"); + printf("Opening '%s'\n", master_log_filename); log_file= fopen(master_log_filename, "r"); free(master_log_filename); @@ -14956,6 +14957,9 @@ static void test_bug17667() } while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2, statement_cursor->buffer, statement_cursor->length) == NULL); + + printf("Found statement starting with \"%s\"\n", + statement_cursor->buffer); } printf("success. All queries found intact in the log.\n"); From b5cd11cf0e76d12e9fcf2fa6858e74b7c7c54c0d Mon Sep 17 00:00:00 2001 From: "svoj@may.pils.ru" <> Date: Mon, 7 Aug 2006 19:35:02 +0500 Subject: [PATCH 29/68] After merge fix. --- mysql-test/r/ps_7ndb.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 000a20da655..6a014319097 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1287,7 +1287,7 @@ set @arg00=NULL; set @arg01=2; execute stmt1 using @arg00, @arg01; Warnings: -Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'a' at row 1 select a,b from t1 order by a; a b 0 two From 862d5626a5b7d2bcf9dbbf76d250e0130844989f Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 7 Aug 2006 17:26:02 +0200 Subject: [PATCH 30/68] Add some more code to analyze why the fgets fails. --- tests/mysql_client_test.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index f5acf179319..32a8e94aee9 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14951,9 +14951,18 @@ static void test_bug17667() do { memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2); - DIE_UNLESS(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) != - NULL); - /* If we reach EOF before finishing the statement list, then we failed. */ + if(fgets(line_buffer, MAX_TEST_QUERY_LENGTH*2, log_file) == NULL) + { + /* If fgets returned NULL, it indicates either error or EOF */ + if (feof(log_file)) + DIE("Found EOF before all statements where found"); + else + { + fprintf(stderr, "Got error %d while reading from file\n", + ferror(log_file)); + DIE("Read error"); + } + } } while (my_memmem(line_buffer, MAX_TEST_QUERY_LENGTH*2, statement_cursor->buffer, statement_cursor->length) == NULL); From dee4105ce0b5207f93e32c3cab3cf5fde855e037 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 7 Aug 2006 19:21:43 +0200 Subject: [PATCH 31/68] Remove extra whitespace --- tests/mysql_client_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 32a8e94aee9..c64ebc9e281 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14915,7 +14915,7 @@ static void test_bug17667() { "insert into bug17667 (c) values ('5 NULs=\0\0\0\0\0')", 48 }, { "/* NUL=\0 with comment */ insert into bug17667 (c) values ('encore')", 67 }, { "drop table bug17667", 19 }, - { NULL, 0 } }; + { NULL, 0 } }; struct buffer_and_length *statement_cursor; FILE *log_file; @@ -14945,8 +14945,8 @@ static void test_bug17667() for (statement_cursor= statements; statement_cursor->buffer != NULL; statement_cursor++) { - char line_buffer[MAX_TEST_QUERY_LENGTH*2]; - /* more than enough room for the query and some marginalia. */ + char line_buffer[MAX_TEST_QUERY_LENGTH*2]; + /* more than enough room for the query and some marginalia. */ do { memset(line_buffer, '/', MAX_TEST_QUERY_LENGTH*2); From e9b87a1a7f3c09501935acd20b2bc4a1a58160cc Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/gluh.(none)" <> Date: Tue, 8 Aug 2006 12:50:05 +0500 Subject: [PATCH 32/68] 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 de7e53d531255d9838c6006f54e3aee29549b2b7 Mon Sep 17 00:00:00 2001 From: "holyfoot/hf@mysql.com/deer.(none)" <> Date: Tue, 8 Aug 2006 13:34:27 +0500 Subject: [PATCH 33/68] 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 | 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 1be93531ee5e5b7e3b4adaf6305572712d020b49 Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/gluh.(none)" <> Date: Tue, 8 Aug 2006 14:40:07 +0500 Subject: [PATCH 34/68] 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 | 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 8e4460343fb968cb9cd55da963535c45e48fc5eb Mon Sep 17 00:00:00 2001 From: "cmiller@zippy.cornsilk.net" <> Date: Wed, 9 Aug 2006 13:41:08 -0400 Subject: [PATCH 35/68] Removed iggy's accidentally checked-in test files. --- mysql-test/r/bug20328.result | 44 ------------------------------------ mysql-test/t/bug20328.test | 9 -------- 2 files changed, 53 deletions(-) delete mode 100644 mysql-test/r/bug20328.result delete mode 100644 mysql-test/t/bug20328.test diff --git a/mysql-test/r/bug20328.result b/mysql-test/r/bug20328.result deleted file mode 100644 index 62955775ec4..00000000000 --- a/mysql-test/r/bug20328.result +++ /dev/null @@ -1,44 +0,0 @@ -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set query delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset_name(\C) Switch to another charset. Might be needed for processing binlog. -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set query delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset_name(\C) Switch to another charset. Might be needed for processing binlog. diff --git a/mysql-test/t/bug20328.test b/mysql-test/t/bug20328.test deleted file mode 100644 index 6ae4717de9c..00000000000 --- a/mysql-test/t/bug20328.test +++ /dev/null @@ -1,9 +0,0 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc - -# -# Bug #20328: mysql client interprets commands in comments -# ---exec echo 'help' | $MYSQL ---exec echo 'help ' | $MYSQL - From 6b9629422323fdfa1709776d63b0eae1bd72cd1f Mon Sep 17 00:00:00 2001 From: "pgalbraith/patg@govinda.patg.net" <> Date: Wed, 9 Aug 2006 17:41:35 -0700 Subject: [PATCH 36/68] autopush test - sorry for the commit messages, ignore --- sql/ha_federated.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 2267c2b5d79..7919519cdce 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -332,6 +332,7 @@ */ + #include "mysql_priv.h" #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation From cbe81c301a89f05b27a15349f8b54774f87a11e2 Mon Sep 17 00:00:00 2001 From: "tnurnberg@salvation.intern.azundris.com" <> Date: Thu, 10 Aug 2006 03:46:46 +0200 Subject: [PATCH 37/68] Bug#17926: mysql.exe crashes when ctrl-c is pressed in windows SIGINT is handled in funny ways on windows, which could lead to problems when Control-C was pressed in the client during a long-running query. Now Control-C during a query aborts that query (by sending KILL to the server on a second connexion), while Control-C outside of a running query terminates the client. --- client/mysql.cc | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 22cf0b473af..d70b078bfe9 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -136,7 +136,8 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, tty_password= 0, opt_nobeep=0, opt_reconnect=1, default_charset_used= 0, opt_secure_auth= 0, default_pager_set= 0, opt_sigint_ignore= 0, - show_warnings = 0; + show_warnings= 0; +static volatile int executing_query= 0, interrupted_query= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static my_string opt_mysql_unix_port=0; @@ -338,6 +339,7 @@ static void end_timer(ulong start_time,char *buff); static void mysql_end_timer(ulong start_time,char *buff); static void nice_time(double sec,char *buff,bool part_second); static sig_handler mysql_end(int sig); +static sig_handler mysql_sigint(int sig); int main(int argc,char *argv[]) @@ -420,7 +422,7 @@ int main(int argc,char *argv[]) if (opt_sigint_ignore) signal(SIGINT, SIG_IGN); else - signal(SIGINT, mysql_end); // Catch SIGINT to clean up + signal(SIGINT, mysql_sigint); // Catch SIGINT to clean up signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up /* @@ -488,6 +490,28 @@ int main(int argc,char *argv[]) #endif } +sig_handler mysql_sigint(int sig) +{ + char kill_buffer[40]; + MYSQL *kill_mysql= NULL; + + signal(SIGINT, mysql_sigint); + + /* terminate if no query being executed, or we already tried interrupting */ + if (!executing_query || interrupted_query++) + mysql_end(sig); + + kill_mysql= mysql_init(kill_mysql); + if (!mysql_real_connect(kill_mysql,current_host, current_user, opt_password, + "", opt_mysql_port, opt_mysql_unix_port,0)) + mysql_end(sig); + /* kill_buffer is always big enough because max length of %lu is 15 */ + sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql)); + mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer)); + mysql_close(kill_mysql); + tee_fprintf(stdout, "Query aborted by Ctrl+C\n"); +} + sig_handler mysql_end(int sig) { mysql_close(&mysql); @@ -1008,6 +1032,8 @@ static int read_and_execute(bool interactive) if (opt_outfile && glob_buffer.is_empty()) fflush(OUTFILE); + interrupted_query= 0; + #if defined( __WIN__) || defined(OS2) || defined(__NETWARE__) tee_fputs(prompt, stdout); #if defined(__NETWARE__) @@ -1998,6 +2024,8 @@ com_go(String *buffer,char *line __attribute__((unused))) timer=start_timer(); + executing_query= 1; + error= mysql_real_query_for_lazy(buffer->ptr(),buffer->length()); #ifdef HAVE_READLINE @@ -2012,6 +2040,7 @@ com_go(String *buffer,char *line __attribute__((unused))) if (error) { buffer->length(0); // Remove query on error + executing_query= 0; return error; } error=0; @@ -2022,13 +2051,19 @@ com_go(String *buffer,char *line __attribute__((unused))) if (quick) { if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql)) + { + executing_query= 0; return put_error(&mysql); + } } else { error= mysql_store_result_for_lazy(&result); if (error) + { + executing_query= 0; return error; + } } if (verbose >= 3 || !opt_silent) @@ -2089,6 +2124,9 @@ com_go(String *buffer,char *line __attribute__((unused))) fflush(stdout); mysql_free_result(result); } while (!(err= mysql_next_result(&mysql))); + + executing_query= 0; + if (err >= 1) error= put_error(&mysql); From 1ada6ca10898fed572fe23aa10782e08f6ef9e9c Mon Sep 17 00:00:00 2001 From: "holyfoot/hf@mysql.com/deer.(none)" <> Date: Thu, 10 Aug 2006 14:50:54 +0500 Subject: [PATCH 38/68] bug #20910 (NOT NULL column reported as NULL in SHOW FIELDS) two test results changed after the patch --- 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 50ae5b7989e6148bee11a718c72ebfdade2ccdc8 Mon Sep 17 00:00:00 2001 From: "ramil/ram@mysql.com/myoffice.izhnet.ru" <> Date: Thu, 10 Aug 2006 15:06:22 +0500 Subject: [PATCH 39/68] Fix for bug #20709: Collation not used in group by on 4.1. myisam/mi_uniue.c:mi_check_unique() should skip trailing spaces comparing TEXT and VARTTEXT key segments. --- myisam/mi_unique.c | 2 +- mysql-test/r/ctype_utf8.result | 16 ++++++++++++++++ mysql-test/t/ctype_utf8.test | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c index b5baa448609..1a116e50174 100644 --- a/myisam/mi_unique.c +++ b/myisam/mi_unique.c @@ -185,7 +185,7 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const byte *a, const byte *b, if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT) { if (mi_compare_text(keyseg->charset, (uchar *) pos_a, length, - (uchar *) pos_b, length, 0, 0)) + (uchar *) pos_b, length, 0, 1)) return 1; } else diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 4ceacaffcbb..0833e73b0a9 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1293,3 +1293,19 @@ id tid val 42749 72 VOLNÝ ADSL 44205 72 VOLNÝ ADSL DROP TABLE t1; +create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '') +default charset=utf8 collate=utf8_unicode_ci; +insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); +explain select distinct a from t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary +select distinct a from t1; +a +e +explain select a from t1 group by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort +select a from t1 group by a; +a +e +drop table t1; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index b1d485ad1ce..e737a8d381f 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1040,4 +1040,18 @@ ALTER TABLE t1 ADD KEY idx (tid,val(11)); SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNÝ ADSL'; DROP TABLE t1; + +# +# Bug 20709: problem with utf8 fields in temporary tables +# + +create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '') + default charset=utf8 collate=utf8_unicode_ci; +insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65')); +explain select distinct a from t1; +select distinct a from t1; +explain select a from t1 group by a; +select a from t1 group by a; +drop table t1; + # End of 4.1 tests From 170392850d040a2294242a02e1bb092a17ef9ac3 Mon Sep 17 00:00:00 2001 From: "tnurnberg@salvation.intern.azundris.com" <> Date: Thu, 10 Aug 2006 15:37:24 +0200 Subject: [PATCH 40/68] Bug#19844: time_format in Union truncates values time_format() claimed %H and %k would return at most two digits (hours 0-23), but this coincided neither with actual behaviour nor with docs. this is not visible in simple queries; forcing a temp-table is probably the easiest way to see this. adjusted the return-length appropriately; the alternative would be to adjust the docs to say that behaviour for > 99 hours is undefined. --- Bug#19844: time_format in Union truncates values time_format() claimed %H and %k would return at most two digits (hours 0-23), but this coincided neither with actual behaviour nor with docs. this is not visible in simple queries; forcing a temp-table is probably the easiest way to see this. adjusted the return-length appropriately; the alternative would be to adjust the docs to say that behaviour for > 99 hours is undefined. --- mysql-test/r/func_time.result | 21 +++++++++++++++++++++ mysql-test/t/func_time.test | 20 +++++++++++++++++++- sql/item_timefunc.cc | 6 ++++-- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index d8ba606a558..47a0f83802c 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -695,3 +695,24 @@ t1 CREATE TABLE `t1` ( `from_unixtime(1) + 0` double(23,6) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H); +H +120 +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H); +H +120 +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H); +H +05 +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); +H +5 +End of 4.1 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index b8647a281d4..472f3d81d2b 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -368,4 +368,22 @@ create table t1 select now() - now(), curtime() - curtime(), show create table t1; drop table t1; -# End of 4.1 tests +# +# Bug #19844 time_format in Union truncates values +# + +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H); +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H); +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H); + +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H) +union +(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H); + +--echo End of 4.1 tests diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 44d9b422263..febc92e34f6 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1600,14 +1600,12 @@ uint Item_func_date_format::format_length(const String *format) case 'u': /* week (00..52), where week starts with Monday */ case 'V': /* week 1..53 used with 'x' */ case 'v': /* week 1..53 used with 'x', where week starts with Monday */ - case 'H': /* hour (00..23) */ case 'y': /* year, numeric, 2 digits */ case 'm': /* month, numeric */ case 'd': /* day (of the month), numeric */ case 'h': /* hour (01..12) */ case 'I': /* --||-- */ case 'i': /* minutes, numeric */ - case 'k': /* hour ( 0..23) */ case 'l': /* hour ( 1..12) */ case 'p': /* locale's AM or PM */ case 'S': /* second (00..61) */ @@ -1616,6 +1614,10 @@ uint Item_func_date_format::format_length(const String *format) case 'e': /* day (0..31) */ size += 2; break; + case 'k': /* hour ( 0..23) */ + case 'H': /* hour (00..23; value > 23 OK, padding always 2-digit) */ + size += 7; /* docs allow > 23, range depends on sizeof(unsigned int) */ + break; case 'r': /* time, 12-hour (hh:mm:ss [AP]M) */ size += 11; break; From e26aef9f64d01b6e4face9422274a1058d73a061 Mon Sep 17 00:00:00 2001 From: "Reggie@xgeek." <> Date: Thu, 10 Aug 2006 17:39:01 -0500 Subject: [PATCH 41/68] Some small cleanups that will help get mysql_client_test passing on Windows --- 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 a60a43c2076340053e5e4abe7a256be1f283c316 Mon Sep 17 00:00:00 2001 From: "patg@govinda.patg.net" <> Date: Mon, 14 Aug 2006 08:43:37 -0700 Subject: [PATCH 42/68] Post 5.0engines to 5.1 engines merge fix that didn't make it into that push. --- sql/ha_federated.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_federated.h b/sql/ha_federated.h index 207104f4462..ebdc775d3bf 100644 --- a/sql/ha_federated.h +++ b/sql/ha_federated.h @@ -117,7 +117,7 @@ public: ulonglong table_flags() const { /* fix server to be able to get remote server table flags */ - return (HA_NOT_EXACT_COUNT | HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED + return (HA_PRIMARY_KEY_IN_READ_INDEX | HA_FILE_BASED | HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_CAN_INDEX_BLOBS | HA_NO_PREFIX_CHAR_KEYS | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY); From 91c2e68c2b97bd42bc27f596da2011709db8c736 Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 14 Aug 2006 20:16:47 +0200 Subject: [PATCH 43/68] Bug#21327 OpenSSL-checking in configure - Change $d to $libs as suggested. - Thanks to Michael Prohm for the patch! --- config/ac-macros/openssl.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/ac-macros/openssl.m4 b/config/ac-macros/openssl.m4 index af4305486a3..3130cdc3437 100644 --- a/config/ac-macros/openssl.m4 +++ b/config/ac-macros/openssl.m4 @@ -30,8 +30,8 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [ OPENSSL_INCLUDE=-I$incs fi # Test for libssl using all known library file endings - if test -f $d/libssl.a || test -f $d/libssl.so || \ - test -f $d/libssl.sl || test -f $d/libssl.dylib ; then + if test -f $libs/libssl.a || test -f $libs/libssl.so || \ + test -f $libs/libssl.sl || test -f $libs/libssl.dylib ; then OPENSSL_LIB=$libs fi ;; From 0199dda5a6c0433fadbf99d8695d4925513a5fe5 Mon Sep 17 00:00:00 2001 From: "rburnett@production.mysql.com" <> Date: Mon, 14 Aug 2006 20:48:37 +0200 Subject: [PATCH 44/68] 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 | 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); From 4c57a94b78691397904261f78ef9e1e966d127c1 Mon Sep 17 00:00:00 2001 From: "acurtis/antony@xiphis.org/ltantony.xiphis.org" <> Date: Tue, 15 Aug 2006 01:54:14 -0700 Subject: [PATCH 45/68] fix windows build --- sql/field.cc | 2 +- sql/field.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/field.cc b/sql/field.cc index 8395b8c6145..4fea6a085bb 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6412,7 +6412,7 @@ void Field_varstring::sql_type(String &res) const } -uint Field_varstring::data_length(const char *from) +uint32 Field_varstring::data_length(const char *from) { return length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); } diff --git a/sql/field.h b/sql/field.h index 2ad564fc753..65e747e9d2f 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1107,7 +1107,7 @@ public: int key_cmp(const byte *str, uint length); uint packed_col_length(const char *to, uint length); uint max_packed_col_length(uint max_length); - uint data_length(const char *from); + uint32 data_length(const char *from); uint size_of() const { return sizeof(*this); } enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; } bool has_charset(void) const From 34425870b897af07ff755bcb8ebdf6d4e32652b5 Mon Sep 17 00:00:00 2001 From: "anozdrin/alik@alik." <> Date: Tue, 15 Aug 2006 16:57:46 +0400 Subject: [PATCH 46/68] Fix for BUG#21247: im_instance_conf.imtest fails on trees with test-1 in their name. The problem was that IM-tests contained grep-statements with too wide patterns. The fix is to make these patterns more restrictive. Only IM-tests have been fixed, no code has been touched. --- mysql-test/t/im_instance_conf.imtest | 54 ++++++++++++++-------------- mysql-test/t/im_options.imtest | 48 ++++++++++++------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/mysql-test/t/im_instance_conf.imtest b/mysql-test/t/im_instance_conf.imtest index 3d254b16ca5..abd22c1ba9d 100644 --- a/mysql-test/t/im_instance_conf.imtest +++ b/mysql-test/t/im_instance_conf.imtest @@ -37,7 +37,7 @@ # Check that the configuration file contains only instances that we expect. --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- # Check that mysqld1 is reported as running. @@ -79,7 +79,7 @@ CREATE INSTANCE mysqld3 SHOW INSTANCES; --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- # Check that CREATE INSTANCE fails for existing instance. Let's all three @@ -101,7 +101,7 @@ CREATE INSTANCE mysqld3; # - without values; --echo -------------------------------------------------------------------- ---exec grep nonguarded $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^nonguarded\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- CREATE INSTANCE mysqld4 @@ -112,15 +112,15 @@ CREATE INSTANCE mysqld4 SHOW INSTANCES; --echo -------------------------------------------------------------------- ---exec grep nonguarded $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^nonguarded\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- # - with value; --echo -------------------------------------------------------------------- ---exec grep test-A $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-A\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep test-B $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-B\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- CREATE INSTANCE mysqld5 @@ -132,9 +132,9 @@ CREATE INSTANCE mysqld5 SHOW INSTANCES; --echo -------------------------------------------------------------------- ---exec grep test-A $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-A\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-B $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-B\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- # Check that CREATE INSTANCE parses options and handles grammar errors @@ -144,7 +144,7 @@ SHOW INSTANCES; # - check handling of extra spaces; --echo -------------------------------------------------------------------- ---exec grep test-C $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-C\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- CREATE INSTANCE mysqld6 @@ -156,17 +156,17 @@ CREATE INSTANCE mysqld6 SHOW INSTANCES; --echo -------------------------------------------------------------------- ---exec grep test-C1 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-C1\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-C2 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-C2\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- # - check handling of grammar error; --echo -------------------------------------------------------------------- ---exec grep test-D $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-D\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep test-E $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-E\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- --error ER_SYNTAX_ERROR @@ -182,21 +182,21 @@ CREATE INSTANCE mysqld8 test-F = ; SHOW INSTANCES; --echo -------------------------------------------------------------------- ---exec grep test-D $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-D\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep test-E $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-E\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- # - check parsing of string option values --echo -------------------------------------------------------------------- ---exec grep test-1 $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-1\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep test-2 $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-2\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep test-3 $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-3\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep test-4 $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-4\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- CREATE INSTANCE mysqld9 @@ -233,21 +233,21 @@ CREATE INSTANCE mysqld13 test-bad=' \ '; SHOW INSTANCES; --echo -------------------------------------------------------------------- ---exec grep test-1 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-1\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-2 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-2\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-3 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-3\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-4 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-4\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-5 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-5\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-6 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-6\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-7 $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^test-7\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- ---exec grep test-bad $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^test-bad\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- diff --git a/mysql-test/t/im_options.imtest b/mysql-test/t/im_options.imtest index 55bd29c9ee1..fbead0b290c 100644 --- a/mysql-test/t/im_options.imtest +++ b/mysql-test/t/im_options.imtest @@ -43,7 +43,7 @@ # - check the configuration file; --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- # - check the running instances. @@ -133,25 +133,25 @@ UNSET mysqld2.server_id = 11; SET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc = 0010, mysqld3.ddd = 0020; --echo -------------------------------------------------------------------- ---exec grep aaa $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- ---exec grep bbb $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- ---exec grep ccc $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- ---exec grep ddd $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^ddd\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd; --echo -------------------------------------------------------------------- ---exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep ccc $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep ddd $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^ddd\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- # - check that if some instance name is invalid or the active is active, @@ -161,22 +161,22 @@ UNSET mysqld2.aaa, mysqld3.bbb, mysqld2.ccc, mysqld3.ddd; SET mysqld2.aaa, mysqld3.bbb, mysqld.ccc = 0010; --echo -------------------------------------------------------------------- ---exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep ccc $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- --error 3015 # ER_INSTANCE_IS_ACTIVE SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010; --echo -------------------------------------------------------------------- ---exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep ccc $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^ccc\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- # - check that if some instance name is invalid or the active is active, @@ -186,14 +186,14 @@ SET mysqld2.aaa, mysqld3.bbb, mysqld1.ccc = 0010; UNSET mysqld2.server_id, mysqld3.server_id, mysqld.ccc; --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- --error 3015 # ER_INSTANCE_IS_ACTIVE UNSET mysqld2.server_id, mysqld3.server_id, mysqld1.ccc; --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf; --echo -------------------------------------------------------------------- DROP INSTANCE mysqld3; @@ -207,21 +207,21 @@ SET mysqld2 . server_id = 222 ; SET mysqld2 . server_id = 222 , mysqld2 . aaa , mysqld2 . bbb ; --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- ---exec grep aaa $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- ---exec grep bbb $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- UNSET mysqld2 . aaa , mysqld2 . bbb ; --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- ---exec grep aaa $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^aaa\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ---exec grep bbb $MYSQLTEST_VARDIR/im.cnf || true; +--exec grep '^bbb\>' $MYSQLTEST_VARDIR/im.cnf || true; --echo -------------------------------------------------------------------- ########################################################################### @@ -235,7 +235,7 @@ UNSET mysqld2 . aaa , mysqld2 . bbb ; # server_id=SERVER_ID for mysqld2); --echo -------------------------------------------------------------------- ---exec grep server_id $MYSQLTEST_VARDIR/im.cnf ; +--exec grep '^server_id\>' $MYSQLTEST_VARDIR/im.cnf ; --echo -------------------------------------------------------------------- # - (for mysqld1) check that the running instance has not been affected: From ba1ac55acffbcbf4ebe547642c3a3bea39bb6d6d Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Wed, 16 Aug 2006 15:25:30 +0200 Subject: [PATCH 47/68] Bug#20219 make bin-dist produces unportable for testing tarball - Setup LD_LIBRARY_PATH to favor local libs --- mysql-test/mysql-test-run.pl | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c31b35c07d8..afd79e9c887 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1178,28 +1178,33 @@ sub executable_setup () { sub environment_setup () { - # -------------------------------------------------------------------------- - # We might not use a standard installation directory, like /usr/lib. - # Set LD_LIBRARY_PATH to make sure we find our installed libraries. - # -------------------------------------------------------------------------- + my $extra_ld_library_paths; - unless ( $opt_source_dist ) + # -------------------------------------------------------------------------- + # Setup LD_LIBRARY_PATH so the libraries from this distro/clone + # are used in favor of the system installed ones + # -------------------------------------------------------------------------- + if ( $opt_source_dist ) { - $ENV{'LD_LIBRARY_PATH'}= - "$glob_basedir/lib" . - ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); - $ENV{'DYLD_LIBRARY_PATH'}= - "$glob_basedir/lib" . - ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : ""); + $extra_ld_library_paths= "$glob_basedir/libmysql/.libs/"; + } + else + { + $extra_ld_library_paths= "$glob_basedir/lib"; } # -------------------------------------------------------------------------- # Add the path where mysqld will find udf_example.so # -------------------------------------------------------------------------- - $ENV{'LD_LIBRARY_PATH'}= - ($lib_udf_example ? dirname($lib_udf_example) : "") . - ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); + $extra_ld_library_paths .= ":" . + ($lib_udf_example ? dirname($lib_udf_example) : ""); + $ENV{'LD_LIBRARY_PATH'}= + "$extra_ld_library_paths" . + ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : ""); + $ENV{'DYLD_LIBRARY_PATH'}= + "$extra_ld_library_paths" . + ($ENV{'DYLD_LIBRARY_PATH'} ? ":$ENV{'DYLD_LIBRARY_PATH'}" : ""); # -------------------------------------------------------------------------- # Also command lines in .opt files may contain env vars From 98eaa07600d57cd2fdcac150b97cfe1ebac94ea3 Mon Sep 17 00:00:00 2001 From: "msvensson@shellback.(none)" <> Date: Wed, 16 Aug 2006 17:03:41 +0200 Subject: [PATCH 48/68] Bug#20328 mysql client: dumb about trailing spaces on 'help' command Fix testcase to also work on windows --- mysql-test/r/mysql.result | 8 +++++ mysql-test/r/mysql_client.result | 56 -------------------------------- mysql-test/t/mysql.test | 48 +++++++++++++++++++++++++-- mysql-test/t/mysql_client.test | 46 -------------------------- 4 files changed, 54 insertions(+), 104 deletions(-) delete mode 100644 mysql-test/r/mysql_client.result delete mode 100644 mysql-test/t/mysql_client.test diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index c133e4eb2cb..ba4e9daf7cb 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -114,4 +114,12 @@ a int(11) YES NULL b varchar(255) YES NULL c int(11) YES NULL drop table t1; +1 +1 +ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +ERROR at line 1: USE must be followed by a database name +\ +\\ +'; +'; End of 5.0 tests diff --git a/mysql-test/r/mysql_client.result b/mysql-test/r/mysql_client.result deleted file mode 100644 index 01a8c731bc9..00000000000 --- a/mysql-test/r/mysql_client.result +++ /dev/null @@ -1,56 +0,0 @@ -1 -1 -ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -ERROR at line 1: USE must be followed by a database name -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. -warnings (\W) Show warnings after every statement. -nowarning (\w) Don't show warnings after every statement. -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets. -warnings (\W) Show warnings after every statement. -nowarning (\w) Don't show warnings after every statement. -\ -\\ -'; -'; diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index cf6f72570ff..385c59d1503 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -94,6 +94,50 @@ drop table t1; --exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1 --enable_parsing + +# +# Bug #20432: mysql client interprets commands in comments +# + +# if the client sees the 'use' within the comment, we haven't fixed +--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# SQL can have embedded comments => workie +--exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# client commands on the other hand must be at BOL => error +--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql +--error 1 +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# client comment recognized, but parameter missing => error +--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# +# Bug #20328: mysql client interprets commands in comments +# +--exec $MYSQL -e 'help' > $MYSQLTEST_VARDIR/tmp/bug20328_1.result +--exec $MYSQL -e 'help ' > $MYSQLTEST_VARDIR/tmp/bug20328_2.result +--exec diff $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result + +# +# Bug #20103: Escaping with backslash does not work +# +--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 + +--exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 + --echo End of 5.0 tests - - diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test deleted file mode 100644 index 7953e0b6550..00000000000 --- a/mysql-test/t/mysql_client.test +++ /dev/null @@ -1,46 +0,0 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc - -# -# Bug #20432: mysql client interprets commands in comments -# - -# if the client sees the 'use' within the comment, we haven't fixed ---exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# SQL can have embedded comments => workie ---exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# client commands on the other hand must be at BOL => error ---exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql ---error 1 ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# client comment recognized, but parameter missing => error ---exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 - -# -# Bug #20328: mysql client interprets commands in comments -# ---exec echo 'help' | $MYSQL ---exec echo 'help ' | $MYSQL - -# -# Bug #20103: Escaping with backslash does not work -# ---exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 - ---exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1 From 55165b2f551039013fef67ad69b81f238b52e5f7 Mon Sep 17 00:00:00 2001 From: "reggie@big_geek." <> Date: Wed, 16 Aug 2006 10:19:48 -0500 Subject: [PATCH 49/68] small fix to enable the test suite to find executables and scripts on Windows --- mysql-test/lib/mtr_misc.pl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index b5a2e5a4a68..0ab09a40b37 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -83,7 +83,14 @@ sub mtr_path_exists (@) { sub mtr_script_exists (@) { foreach my $path ( @_ ) { - return $path if -x $path; + if($::glob_win32) + { + return $path if -f $path; + } + else + { + return $path if -x $path; + } } if ( @_ == 1 ) { @@ -108,7 +115,14 @@ sub mtr_exe_exists (@) { map {$_.= ".exe"} @path if $::glob_win32; foreach my $path ( @path ) { - return $path if -x $path; + if($::glob_win32) + { + return $path if -f $path; + } + else + { + return $path if -x $path; + } } if ( @path == 1 ) { From 370f22418b194fe1aec4fec016386b942b2b4d5c Mon Sep 17 00:00:00 2001 From: "pgalbraith/patg@govinda.patg.net" <> Date: Wed, 16 Aug 2006 10:47:53 -0700 Subject: [PATCH 50/68] merge 5.0 -> 5.1, re-enabling federated, disabled partition --- mysql-test/t/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 359092b43b3..644c379d746 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -21,6 +21,7 @@ ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t ndb_binlog_ignore_db : BUG#21279 2006-07-25 ingo Randomly throws a warning ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed ndb_restore_compat : BUG#21283 2006-07-26 ingo Test fails randomly +partition : BUG#21658 2006-08-16 Partition test fails, --ps-protocol partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table ps : BUG#21524 2006-08-08 pgalbraith 'ps' test fails in --ps-protocol test AMD64 bit ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open @@ -44,4 +45,3 @@ rpl_row_basic_7ndb : BUG#21298 2006-07-27 msvensson rpl_truncate_7ndb : BUG#21298 2006-07-27 msvensson crash_commit_before : 2006-08-02 msvensson rpl_ndb_dd_advance : BUG#18679 2006-07-28 jimw (Test fails randomly) -federated_transactions : Need to be re-enabled once Patrick's merge is complete From a86f035a08c4a6e2925ef14e4cce011ec8f8262f Mon Sep 17 00:00:00 2001 From: "iggy@rolltop.ignatz42.dyndns.org" <> Date: Wed, 16 Aug 2006 13:55:16 -0400 Subject: [PATCH 51/68] Bug#20328 - Correction to test/result for broken Windows build. --- mysql-test/r/mysql_client.result | 44 -------------------------------- mysql-test/t/mysql_client.test | 6 ++--- 2 files changed, 3 insertions(+), 47 deletions(-) diff --git a/mysql-test/r/mysql_client.result b/mysql-test/r/mysql_client.result index 00d7b6df3cf..87d09428ff6 100644 --- a/mysql-test/r/mysql_client.result +++ b/mysql-test/r/mysql_client.result @@ -2,47 +2,3 @@ 1 ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 ERROR at line 1: USE must be followed by a database name -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set query delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset_name(\C) Switch to another charset. Might be needed for processing binlog. -? (\?) Synonym for `help'. -clear (\c) Clear command. -connect (\r) Reconnect to the server. Optional arguments are db and host. -delimiter (\d) Set query delimiter. -edit (\e) Edit command with $EDITOR. -ego (\G) Send command to mysql server, display result vertically. -exit (\q) Exit mysql. Same as quit. -go (\g) Send command to mysql server. -help (\h) Display this help. -nopager (\n) Disable pager, print to stdout. -notee (\t) Don't write into outfile. -pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. -print (\p) Print current command. -prompt (\R) Change your mysql prompt. -quit (\q) Quit mysql. -rehash (\#) Rebuild completion hash. -source (\.) Execute an SQL script file. Takes a file name as an argument. -status (\s) Get status information from the server. -system (\!) Execute a system shell command. -tee (\T) Set outfile [to_outfile]. Append everything into given outfile. -use (\u) Use another database. Takes database name as argument. -charset_name(\C) Switch to another charset. Might be needed for processing binlog. diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test index 9cdf5aea64b..b382357dacf 100644 --- a/mysql-test/t/mysql_client.test +++ b/mysql-test/t/mysql_client.test @@ -29,7 +29,7 @@ --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 # -# Bug #20328: mysql client interprets commands in comments +# Bug #20328: mysql client: dumb about trailing spaces on 'help' command # ---exec echo 'help' | $MYSQL ---exec echo 'help ' | $MYSQL +--exec echo 'help' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp +--exec echo 'help ' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp From af844dbed6b8377bc93dc4efc1bd8b9816d6d259 Mon Sep 17 00:00:00 2001 From: "iggy@rolltop.ignatz42.dyndns.org" <> Date: Wed, 16 Aug 2006 19:19:49 -0400 Subject: [PATCH 52/68] manual merge --- sql/sql_acl.cc | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 947eebaa7e8..2bd53d4da32 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -4727,6 +4727,7 @@ ACL_USER *check_acl_user(LEX_USER *user_name, static int modify_grant_table(TABLE *table, Field *host_field, Field *user_field, LEX_USER *user_to) +{ int error; DBUG_ENTER("modify_grant_table"); @@ -4747,8 +4748,11 @@ static int modify_grant_table(TABLE *table, Field *host_field, if ((error=table->file->delete_row(table->record[0]))) table->file->print_error(error, MYF(0)); } + DBUG_RETURN(error); } + + /* Handle a privilege table. @@ -4837,12 +4841,14 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, DBUG_PRINT("info",("read result: %d", result)); } else + { /* The non-'user' table do not have indexes on (host, user). And their host- and user fields are not consecutive. Thus, we need to do a table scan to find all matching records. */ if ((error= table->file->ha_rnd_init(1))) + { table->file->print_error(error, MYF(0)); result= -1; } @@ -5046,6 +5052,7 @@ static int handle_grant_struct(uint struct_no, bool drop, acl_db->user= strdup_root(&mem, user_to->user.str); acl_db->host.hostname= strdup_root(&mem, user_to->host.str); break; + case 2: case 3: grant_name->user= strdup_root(&mem, user_to->user.str); @@ -5055,6 +5062,7 @@ static int handle_grant_struct(uint struct_no, bool drop, } } else + { /* If search is requested, we do not need to search further. */ break; } @@ -5062,6 +5070,7 @@ static int handle_grant_struct(uint struct_no, bool drop, #ifdef EXTRA_DEBUG DBUG_PRINT("loop",("scan struct: %u result %d", struct_no, result)); #endif + DBUG_RETURN(result); } @@ -5113,6 +5122,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, /* If search is requested, we do not need to search further. */ if (! drop && ! user_to) goto end; + } } /* Handle db table. */ @@ -5171,8 +5181,10 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, /* Handle columns table. */ if ((found= handle_grant_table(tables, 3, drop, user_from, user_to)) < 0) + { /* Handle of table failed, don't touch the in-memory array. */ result= -1; + } else { /* Handle columns hash. */ @@ -5220,6 +5232,7 @@ bool mysql_create_user(THD *thd, List &list) List_iterator user_list(list); TABLE_LIST tables[GRANT_TABLES]; DBUG_ENTER("mysql_create_user"); + /* CREATE USER may be skipped on replication client. */ if ((result= open_grant_tables(thd, tables))) DBUG_RETURN(result != 1); @@ -5248,15 +5261,18 @@ bool mysql_create_user(THD *thd, List &list) for a mention of the new user name. */ if (handle_grant_data(tables, 0, user_name, NULL)) + { append_user(&wrong_users, user_name); result= TRUE; continue; } + sql_mode= thd->variables.sql_mode; if (replace_user_table(thd, tables[0].table, *user_name, 0, 0, 1, 0)) { append_user(&wrong_users, user_name); result= TRUE; + } } VOID(pthread_mutex_unlock(&acl_cache->lock)); @@ -5306,9 +5322,12 @@ bool mysql_drop_user(THD *thd, List &list) continue; } if (handle_grant_data(tables, 1, user_name, NULL) <= 0) + { append_user(&wrong_users, user_name); result= TRUE; + } } + /* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */ rebuild_check_host(); @@ -5376,16 +5395,14 @@ bool mysql_rename_user(THD *thd, List &list) append_user(&wrong_users, user_from); result= TRUE; } - + } + /* Rebuild 'acl_check_hosts' since 'acl_users' has been modified */ rebuild_check_host(); - VOID(pthread_mutex_unlock(&acl_cache->lock)); rw_unlock(&LOCK_grant); close_thread_tables(thd); - if (result) - my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr_safe()); if (result) my_error(ER_CANNOT_USER, MYF(0), "RENAME USER", wrong_users.c_ptr_safe()); DBUG_RETURN(result); From ceb7cb55e76d22f5da5cd17ca30b6925ba321877 Mon Sep 17 00:00:00 2001 From: "pgalbraith/patg@govinda.patg.net" <> Date: Wed, 16 Aug 2006 17:16:36 -0700 Subject: [PATCH 53/68] test result changes (non-functional) for 5.1-5.0 merge --- mysql-test/r/federated_transactions.result | 2 +- mysql-test/r/warnings.result | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/federated_transactions.result b/mysql-test/r/federated_transactions.result index e6714210ded..40644e3535e 100644 --- a/mysql-test/r/federated_transactions.result +++ b/mysql-test/r/federated_transactions.result @@ -16,7 +16,7 @@ CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, `name` varchar(32) NOT NULL default '' ) -DEFAULT CHARSET=latin1 ENGINE=InnoDB; +DEFAULT CHARSET=latin1 ENGINE=innodb; DROP TABLE IF EXISTS federated.t1; Warnings: Note 1051 Unknown table 't1' diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index a2161a02475..16a7f1a84da 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -72,7 +72,7 @@ drop table t1; create table t1(a tinyint, b int not null, c date, d char(5)); load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ','; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 +Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 3 Warning 1265 Data truncated for column 'c' at row 4 Warning 1261 Row 5 doesn't contain data for all columns From dd1d46c2cdd19b0113b81f7187d94c68a184f6e2 Mon Sep 17 00:00:00 2001 From: "pgalbraith/patg@govinda.patg.net" <> Date: Wed, 16 Aug 2006 20:39:33 -0700 Subject: [PATCH 54/68] merge warning test results (!) --- mysql-test/r/warnings.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 16a7f1a84da..26b3c1625aa 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -72,7 +72,7 @@ drop table t1; create table t1(a tinyint, b int not null, c date, d char(5)); load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ','; Warnings: -Warning 1263 Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 2 +Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2 Warning 1265 Data truncated for column 'd' at row 3 Warning 1265 Data truncated for column 'c' at row 4 Warning 1261 Row 5 doesn't contain data for all columns From 081b865936cfd5f6470da6cd25e0478fb4ff5fd1 Mon Sep 17 00:00:00 2001 From: "andrey@example.com" <> Date: Thu, 17 Aug 2006 18:13:45 +0200 Subject: [PATCH 55/68] Cleanup patch. There is an existing macros for initializing LEX_STRINGs with constant strings -> C_STRING_WITH_LEN. Change existing code to use it. (char *) STRING_WITH_LEN -> C_STRING_WITH_LEN --- sql/handler.cc | 10 ++-- sql/item.cc | 2 +- sql/mysql_priv.h | 2 +- sql/sql_acl.cc | 126 +++++++++++++++++++++---------------------- sql/sql_error.cc | 10 ++-- sql/sql_error.h | 2 +- sql/sql_lex.h | 10 ++-- sql/sql_parse.cc | 70 ++++++++++++------------ sql/sql_partition.cc | 12 ++--- sql/sql_plugin.cc | 6 +-- sql/sql_show.cc | 10 ++-- sql/sql_trigger.cc | 24 ++++----- sql/sql_view.cc | 26 ++++----- sql/tztime.cc | 10 ++-- 14 files changed, 160 insertions(+), 160 deletions(-) diff --git a/sql/handler.cc b/sql/handler.cc index fbccfe7fa46..e1fb8e07a05 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -72,11 +72,11 @@ ulong savepoint_alloc_size= 0; static const LEX_STRING sys_table_aliases[]= { - {(char*)STRING_WITH_LEN("INNOBASE")}, {(char*)STRING_WITH_LEN("INNODB")}, - {(char*)STRING_WITH_LEN("NDB")}, {(char*)STRING_WITH_LEN("NDBCLUSTER")}, - {(char*)STRING_WITH_LEN("BDB")}, {(char*)STRING_WITH_LEN("BERKELEYDB")}, - {(char*)STRING_WITH_LEN("HEAP")}, {(char*)STRING_WITH_LEN("MEMORY")}, - {(char*)STRING_WITH_LEN("MERGE")}, {(char*)STRING_WITH_LEN("MRG_MYISAM")}, + { C_STRING_WITH_LEN("INNOBASE") }, { C_STRING_WITH_LEN("INNODB") }, + { C_STRING_WITH_LEN("NDB") }, { C_STRING_WITH_LEN("NDBCLUSTER") }, + { C_STRING_WITH_LEN("BDB") }, { C_STRING_WITH_LEN("BERKELEYDB") }, + { C_STRING_WITH_LEN("HEAP") }, { C_STRING_WITH_LEN("MEMORY") }, + { C_STRING_WITH_LEN("MERGE") }, { C_STRING_WITH_LEN("MRG_MYISAM")}, {NullS, 0} }; diff --git a/sql/item.cc b/sql/item.cc index 1afe25b1990..4d6dc8ae754 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1004,7 +1004,7 @@ bool Item_splocal::set_value(THD *thd, sp_rcontext *ctx, Item **it) *****************************************************************************/ Item_case_expr::Item_case_expr(int case_expr_id) - :Item_sp_variable((char *) STRING_WITH_LEN("case_expr")), + :Item_sp_variable( C_STRING_WITH_LEN("case_expr")), m_case_expr_id(case_expr_id) { } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a9ecbb23a27..651b0405842 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1479,7 +1479,7 @@ extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH], def_ft_boolean_syntax[sizeof(ft_boolean_syntax)]; #define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list)) extern MY_TMPDIR mysql_tmpdir_list; -extern LEX_STRING command_name[]; +extern const LEX_STRING command_name[]; extern const char *first_keyword, *my_localhost, *delayed_user, *binary_keyword; extern const char **errmesg; /* Error messages */ extern const char *myisam_recover_options_str; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 966d0f88ca3..402cfc4de60 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -36,114 +36,114 @@ time_t mysql_db_table_last_check= 0L; TABLE_FIELD_W_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = { { - {(char *) STRING_WITH_LEN("Host")}, - {(char *) STRING_WITH_LEN("char(60)")}, + { C_STRING_WITH_LEN("Host") }, + { C_STRING_WITH_LEN("char(60)") }, {NULL, 0} }, { - {(char *) STRING_WITH_LEN("Db")}, - {(char *) STRING_WITH_LEN("char(64)")}, + { C_STRING_WITH_LEN("Db") }, + { C_STRING_WITH_LEN("char(64)") }, {NULL, 0} }, { - {(char *) STRING_WITH_LEN("User")}, - {(char *) STRING_WITH_LEN("char(16)")}, + { C_STRING_WITH_LEN("User") }, + { C_STRING_WITH_LEN("char(16)") }, {NULL, 0} }, { - {(char *) STRING_WITH_LEN("Select_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Select_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Insert_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Insert_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Update_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Update_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Delete_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Delete_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Create_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Create_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Drop_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Drop_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Grant_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Grant_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("References_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("References_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Index_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Index_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Alter_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Alter_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Create_tmp_table_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Create_tmp_table_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Lock_tables_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Lock_tables_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Create_view_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Create_view_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Show_view_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Show_view_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Create_routine_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Create_routine_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Alter_routine_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Alter_routine_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Execute_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Execute_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Event_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Event_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } }, { - {(char *) STRING_WITH_LEN("Trigger_priv")}, - {(char *) STRING_WITH_LEN("enum('N','Y')")}, - {(char *) STRING_WITH_LEN("utf8")} + { C_STRING_WITH_LEN("Trigger_priv") }, + { C_STRING_WITH_LEN("enum('N','Y')") }, + { C_STRING_WITH_LEN("utf8") } } }; diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 58763881ecf..9a9a9784df3 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -212,12 +212,12 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, TRUE Error sending data to client */ -LEX_STRING warning_level_names[]= +const LEX_STRING warning_level_names[]= { - {(char*) STRING_WITH_LEN("Note")}, - {(char*) STRING_WITH_LEN("Warning")}, - {(char*) STRING_WITH_LEN("Error")}, - {(char*) STRING_WITH_LEN("?")} + { C_STRING_WITH_LEN("Note") }, + { C_STRING_WITH_LEN("Warning") }, + { C_STRING_WITH_LEN("Error") }, + { C_STRING_WITH_LEN("?") } }; bool mysqld_show_warnings(THD *thd, ulong levels_to_show) diff --git a/sql/sql_error.h b/sql/sql_error.h index b5cac24d894..f4a7b14ba1a 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -41,4 +41,4 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, void mysql_reset_errors(THD *thd, bool force); bool mysqld_show_warnings(THD *thd, ulong levels_to_show); -extern LEX_STRING warning_level_names[]; +extern const LEX_STRING warning_level_names[]; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 55dc6cb55a4..5c0a88542b8 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -149,11 +149,11 @@ enum enum_sp_data_access const LEX_STRING sp_data_access_name[]= { - { (char*) STRING_WITH_LEN("") }, - { (char*) STRING_WITH_LEN("CONTAINS SQL") }, - { (char*) STRING_WITH_LEN("NO SQL") }, - { (char*) STRING_WITH_LEN("READS SQL DATA") }, - { (char*) STRING_WITH_LEN("MODIFIES SQL DATA") } + { C_STRING_WITH_LEN("") }, + { C_STRING_WITH_LEN("CONTAINS SQL") }, + { C_STRING_WITH_LEN("NO SQL") }, + { C_STRING_WITH_LEN("READS SQL DATA") }, + { C_STRING_WITH_LEN("MODIFIES SQL DATA") } }; #define DERIVED_SUBQUERY 1 diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1af80f2c4b0..b5154d60ed2 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -72,38 +72,38 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables); const char *any_db="*any*"; // Special symbol for check_access -LEX_STRING command_name[]={ - (char *)STRING_WITH_LEN("Sleep"), - (char *)STRING_WITH_LEN("Quit"), - (char *)STRING_WITH_LEN("Init DB"), - (char *)STRING_WITH_LEN("Query"), - (char *)STRING_WITH_LEN("Field List"), - (char *)STRING_WITH_LEN("Create DB"), - (char *)STRING_WITH_LEN("Drop DB"), - (char *)STRING_WITH_LEN("Refresh"), - (char *)STRING_WITH_LEN("Shutdown"), - (char *)STRING_WITH_LEN("Statistics"), - (char *)STRING_WITH_LEN("Processlist"), - (char *)STRING_WITH_LEN("Connect"), - (char *)STRING_WITH_LEN("Kill"), - (char *)STRING_WITH_LEN("Debug"), - (char *)STRING_WITH_LEN("Ping"), - (char *)STRING_WITH_LEN("Time"), - (char *)STRING_WITH_LEN("Delayed insert"), - (char *)STRING_WITH_LEN("Change user"), - (char *)STRING_WITH_LEN("Binlog Dump"), - (char *)STRING_WITH_LEN("Table Dump"), - (char *)STRING_WITH_LEN("Connect Out"), - (char *)STRING_WITH_LEN("Register Slave"), - (char *)STRING_WITH_LEN("Prepare"), - (char *)STRING_WITH_LEN("Execute"), - (char *)STRING_WITH_LEN("Long Data"), - (char *)STRING_WITH_LEN("Close stmt"), - (char *)STRING_WITH_LEN("Reset stmt"), - (char *)STRING_WITH_LEN("Set option"), - (char *)STRING_WITH_LEN("Fetch"), - (char *)STRING_WITH_LEN("Daemon"), - (char *)STRING_WITH_LEN("Error") // Last command number +const LEX_STRING command_name[]={ + C_STRING_WITH_LEN("Sleep"), + C_STRING_WITH_LEN("Quit"), + C_STRING_WITH_LEN("Init DB"), + C_STRING_WITH_LEN("Query"), + C_STRING_WITH_LEN("Field List"), + C_STRING_WITH_LEN("Create DB"), + C_STRING_WITH_LEN("Drop DB"), + C_STRING_WITH_LEN("Refresh"), + C_STRING_WITH_LEN("Shutdown"), + C_STRING_WITH_LEN("Statistics"), + C_STRING_WITH_LEN("Processlist"), + C_STRING_WITH_LEN("Connect"), + C_STRING_WITH_LEN("Kill"), + C_STRING_WITH_LEN("Debug"), + C_STRING_WITH_LEN("Ping"), + C_STRING_WITH_LEN("Time"), + C_STRING_WITH_LEN("Delayed insert"), + C_STRING_WITH_LEN("Change user"), + C_STRING_WITH_LEN("Binlog Dump"), + C_STRING_WITH_LEN("Table Dump"), + C_STRING_WITH_LEN("Connect Out"), + C_STRING_WITH_LEN("Register Slave"), + C_STRING_WITH_LEN("Prepare"), + C_STRING_WITH_LEN("Execute"), + C_STRING_WITH_LEN("Long Data"), + C_STRING_WITH_LEN("Close stmt"), + C_STRING_WITH_LEN("Reset stmt"), + C_STRING_WITH_LEN("Set option"), + C_STRING_WITH_LEN("Fetch"), + C_STRING_WITH_LEN("Daemon"), + C_STRING_WITH_LEN("Error") // Last command number }; const char *xa_state_names[]={ @@ -4940,9 +4940,9 @@ end_with_restore_list: { String buff; const LEX_STRING command[3]= - {{(char *)STRING_WITH_LEN("CREATE ")}, - {(char *)STRING_WITH_LEN("ALTER ")}, - {(char *)STRING_WITH_LEN("CREATE OR REPLACE ")}}; + {{ C_STRING_WITH_LEN("CREATE ") }, + { C_STRING_WITH_LEN("ALTER ") }, + { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; thd->clear_error(); buff.append(command[thd->lex->create_view_mode].str, diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 73091c0994e..69a345bf2a4 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -46,12 +46,12 @@ */ const LEX_STRING partition_keywords[]= { - { (char *) STRING_WITH_LEN("HASH") }, - { (char *) STRING_WITH_LEN("RANGE") }, - { (char *) STRING_WITH_LEN("LIST") }, - { (char *) STRING_WITH_LEN("KEY") }, - { (char *) STRING_WITH_LEN("MAXVALUE") }, - { (char *) STRING_WITH_LEN("LINEAR ") } + { C_STRING_WITH_LEN("HASH") }, + { C_STRING_WITH_LEN("RANGE") }, + { C_STRING_WITH_LEN("LIST") }, + { C_STRING_WITH_LEN("KEY") }, + { C_STRING_WITH_LEN("MAXVALUE") }, + { C_STRING_WITH_LEN("LINEAR ") } }; static const char *part_str= "PARTITION"; static const char *sub_str= "SUB"; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index f7205470abd..8dc00908fc5 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -25,9 +25,9 @@ char *opt_plugin_dir_ptr; char opt_plugin_dir[FN_REFLEN]; const LEX_STRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]= { - { (char *)STRING_WITH_LEN("UDF") }, - { (char *)STRING_WITH_LEN("STORAGE ENGINE") }, - { (char *)STRING_WITH_LEN("FTPARSER") } + { C_STRING_WITH_LEN("UDF") }, + { C_STRING_WITH_LEN("STORAGE ENGINE") }, + { C_STRING_WITH_LEN("FTPARSER") } }; plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]= diff --git a/sql/sql_show.cc b/sql/sql_show.cc index bf09f516499..530315b507b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2159,7 +2159,7 @@ LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str, /* INFORMATION_SCHEMA name */ -LEX_STRING information_schema_name= {(char*)"information_schema", 18}; +LEX_STRING information_schema_name= { C_STRING_WITH_LEN("information_schema")}; /* This is only used internally, but we need it here as a forward reference */ extern ST_SCHEMA_TABLE schema_tables[]; @@ -3189,10 +3189,10 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin, if (!(wild && wild[0] && wild_case_compare(scs, plugin->name.str,wild))) { - LEX_STRING state[2]= {{(char*) STRING_WITH_LEN("ENABLED")}, - {(char*) STRING_WITH_LEN("DISABLED")}}; - LEX_STRING yesno[2]= {{(char*) STRING_WITH_LEN("NO")}, - {(char*) STRING_WITH_LEN("YES")}}; + LEX_STRING state[2]= {{ C_STRING_WITH_LEN("ENABLED") }, + { C_STRING_WITH_LEN("DISABLED") }}; + LEX_STRING yesno[2]= {{ C_STRING_WITH_LEN("NO") }, + { C_STRING_WITH_LEN("YES") }}; LEX_STRING *tmp; restore_record(table, s->default_values); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 1837372c6c4..e990b7bc86d 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -22,7 +22,7 @@ #include "parse_file.h" static const LEX_STRING triggers_file_type= - {(char *) STRING_WITH_LEN("TRIGGERS")}; + { C_STRING_WITH_LEN("TRIGGERS") }; const char * const triggers_file_ext= ".TRG"; @@ -35,17 +35,17 @@ const char * const triggers_file_ext= ".TRG"; static File_option triggers_file_parameters[]= { { - {(char *) STRING_WITH_LEN("triggers") }, + { C_STRING_WITH_LEN("triggers") }, offsetof(class Table_triggers_list, definitions_list), FILE_OPTIONS_STRLIST }, { - {(char *) STRING_WITH_LEN("sql_modes") }, + { C_STRING_WITH_LEN("sql_modes") }, offsetof(class Table_triggers_list, definition_modes_list), FILE_OPTIONS_ULLLIST }, { - {(char *) STRING_WITH_LEN("definers") }, + { C_STRING_WITH_LEN("definers") }, offsetof(class Table_triggers_list, definers_list), FILE_OPTIONS_STRLIST }, @@ -54,7 +54,7 @@ static File_option triggers_file_parameters[]= File_option sql_modes_parameters= { - {(char*) STRING_WITH_LEN("sql_modes") }, + { C_STRING_WITH_LEN("sql_modes") }, offsetof(class Table_triggers_list, definition_modes_list), FILE_OPTIONS_ULLLIST }; @@ -78,14 +78,14 @@ struct st_trigname }; static const LEX_STRING trigname_file_type= - {(char *) STRING_WITH_LEN("TRIGGERNAME")}; + { C_STRING_WITH_LEN("TRIGGERNAME") }; const char * const trigname_file_ext= ".TRN"; static File_option trigname_file_parameters[]= { { - {(char *) STRING_WITH_LEN("trigger_table")}, + { C_STRING_WITH_LEN("trigger_table")}, offsetof(struct st_trigname, trigger_table), FILE_OPTIONS_ESTRING }, @@ -95,15 +95,15 @@ static File_option trigname_file_parameters[]= const LEX_STRING trg_action_time_type_names[]= { - { (char *) STRING_WITH_LEN("BEFORE") }, - { (char *) STRING_WITH_LEN("AFTER") } + { C_STRING_WITH_LEN("BEFORE") }, + { C_STRING_WITH_LEN("AFTER") } }; const LEX_STRING trg_event_type_names[]= { - { (char *) STRING_WITH_LEN("INSERT") }, - { (char *) STRING_WITH_LEN("UPDATE") }, - { (char *) STRING_WITH_LEN("DELETE") } + { C_STRING_WITH_LEN("INSERT") }, + { C_STRING_WITH_LEN("UPDATE") }, + { C_STRING_WITH_LEN("DELETE") } }; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 09a199b2738..66258fca945 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -25,7 +25,7 @@ #define MD5_BUFF_LENGTH 33 -const LEX_STRING view_type= { (char*) STRING_WITH_LEN("VIEW") }; +const LEX_STRING view_type= { C_STRING_WITH_LEN("VIEW") }; static int mysql_register_view(THD *thd, TABLE_LIST *view, enum_view_create_mode mode); @@ -579,40 +579,40 @@ static const int num_view_backups= 3; parse() */ static File_option view_parameters[]= -{{{(char*) STRING_WITH_LEN("query")}, +{{{ C_STRING_WITH_LEN("query")}, offsetof(TABLE_LIST, query), FILE_OPTIONS_ESTRING}, - {{(char*) STRING_WITH_LEN("md5")}, + {{ C_STRING_WITH_LEN("md5")}, offsetof(TABLE_LIST, md5), FILE_OPTIONS_STRING}, - {{(char*) STRING_WITH_LEN("updatable")}, + {{ C_STRING_WITH_LEN("updatable")}, offsetof(TABLE_LIST, updatable_view), FILE_OPTIONS_ULONGLONG}, - {{(char*) STRING_WITH_LEN("algorithm")}, + {{ C_STRING_WITH_LEN("algorithm")}, offsetof(TABLE_LIST, algorithm), FILE_OPTIONS_ULONGLONG}, - {{(char*) STRING_WITH_LEN("definer_user")}, + {{ C_STRING_WITH_LEN("definer_user")}, offsetof(TABLE_LIST, definer.user), FILE_OPTIONS_STRING}, - {{(char*) STRING_WITH_LEN("definer_host")}, + {{ C_STRING_WITH_LEN("definer_host")}, offsetof(TABLE_LIST, definer.host), FILE_OPTIONS_STRING}, - {{(char*) STRING_WITH_LEN("suid")}, + {{ C_STRING_WITH_LEN("suid")}, offsetof(TABLE_LIST, view_suid), FILE_OPTIONS_ULONGLONG}, - {{(char*) STRING_WITH_LEN("with_check_option")}, + {{ C_STRING_WITH_LEN("with_check_option")}, offsetof(TABLE_LIST, with_check), FILE_OPTIONS_ULONGLONG}, - {{(char*) STRING_WITH_LEN("revision")}, + {{ C_STRING_WITH_LEN("revision")}, offsetof(TABLE_LIST, revision), FILE_OPTIONS_REV}, - {{(char*) STRING_WITH_LEN("timestamp")}, + {{ C_STRING_WITH_LEN("timestamp")}, offsetof(TABLE_LIST, timestamp), FILE_OPTIONS_TIMESTAMP}, - {{(char*)STRING_WITH_LEN("create-version")}, + {{ C_STRING_WITH_LEN("create-version")}, offsetof(TABLE_LIST, file_version), FILE_OPTIONS_ULONGLONG}, - {{(char*) STRING_WITH_LEN("source")}, + {{ C_STRING_WITH_LEN("source")}, offsetof(TABLE_LIST, source), FILE_OPTIONS_ESTRING}, {{NullS, 0}, 0, diff --git a/sql/tztime.cc b/sql/tztime.cc index 4f6542bd043..a1bcf25bb51 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1389,15 +1389,15 @@ static bool time_zone_tables_exist= 1; static const LEX_STRING tz_tables_names[MY_TZ_TABLES_COUNT]= { - {(char *) STRING_WITH_LEN("time_zone_name")}, - {(char *) STRING_WITH_LEN("time_zone")}, - {(char *) STRING_WITH_LEN("time_zone_transition_type")}, - {(char *) STRING_WITH_LEN("time_zone_transition")} + { C_STRING_WITH_LEN("time_zone_name")}, + { C_STRING_WITH_LEN("time_zone")}, + { C_STRING_WITH_LEN("time_zone_transition_type")}, + { C_STRING_WITH_LEN("time_zone_transition")} }; /* Name of database to which those tables belong. */ -static const LEX_STRING tz_tables_db_name= {(char *) STRING_WITH_LEN("mysql")}; +static const LEX_STRING tz_tables_db_name= { C_STRING_WITH_LEN("mysql")}; class Tz_names_entry: public Sql_alloc From 9d531c4f4309c7f71fb73832692b61a9b9e99e8f Mon Sep 17 00:00:00 2001 From: "rburnett@bk-internal.mysql.com" <> Date: Thu, 17 Aug 2006 18:50:58 +0200 Subject: [PATCH 56/68] rename to avoid case sensitive collision From 284fa931bb328344b25c983d7bd8b654f02d426b Mon Sep 17 00:00:00 2001 From: "rburnett@production.mysql.com" <> Date: Thu, 17 Aug 2006 22:24:35 +0200 Subject: [PATCH 57/68] A couple of adjustments to the merge to fix the broken build instance.cc: Removed wrongly placed closing brace item_geofunc.cc: needed to pass in a TABLE_SHARE* instead of a TABLE* --- server-tools/instance-manager/instance.cc | 1 - sql/item_geofunc.cc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 33a31cfd97e..53f859ef7ae 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -512,7 +512,6 @@ int Instance::stop() */ waitchild= options.shutdown_delay_val; } - } kill_instance(SIGTERM); /* sleep on condition to wait for SIGCHLD */ diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index c5200e26cb7..ee4df8f1cfc 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -27,7 +27,7 @@ Field *Item_geometry_func::tmp_table_field(TABLE *t_arg) { - return new Field_geom(max_length, maybe_null, name, t_arg, + return new Field_geom(max_length, maybe_null, name, t_arg->s, (Field::geometry_type) get_geometry_type()); } From 1f79db41fa5b1a5e36e3d536e26b543ed91a345c Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Fri, 18 Aug 2006 18:24:38 +0200 Subject: [PATCH 58/68] mysql-test-run.pl : Fix the search path for "ndb_mgmd" and "ndbd". bug#21721 --- mysql-test/mysql-test-run.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 0d8739a4613..bcd03a2f0ff 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1299,8 +1299,10 @@ sub executable_setup () { $path_ndb_tools_dir= "$glob_basedir/bin"; $exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm"; $exe_ndb_waiter= "$glob_basedir/bin/ndb_waiter"; - $exe_ndbd= "$glob_basedir/libexec/ndbd"; - $exe_ndb_mgmd= "$glob_basedir/libexec/ndb_mgmd"; + $exe_ndbd= mtr_exe_exists("$glob_basedir/libexec/ndbd", + "$glob_basedir/bin/ndbd"); + $exe_ndb_mgmd= mtr_exe_exists("$glob_basedir/libexec/ndb_mgmd", + "$glob_basedir/bin/ndb_mgmd"); } $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld; From cf76884b38917ca685c7d44f891163ac70b16acb Mon Sep 17 00:00:00 2001 From: "holyfoot/hf@mysql.com/deer.(none)" <> Date: Fri, 18 Aug 2006 22:29:35 +0500 Subject: [PATCH 59/68] Fix for the failing gis.test --- mysql-test/r/gis.result | 2 +- sql/item_geofunc.cc | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 76e1bd323ae..6b700d0c947 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -578,7 +578,7 @@ create table t1 select GeomFromWKB(POINT(1,3)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `GeomFromWKB(POINT(1,3))` geometry NOT NULL default '' + `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` diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index ee4df8f1cfc..ef71dc9b8b5 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -27,8 +27,11 @@ Field *Item_geometry_func::tmp_table_field(TABLE *t_arg) { - return new Field_geom(max_length, maybe_null, name, t_arg->s, - (Field::geometry_type) get_geometry_type()); + Field *result; + if ((result= new Field_geom(max_length, maybe_null, name, t_arg->s, + (Field::geometry_type) get_geometry_type()))) + result->init(t_arg); + return result; } void Item_geometry_func::fix_length_and_dec() From 56443ae20122579ae6eeceb98e5bf3bd2a57a3e3 Mon Sep 17 00:00:00 2001 From: "jpipes@shakedown.(none)" <> Date: Sun, 20 Aug 2006 17:24:48 -0400 Subject: [PATCH 60/68] Fix for bug #21642: "configure" with no arguments does not build --- sql/set_var.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/set_var.cc b/sql/set_var.cc index 7243b7cbbe1..de418dba735 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -487,7 +487,7 @@ sys_var_const_str sys_version_compile_os("version_compile_os", SYSTEM_TYPE); sys_var_thd_ulong sys_net_wait_timeout("wait_timeout", &SV::net_wait_timeout); - +#ifdef WITH_INNOBASE_STORAGE_ENGINE sys_var_long_ptr sys_innodb_fast_shutdown("innodb_fast_shutdown", &innobase_fast_shutdown); sys_var_long_ptr sys_innodb_max_dirty_pages_pct("innodb_max_dirty_pages_pct", @@ -513,7 +513,7 @@ sys_var_long_ptr sys_innodb_commit_concurrency("innodb_commit_concurrency", sys_var_long_ptr sys_innodb_flush_log_at_trx_commit( "innodb_flush_log_at_trx_commit", &srv_flush_log_at_trx_commit); - +#endif /* Condition pushdown to storage engine */ sys_var_thd_bool sys_engine_condition_pushdown("engine_condition_pushdown", @@ -816,6 +816,7 @@ SHOW_VAR init_vars[]= { {"init_connect", (char*) &sys_init_connect, SHOW_SYS}, {"init_file", (char*) &opt_init_file, SHOW_CHAR_PTR}, {"init_slave", (char*) &sys_init_slave, SHOW_SYS}, +#ifdef WITH_INNOBASE_STORAGE_ENGINE {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG }, {sys_innodb_autoextend_increment.name, (char*) &sys_innodb_autoextend_increment, SHOW_SYS}, {"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG }, @@ -849,6 +850,7 @@ SHOW_VAR init_vars[]= { {sys_innodb_thread_concurrency.name, (char*) &sys_innodb_thread_concurrency, SHOW_SYS}, {sys_innodb_thread_sleep_delay.name, (char*) &sys_innodb_thread_sleep_delay, SHOW_SYS}, {sys_innodb_flush_log_at_trx_commit.name, (char*) &sys_innodb_flush_log_at_trx_commit, SHOW_SYS}, +#endif {sys_interactive_timeout.name,(char*) &sys_interactive_timeout, SHOW_SYS}, {sys_join_buffer_size.name, (char*) &sys_join_buffer_size, SHOW_SYS}, {sys_key_buffer_size.name, (char*) &sys_key_buffer_size, SHOW_SYS}, From 186fa6c2918598d5216ffca21e5044de5f472112 Mon Sep 17 00:00:00 2001 From: "dlenev@mockturtle.local" <> Date: Mon, 21 Aug 2006 12:18:59 +0400 Subject: [PATCH 61/68] Fix for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes server to crash". Crash caused by assertion failure happened when one ran SHOW OPEN TABLES while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE or any other command that takes name-lock) in other connection. For non-debug version of server problem exposed itself as wrong output of SHOW OPEN TABLES statement (it was missing name-locked tables). Finally in 5.1 both debug and non-debug versions simply crashed in this situation due to NULL-pointer dereference. This problem was caused by the fact that table placeholders which were added to table cache in order to obtain name-lock had TABLE_SHARE::table_name set to 0. Therefore they broke assumption that this member is non-0 for all tables in table cache which was checked by assert in list_open_tables() (in 5.1 this function simply relies on it). The fix simply sets this member for such placeholders to appropriate value making this assumption true again. This patch also includes test for similar bug 12212 "Crash that happens during removing of database name from cache" reappeared in 5.1 as bug 19403. --- mysql-test/r/drop.result | 13 +++++++++++++ mysql-test/t/drop.test | 41 ++++++++++++++++++++++++++++++++++++++++ sql/lock.cc | 7 +++++-- 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 979e5d48871..d122dabc4ec 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -72,3 +72,16 @@ show tables; Tables_in_test t1 drop table t1; +drop database if exists mysqltest; +drop table if exists t1; +create table t1 (i int); +lock tables t1 read; +create database mysqltest; + drop table t1; +show open tables; + drop database mysqltest; +select 1; +1 +1 +unlock tables; +End of 5.0 tests diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index 7cd943d46da..a1451773e90 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -81,3 +81,44 @@ show tables; drop table t1; # End of 4.1 tests + + +# +# Test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes +# server to crash". Crash (caused by failed assertion in 5.0 or by null +# pointer dereference in 5.1) happened when one ran SHOW OPEN TABLES +# while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE +# or any other command that takes name-lock) in other connection. +# +# Also includes test for similar bug#12212 "Crash that happens during +# removing of database name from cache" reappeared in 5.1 as bug#19403 +# In its case crash happened when one concurrently executed DROP DATABASE +# and one of name-locking command. +# +--disable_warnings +drop database if exists mysqltest; +drop table if exists t1; +--enable_warnings +create table t1 (i int); +lock tables t1 read; +create database mysqltest; +connect (addconroot1, localhost, root,,); +--send drop table t1 +connect (addconroot2, localhost, root,,); +# Server should not crash in any of the following statements +--disable_result_log +show open tables; +--enable_result_log +--send drop database mysqltest +connection default; +select 1; +unlock tables; +connection addconroot1; +--reap +connection addconroot2; +--reap +disconnect addconroot1; +disconnect addconroot2; +connection default; + +--echo End of 5.0 tests diff --git a/sql/lock.cc b/sql/lock.cc index 97a080c5634..90ddcc957a2 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -854,6 +854,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) TABLE *table; char key[MAX_DBKEY_LENGTH]; char *db= table_list->db; + int table_in_key_offset; uint key_length; HASH_SEARCH_STATE state; DBUG_ENTER("lock_table_name"); @@ -861,8 +862,9 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) safe_mutex_assert_owner(&LOCK_open); - key_length=(uint) (strmov(strmov(key,db)+1,table_list->table_name) - -key)+ 1; + table_in_key_offset= strmov(key, db) - key + 1; + key_length= (uint)(strmov(key + table_in_key_offset, table_list->table_name) + - key) + 1; /* Only insert the table if we haven't insert it already */ @@ -883,6 +885,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) table->s= &table->share_not_to_be_used; memcpy((table->s->table_cache_key= (char*) (table+1)), key, key_length); table->s->db= table->s->table_cache_key; + table->s->table_name= table->s->table_cache_key + table_in_key_offset; table->s->key_length=key_length; table->in_use=thd; table->locked_by_name=1; From b329f2c3ef142c460333e914062b14f3aa2a3e64 Mon Sep 17 00:00:00 2001 From: "kent@mysql.com/g4-2.local" <> Date: Mon, 21 Aug 2006 15:34:29 +0200 Subject: [PATCH 62/68] Many files: Deleted config/ac-macros/ha_berkeley.m4 Removed more referenses to bdb --- BUILD/FINISH.sh | 2 +- BUILD/compile-alpha-cxx | 2 +- BUILD/compile-alpha-debug | 2 +- BUILD/compile-dist | 1 - BUILD/compile-ia64-debug-max | 2 +- CMakeLists.txt | 4 - Makefile.am | 6 +- config/ac-macros/ha_berkeley.m4 | 263 ---------------------- libmysqld/lib_sql.cc | 6 +- sql/mysql_priv.h | 2 - storage/ndb/config/win-prg.am | 2 +- storage/ndb/test/run-test/ndb-autotest.sh | 2 - support-files/my-huge.cnf.sh | 4 - support-files/my-large.cnf.sh | 4 - support-files/my-medium.cnf.sh | 4 - 15 files changed, 7 insertions(+), 299 deletions(-) delete mode 100644 config/ac-macros/ha_berkeley.m4 diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh index a0e702515e6..51f6e909172 100644 --- a/BUILD/FINISH.sh +++ b/BUILD/FINISH.sh @@ -5,7 +5,7 @@ configure="./configure $base_configs $extra_configs" commands="\ $make -k distclean || true -/bin/rm -rf */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache bdb/dist/autom4te.cache autom4te.cache innobase/autom4te.cache; +/bin/rm -rf */.deps/*.P config.cache storage/innobase/config.cache autom4te.cache innobase/autom4te.cache; path=`dirname $0` . \"$path/autorun.sh\"" diff --git a/BUILD/compile-alpha-cxx b/BUILD/compile-alpha-cxx index 610d358ef82..1624f4ed622 100755 --- a/BUILD/compile-alpha-cxx +++ b/BUILD/compile-alpha-cxx @@ -1,7 +1,7 @@ /bin/rm -f */.deps/*.P */*.o make -k clean /bin/rm -f */.deps/*.P */*.o -/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache mysql-*.tar.gz +/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz path=`dirname $0` . "$path/autorun.sh" diff --git a/BUILD/compile-alpha-debug b/BUILD/compile-alpha-debug index 8beffa65cb5..b565a18272f 100755 --- a/BUILD/compile-alpha-debug +++ b/BUILD/compile-alpha-debug @@ -1,7 +1,7 @@ /bin/rm -f */.deps/*.P */*.o make -k clean /bin/rm -f */.deps/*.P */*.o -/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache mysql-*.tar.gz +/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache mysql-*.tar.gz path=`dirname $0` . "$path/autorun.sh" diff --git a/BUILD/compile-dist b/BUILD/compile-dist index 874500977b7..0504b308ceb 100755 --- a/BUILD/compile-dist +++ b/BUILD/compile-dist @@ -7,7 +7,6 @@ # package" that is used as the basis for all other binary builds. # test -f Makefile && make distclean -(cd storage/bdb/dist && sh s_all) (cd storage/innobase && aclocal && autoheader && \ libtoolize --automake --force --copy && \ automake --force --add-missing --copy && autoconf) diff --git a/BUILD/compile-ia64-debug-max b/BUILD/compile-ia64-debug-max index d5f931c8d51..d1017ad506b 100755 --- a/BUILD/compile-ia64-debug-max +++ b/BUILD/compile-ia64-debug-max @@ -1,5 +1,5 @@ gmake -k clean || true -/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache storage/bdb/build_unix/config.cache +/bin/rm -f */.deps/*.P config.cache storage/innobase/config.cache path=`dirname $0` . "$path/autorun.sh" diff --git a/CMakeLists.txt b/CMakeLists.txt index ec744e975c7..30742d444ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,10 +49,6 @@ IF(WITH_FEDERATED_STORAGE_ENGINE) ADD_DEFINITIONS(-D WITH_FEDERATED_STORAGE_ENGINE) SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_federated_plugin") ENDIF(WITH_FEDERATED_STORAGE_ENGINE) -IF(WITH_BERKELEY_STORAGE_ENGINE) - ADD_DEFINITIONS(-D WITH_BERKELEY_STORAGE_ENGINE) - SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_berkeley_plugin") -ENDIF(WITH_BERKELEY_STORAGE_ENGINE) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc @ONLY) diff --git a/Makefile.am b/Makefile.am index 8a575b3c365..4adc06acad7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,11 +39,7 @@ BUILT_SOURCES = linked_client_sources linked_server_sources \ @linked_libmysqld_targets@ \ linked_include_sources @linked_netware_sources@ -# The db.h file is a bit special, see note in "configure.in". -# In the case we didn't compile with bdb, a dummy file is put -# there, but will not be removed by the bdb make file becuase -# it will never be called. -CLEANFILES = $(BUILT_SOURCES) bdb/build_unix/db.h +CLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = ac_available_languages_fragment linked_include_sources: diff --git a/config/ac-macros/ha_berkeley.m4 b/config/ac-macros/ha_berkeley.m4 deleted file mode 100644 index c7d99bd8e03..00000000000 --- a/config/ac-macros/ha_berkeley.m4 +++ /dev/null @@ -1,263 +0,0 @@ -dnl --------------------------------------------------------------------------- -dnl Macro: MYSQL_CHECK_BDB -dnl Sets HAVE_BERKELEY_DB if inst library is found -dnl Makes sure db version is correct. -dnl Looks in $srcdir for Berkeley distribution if not told otherwise -dnl --------------------------------------------------------------------------- - - -AC_DEFUN([MYSQL_SETUP_BERKELEY_DB], [ - AC_ARG_WITH([berkeley-db], - AS_HELP_STRING([--with-berkeley-db[[[[[=DIR]]]]]], - [Use BerkeleyDB located in DIR]), - [bdb="$withval"], - [bdb=yes]) - - AC_ARG_WITH([berkeley-db-includes], - AS_HELP_STRING([--with-berkeley-db-includes=DIR], - [Find Berkeley DB headers in DIR]), - [bdb_includes="$withval"], - [bdb_includes=default]) - - AC_ARG_WITH([berkeley-db-libs], - AS_HELP_STRING([--with-berkeley-db-libs=DIR], - [Find Berkeley DB libraries in DIR]), - [bdb_libs="$withval"], - [bdb_libs=default]) - - # echo " bdb $bdb $bdb_includes---$bdb_libs " - case "$bdb" in - yes ) - case "$bdb_includes---$bdb_libs" in - default---default ) - mode=search-$bdb - ;; - default---* | *---default | yes---* | *---yes ) - AC_MSG_ERROR([if either 'includes' or 'libs' is specified, both must be specified]) - ;; - * ) - mode=supplied-two - ;; - esac - ;; - * ) - mode=supplied-one - ;; - esac - - case $mode in - supplied-two ) - MYSQL_CHECK_INSTALLED_BDB([$bdb_includes], [$bdb_libs]) - case $bdb_dir_ok in - installed ) mode=yes ;; - * ) AC_MSG_ERROR([didn't find valid BerkeleyDB: $bdb_dir_ok]) ;; - esac - ;; - supplied-one ) - MYSQL_CHECK_BDB_DIR([$bdb]) - case $bdb_dir_ok in - source ) mode=compile ;; - installed ) mode=yes ;; - * ) AC_MSG_ERROR([didn't find valid BerkeleyDB: $bdb_dir_ok]) ;; - esac - ;; - search-* ) - MYSQL_SEARCH_FOR_BDB - case $bdb_dir_ok in - source ) mode=compile ;; - installed ) mode=yes ;; - * ) AC_MSG_ERROR([no suitable BerkeleyDB found]) ;; - esac - ;; - *) - AC_MSG_ERROR([impossible case condition '$mode': please report this to bugs@lists.mysql.com]) - ;; - esac - - case $mode in - yes ) - have_berkeley_db="yes" - AC_MSG_RESULT([Using Berkeley DB in '$bdb_includes']) - ;; - compile ) - have_berkeley_db="$bdb" - AC_MSG_RESULT([Compiling Berekeley DB in '$have_berkeley_db']) - ;; - * ) - AC_MSG_ERROR([impossible case condition '$mode': please report this to bugs@lists.mysql.com]) - ;; - esac - - bdb_conf_flags="--disable-shared --build=$build_alias" - if test $with_debug = "yes" - then - bdb_conf_flags="$bdb_conf_flags --enable-debug --enable-diagnostic" - fi - # NOTICE: if you're compiling BDB, it needs to be a SUBDIR - # of $srcdir (i.e., you can 'cd $srcdir/$bdb'). It won't - # work otherwise. - if test -d "$bdb"; then : - else - # This should only happen when doing a VPATH build - echo "NOTICE: I have to make the BDB directory: `pwd`:$bdb" - mkdir "$bdb" || exit 1 - fi - if test -d "$bdb"/build_unix; then : - else - # This should only happen when doing a VPATH build - echo "NOTICE: I have to make the build_unix directory: `pwd`:$bdb/build_unix" - mkdir "$bdb/build_unix" || exit 1 - fi - rel_srcdir= - case "$srcdir" in - /* ) rel_srcdir="$srcdir" ;; - * ) rel_srcdir="../../../$srcdir" ;; - esac - (cd $bdb/build_unix && \ - sh $rel_srcdir/$bdb/dist/configure $bdb_conf_flags) || \ - AC_MSG_ERROR([could not configure Berkeley DB]) - - AC_SUBST(bdb_includes) - AC_SUBST(bdb_libs) - AC_SUBST(bdb_libs_with_path) -]) - -AC_DEFUN([MYSQL_CHECK_INSTALLED_BDB], [ -dnl echo ["MYSQL_CHECK_INSTALLED_BDB ($1) ($2)"] - inc="$1" - lib="$2" - if test -f "$inc/db.h" - then - MYSQL_CHECK_BDB_VERSION([$inc/db.h], - [.*#define[ ]*], [[ ][ ]*]) - - if test X"$bdb_version_ok" = Xyes; then - save_LDFLAGS="$LDFLAGS" - LDFLAGS="-L$lib $LDFLAGS" - AC_CHECK_LIB(db,db_env_create, [ - bdb_dir_ok=installed - MYSQL_TOP_BUILDDIR([inc]) - MYSQL_TOP_BUILDDIR([lib]) - bdb_includes="-I$inc" - bdb_libs="-L$lib -ldb" - bdb_libs_with_path="$lib/libdb.a" - ]) - LDFLAGS="$save_LDFLAGS" - else - bdb_dir_ok="$bdb_version_ok" - fi - else - bdb_dir_ok="no db.h file in '$inc'" - fi -]) - -AC_DEFUN([MYSQL_CHECK_BDB_DIR], [ -dnl ([$bdb]) -dnl echo ["MYSQL_CHECK_BDB_DIR ($1)"] - dir="$1" - - MYSQL_CHECK_INSTALLED_BDB([$dir/include], [$dir/lib]) - - if test X"$bdb_dir_ok" != Xinstalled; then - # test to see if it's a source dir - rel="$dir/dist/RELEASE" - if test -f "$rel"; then - MYSQL_CHECK_BDB_VERSION([$rel], [], [=]) - if test X"$bdb_version_ok" = Xyes; then - bdb_dir_ok=source - bdb="$dir" - MYSQL_TOP_BUILDDIR([dir]) - bdb_includes="-I$dir/build_unix" - bdb_libs="-L$dir/build_unix -ldb" - bdb_libs_with_path="$dir/build_unix/libdb.a" - else - bdb_dir_ok="$bdb_version_ok" - fi - else - bdb_dir_ok="'$dir' doesn't look like a BDB directory ($bdb_dir_ok)" - fi - fi -]) - -AC_DEFUN([MYSQL_SEARCH_FOR_BDB], [ -dnl echo ["MYSQL_SEARCH_FOR_BDB"] - bdb_dir_ok="no BerkeleyDB found" - - for test_dir in $srcdir/storage/bdb $srcdir/db-*.*.* /usr/local/BerkeleyDB*; do -dnl echo "-----------> Looking at ($test_dir; `cd $test_dir && pwd`)" - MYSQL_CHECK_BDB_DIR([$test_dir]) - if test X"$bdb_dir_ok" = Xsource || test X"$bdb_dir_ok" = Xinstalled; then -dnl echo "-----------> Found it ($bdb), ($srcdir)" -dnl This is needed so that 'make distcheck' works properly (VPATH build). -dnl VPATH build won't work if bdb is not under the source tree; but in -dnl that case, hopefully people will just make and install inside the -dnl tree, or install BDB first, and then use the installed version. - case "$bdb" in - "$srcdir/"* ) bdb=`echo "$bdb" | sed -e "s,^$srcdir/,,"` ;; - esac - break - fi - done -]) - -dnl MYSQL_CHECK_BDB_VERSION takes 3 arguments: -dnl 1) the file to look in -dnl 2) the search pattern before DB_VERSION_XXX -dnl 3) the search pattern between DB_VERSION_XXX and the number -dnl It assumes that the number is the last thing on the line -AC_DEFUN([MYSQL_CHECK_BDB_VERSION], [ - db_major=`sed -e '/^[$2]DB_VERSION_MAJOR[$3]/ !d' -e 's///' [$1]` - db_minor=`sed -e '/^[$2]DB_VERSION_MINOR[$3]/ !d' -e 's///' [$1]` - db_patch=`sed -e '/^[$2]DB_VERSION_PATCH[$3]/ !d' -e 's///' [$1]` - test -z "$db_major" && db_major=0 - test -z "$db_minor" && db_minor=0 - test -z "$db_patch" && db_patch=0 - -dnl # This is ugly, but about as good as it can get -dnl # mysql_bdb= -dnl # if test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 3 -dnl # then -dnl # mysql_bdb=h -dnl # elif test $db_major -eq 3 && test $db_minor -eq 2 && test $db_patch -eq 9 -dnl # then -dnl # want_bdb_version="3.2.9a" # hopefully this will stay up-to-date -dnl # mysql_bdb=a -dnl # fi - -dnl RAM: -want_bdb_version="4.1.24" -bdb_version_ok=yes - -dnl # if test -n "$mysql_bdb" && \ -dnl # grep "DB_VERSION_STRING.*:.*$mysql_bdb: " [$1] > /dev/null -dnl # then -dnl # bdb_version_ok=yes -dnl # else -dnl # bdb_version_ok="invalid version $db_major.$db_minor.$db_patch" -dnl # bdb_version_ok="$bdb_version_ok (must be version 3.2.3h or $want_bdb_version)" -dnl # fi -]) - -AC_DEFUN([MYSQL_TOP_BUILDDIR], [ - case "$[$1]" in - /* ) ;; # don't do anything with an absolute path - "$srcdir"/* ) - # If BDB is under the source directory, we need to look under the - # build directory for bdb/build_unix. - # NOTE: I'm being lazy, and assuming the user did not specify - # something like --with-berkeley-db=bdb (it would be missing "./"). - [$1]="\$(top_builddir)/"`echo "$[$1]" | sed -e "s,^$srcdir/,,"` - ;; - * ) - AC_MSG_ERROR([The BDB directory must be directly under the MySQL source directory, or be specified using the full path. ('$srcdir'; '$[$1]')]) - ;; - esac - if test X"$[$1]" != "/" - then - [$1]=`echo $[$1] | sed -e 's,/$,,'` - fi -]) - -dnl --------------------------------------------------------------------------- -dnl END OF MYSQL_CHECK_BDB SECTION -dnl --------------------------------------------------------------------------- diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 6f9165f5018..5ac2c163c4e 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -524,11 +524,7 @@ int init_embedded_server(int argc, char **argv, char **groups) (void) thr_setconcurrency(concurrency); // 10 by default - if ( -#ifdef HAVE_BERKELEY_DB - (have_berkeley_db == SHOW_OPTION_YES) || -#endif - (flush_time && flush_time != ~(ulong) 0L)) + if (flush_time && flush_time != ~(ulong) 0L) { pthread_t hThread; if (pthread_create(&hThread,&connection_attrib,handle_manager,0)) diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 4910f66ff69..7de6f6d04e0 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1378,8 +1378,6 @@ bool mysql_load(THD *thd, sql_exchange *ex, TABLE_LIST *table_list, int write_record(THD *thd, TABLE *table, COPY_INFO *info); /* sql_manager.cc */ -/* bits set in manager_status */ -#define MANAGER_BERKELEY_LOG_CLEANUP (1L << 0) extern ulong volatile manager_status; extern bool volatile manager_thread_in_use, mqh_used; extern pthread_t manager_thread; diff --git a/storage/ndb/config/win-prg.am b/storage/ndb/config/win-prg.am index 10a8cfbca02..70c19a70c6d 100644 --- a/storage/ndb/config/win-prg.am +++ b/storage/ndb/config/win-prg.am @@ -71,7 +71,7 @@ LINK32=xilink6.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "NDB_WIN32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c +# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c # ADD BASE CPP @includes@ # ADD CPP @includes@ # SUBTRACT CPP /Fr /YX diff --git a/storage/ndb/test/run-test/ndb-autotest.sh b/storage/ndb/test/run-test/ndb-autotest.sh index 544897a2aa2..289f1045b21 100755 --- a/storage/ndb/test/run-test/ndb-autotest.sh +++ b/storage/ndb/test/run-test/ndb-autotest.sh @@ -168,10 +168,8 @@ then if [ -d storage ] then (cd storage/innobase; aclocal; autoheader; autoconf; automake) - (cd storage/bdb/dist; sh s_all) else (cd innobase; aclocal; autoheader; autoconf; automake) - (cd bdb/dist; sh s_all) fi fi eval $configure --prefix=$install_dir diff --git a/support-files/my-huge.cnf.sh b/support-files/my-huge.cnf.sh index 5dc3e5a1900..31221ece0ee 100644 --- a/support-files/my-huge.cnf.sh +++ b/support-files/my-huge.cnf.sh @@ -114,10 +114,6 @@ server-id = 1 #tmpdir = /tmp/ #log-update = /path-to-dedicated-directory/hostname -# Uncomment the following if you are using BDB tables -#bdb_cache_size = 384M -#bdb_max_lock = 100000 - # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = @localstatedir@/ #innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend diff --git a/support-files/my-large.cnf.sh b/support-files/my-large.cnf.sh index 769684529e7..6fa4c21f96b 100644 --- a/support-files/my-large.cnf.sh +++ b/support-files/my-large.cnf.sh @@ -114,10 +114,6 @@ server-id = 1 #tmpdir = /tmp/ #log-update = /path-to-dedicated-directory/hostname -# Uncomment the following if you are using BDB tables -#bdb_cache_size = 256M -#bdb_max_lock = 100000 - # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = @localstatedir@/ #innodb_data_file_path = ibdata1:10M:autoextend diff --git a/support-files/my-medium.cnf.sh b/support-files/my-medium.cnf.sh index 7cca12338a2..4a7bfcfc775 100644 --- a/support-files/my-medium.cnf.sh +++ b/support-files/my-medium.cnf.sh @@ -112,10 +112,6 @@ server-id = 1 #tmpdir = /tmp/ #log-update = /path-to-dedicated-directory/hostname -# Uncomment the following if you are using BDB tables -#bdb_cache_size = 16M -#bdb_max_lock = 10000 - # Uncomment the following if you are using InnoDB tables #innodb_data_home_dir = @localstatedir@/ #innodb_data_file_path = ibdata1:10M:autoextend From 47d6296bc74852af8e51168d93591e5c5a8a9d15 Mon Sep 17 00:00:00 2001 From: "joerg@trift2." <> Date: Mon, 21 Aug 2006 16:19:29 +0200 Subject: [PATCH 63/68] mysql-test/mysql-test-run.pl : Use fixed path names for all NDB binaries, because searching for them makes the script abort with all non-NDB builds. --- mysql-test/mysql-test-run.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index bcd03a2f0ff..7d5a3af46a6 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1299,10 +1299,8 @@ sub executable_setup () { $path_ndb_tools_dir= "$glob_basedir/bin"; $exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm"; $exe_ndb_waiter= "$glob_basedir/bin/ndb_waiter"; - $exe_ndbd= mtr_exe_exists("$glob_basedir/libexec/ndbd", - "$glob_basedir/bin/ndbd"); - $exe_ndb_mgmd= mtr_exe_exists("$glob_basedir/libexec/ndb_mgmd", - "$glob_basedir/bin/ndb_mgmd"); + $exe_ndbd= "$glob_basedir/bin/ndbd"; + $exe_ndb_mgmd= "$glob_basedir/bin/ndb_mgmd"; } $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld; From 8fb55ff0cfd891334fc4411763065e827339222f Mon Sep 17 00:00:00 2001 From: "dlenev@mockturtle.local" <> Date: Mon, 21 Aug 2006 19:02:11 +0400 Subject: [PATCH 64/68] Fix for bug#19403/12212 "Crash that happens during removing of database name from cache" and #21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes server to crash". Crash happened when one ran DROP DATABASE or SHOW OPEN TABLES statements while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE or any other command that takes name-lock) in other connection. This problem was caused by the fact that table placeholders which were added to table cache in order to obtain name-lock on table had TABLE_SHARE::db and table_name set to 0. Therefore they broke assumption that these members are non-0 for all tables in table cache on which some of our code relies. The fix sets these members for such placeholders to appropriate value making this assumption true again. As attempt to avoid such problems in future we introduce auxiliary TABLE_SHARE::set_table_cache_key() methods which should be used when one wants to set TABLE_SHARE::table_cache_key and which ensure that TABLE_SHARE::table_name/db are set properly. Test cases for these bugs were added to 5.0 test-suite (with 5.0-specific fix for bug #21216). --- sql/lock.cc | 21 ++++++++------- sql/sql_base.cc | 41 ++++++++---------------------- sql/sql_select.cc | 2 -- sql/table.cc | 20 ++++++--------- sql/table.h | 65 ++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 95 insertions(+), 54 deletions(-) diff --git a/sql/lock.cc b/sql/lock.cc index 8e75ea42f7d..06f538a2a03 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -874,6 +874,8 @@ end: int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use) { TABLE *table; + TABLE_SHARE *share; + char *key_buff; char key[MAX_DBKEY_LENGTH]; char *db= table_list->db; uint key_length; @@ -903,17 +905,18 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use) } /* Create a table entry with the right key and with an old refresh version - Note that we must use my_malloc() here as this is freed by the table - cache + Note that we must use my_multi_malloc() here as this is freed by the + table cache */ - if (!(table= (TABLE*) my_malloc(sizeof(*table)+ sizeof(TABLE_SHARE)+ - key_length, MYF(MY_WME | MY_ZEROFILL)))) + if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), + &table, sizeof(*table), + &share, sizeof(*share), + &key_buff, key_length, + NULL)) DBUG_RETURN(-1); - table->s= (TABLE_SHARE*) (table+1); - memcpy((table->s->table_cache_key.str= (char*) (table->s+1)), key, - key_length); - table->s->table_cache_key.length= key_length; - table->s->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table + table->s= share; + share->set_table_cache_key(key_buff, key, key_length); + share->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table table->in_use= thd; table->locked_by_name=1; table_list->table=table; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 1c733e3c12d..32a622c7401 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -634,6 +634,7 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name) static void close_handle_and_leave_table_as_lock(TABLE *table) { TABLE_SHARE *share, *old_share= table->s; + char *key_buff; MEM_ROOT *mem_root= &table->mem_root; DBUG_ENTER("close_handle_and_leave_table_as_lock"); @@ -642,20 +643,14 @@ static void close_handle_and_leave_table_as_lock(TABLE *table) This has to be done to ensure that the table share is removed from the table defintion cache as soon as the last instance is removed */ - if ((share= (TABLE_SHARE*) alloc_root(mem_root, sizeof(*share)))) + if (multi_alloc_root(mem_root, + &share, sizeof(*share), + &key_buff, old_share->table_cache_key.length, + NULL)) { bzero((char*) share, sizeof(*share)); - share->db.str= memdup_root(mem_root, old_share->db.str, - old_share->db.length+1); - share->db.length= old_share->db.length; - share->table_name.str= memdup_root(mem_root, - old_share->table_name.str, - old_share->table_name.length+1); - share->table_name.length= old_share->table_name.length; - share->table_cache_key.str= memdup_root(mem_root, - old_share->table_cache_key.str, - old_share->table_cache_key.length); - share->table_cache_key.length= old_share->table_cache_key.length; + share->set_table_cache_key(key_buff, old_share->table_cache_key.str, + old_share->table_cache_key.length); share->tmp_table= INTERNAL_TMP_TABLE; // for intern_close_table() } @@ -1603,28 +1598,18 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db, const char *table_name) { char *key; + uint key_length; TABLE_SHARE *share= table->s; TABLE_LIST table_list; - uint db_length, table_length; DBUG_ENTER("rename_temporary_table"); - if (!(key=(char*) alloc_root(&share->mem_root, - (uint) (db_length= strlen(db))+ - (uint) (table_length= strlen(table_name))+6+4))) + if (!(key=(char*) alloc_root(&share->mem_root, MAX_DBKEY_LENGTH))) DBUG_RETURN(1); /* purecov: inspected */ table_list.db= (char*) db; table_list.table_name= (char*) table_name; - share->db.str= share->table_cache_key.str= key; - share->db.length= db_length; - share->table_cache_key.length= create_table_def_key(thd, key, - &table_list, 1); - /* - Here we use the fact that table_name is stored as the second component - in the 'key' (after db_name), where components are separated with \0 - */ - share->table_name.str= key+db_length+1; - share->table_name.length= table_length; + key_length= create_table_def_key(thd, key, &table_list, 1); + share->set_table_cache_key(key, key_length); DBUG_RETURN(0); } @@ -1749,10 +1734,7 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) { TABLE *table= table_list->table; TABLE_SHARE *share; - char *db= table_list->db; char *table_name= table_list->table_name; - char key[MAX_DBKEY_LENGTH]; - uint key_length; TABLE orig_table; DBUG_ENTER("reopen_name_locked_table"); @@ -1762,7 +1744,6 @@ bool reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) DBUG_RETURN(TRUE); orig_table= *table; - key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; if (open_unireg_entry(thd, table, table_list, table_name, table->s->table_cache_key.str, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7eda55c6a3f..a882f0b066d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8645,8 +8645,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, share->primary_key= MAX_KEY; // Indicate no primary key share->keys_for_keyread.init(); share->keys_in_use.init(); - /* For easier error reporting */ - share->table_cache_key= share->db; /* Calculate which type of fields we will store in the temporary table */ diff --git a/sql/table.cc b/sql/table.cc index f0a864287b0..179cfb2be14 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -93,6 +93,7 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, { MEM_ROOT mem_root; TABLE_SHARE *share; + char *key_buff, *path_buff; char path[FN_REFLEN]; uint path_length; DBUG_ENTER("alloc_table_share"); @@ -103,22 +104,17 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key, table_list->db, table_list->table_name, "", 0); init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0); - if ((share= (TABLE_SHARE*) alloc_root(&mem_root, - sizeof(*share) + key_length + - path_length +1))) + if (multi_alloc_root(&mem_root, + &share, sizeof(*share), + &key_buff, key_length, + &path_buff, path_length + 1, + NULL)) { bzero((char*) share, sizeof(*share)); - share->table_cache_key.str= (char*) (share+1); - share->table_cache_key.length= key_length; - memcpy(share->table_cache_key.str, key, key_length); - /* Use the fact the key is db/0/table_name/0 */ - share->db.str= share->table_cache_key.str; - share->db.length= strlen(share->db.str); - share->table_name.str= share->db.str + share->db.length + 1; - share->table_name.length= strlen(share->table_name.str); + share->set_table_cache_key(key_buff, key, key_length); - share->path.str= share->table_cache_key.str+ key_length; + share->path.str= path_buff; share->path.length= path_length; strmov(share->path.str, path); share->normalized_path.str= share->path.str; diff --git a/sql/table.h b/sql/table.h index 7675c27823b..c13a23468ae 100644 --- a/sql/table.h +++ b/sql/table.h @@ -138,7 +138,16 @@ typedef struct st_table_share CHARSET_INFO *table_charset; /* Default charset of string fields */ MY_BITMAP all_set; - /* A pair "database_name\0table_name\0", widely used as simply a db name */ + /* + Key which is used for looking-up table in table cache and in the list + of thread's temporary tables. Has the form of: + "database_name\0table_name\0" + optional part for temporary tables. + + Note that all three 'table_cache_key', 'db' and 'table_name' members + must be set (and be non-zero) for tables in table cache. They also + should correspond to each other. + To ensure this one can use set_table_cache() methods. + */ LEX_STRING table_cache_key; LEX_STRING db; /* Pointer to db */ LEX_STRING table_name; /* Table name (for open) */ @@ -223,6 +232,60 @@ typedef struct st_table_share uint part_state_len; handlerton *default_part_db_type; #endif + + + /* + Set share's table cache key and update its db and table name appropriately. + + SYNOPSIS + set_table_cache_key() + key_buff Buffer with already built table cache key to be + referenced from share. + key_length Key length. + + NOTES + Since 'key_buff' buffer will be referenced from share it should has same + life-time as share itself. + This method automatically ensures that TABLE_SHARE::table_name/db have + appropriate values by using table cache key as their source. + */ + + void set_table_cache_key(char *key_buff, uint key_length) + { + table_cache_key.str= key_buff; + table_cache_key.length= key_length; + /* + Let us use the fact that the key is "db/0/table_name/0" + optional + part for temporary tables. + */ + db.str= table_cache_key.str; + db.length= strlen(db.str); + table_name.str= db.str + db.length + 1; + table_name.length= strlen(table_name.str); + } + + + /* + Set share's table cache key and update its db and table name appropriately. + + SYNOPSIS + set_table_cache_key() + key_buff Buffer to be used as storage for table cache key + (should be at least key_length bytes). + key Value for table cache key. + key_length Key length. + + NOTE + Since 'key_buff' buffer will be used as storage for table cache key + it should has same life-time as share itself. + */ + + void set_table_cache_key(char *key_buff, const char *key, uint key_length) + { + memcpy(key_buff, key, key_length); + set_table_cache_key(key_buff, key_length); + } + } TABLE_SHARE; From b2a95f0dac1d743a5ba8a1a532c2fbbe89f72acb Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Tue, 22 Aug 2006 14:16:39 +0200 Subject: [PATCH 65/68] Update result file for "grant" to 5.1 version --- mysql-test/r/grant.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index b60d238c951..3ac48e4a01f 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -911,7 +911,7 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table ' SHOW CREATE TABLE mysqltest2.t_nn; Table Create Table t_nn CREATE TABLE `t_nn` ( - `c1` int(11) default NULL + `c1` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE VIEW mysqltest2.t_nn; ERROR HY000: 'mysqltest2.t_nn' is not VIEW @@ -930,7 +930,7 @@ v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER SHOW CREATE TABLE mysqltest2.t_nn; Table Create Table t_nn CREATE TABLE `t_nn` ( - `c1` int(11) default NULL + `c1` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE VIEW mysqltest2.t_nn; ERROR HY000: 'mysqltest2.t_nn' is not VIEW From 0ba4ff24efe4e7816a1030f548ba12e685aa6e15 Mon Sep 17 00:00:00 2001 From: "gluh@mysql.com/gluh.(none)" <> Date: Wed, 23 Aug 2006 16:58:36 +0500 Subject: [PATCH 66/68] Bug#20548 Events: crash if InnoDB, multiple events, busy procedures, partitions setup 'share' struct for all partiton file elements. It's neccessary because we use m_file[0]->update_create_info(create_info) during ha_partition::update_create_info and 'share' for m_file[0] should be valid --- sql/ha_partition.cc | 11 +++++++++++ sql/ha_partition.h | 1 + sql/handler.h | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 615c4bfb1bf..b0580d784b0 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1579,6 +1579,17 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) } +void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) +{ + handler **file_array= m_file; + table= table_arg; + table_share= share; + do + { + (*file_array)->change_table_ptr(table_arg, share); + } while (*(++file_array)); +} + /* Change comments specific to handler diff --git a/sql/ha_partition.h b/sql/ha_partition.h index c62f21cfaa1..403a94a0c24 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -199,6 +199,7 @@ public: *no_parts= m_tot_parts; DBUG_RETURN(0); } + virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); private: int prepare_for_delete(); int copy_partitions(ulonglong *copied, ulonglong *deleted); diff --git a/sql/handler.h b/sql/handler.h index 201a2f1980a..523a5db5356 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -983,7 +983,7 @@ public: virtual void print_error(int error, myf errflag); virtual bool get_error_message(int error, String *buf); uint get_dup_key(int error); - void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) + virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) { table= table_arg; table_share= share; From 9c8c1817cebc530cd006ff696d7d619bdffeb019 Mon Sep 17 00:00:00 2001 From: "andrey@example.com" <> Date: Wed, 23 Aug 2006 15:50:06 +0200 Subject: [PATCH 67/68] Fix for bug #20665 All commands supported in Stored Procedures should work in Prepared Statements. Post-review changeset. Problem: There are some commands which are avaiable to be executed in SP but cannot be prepared. This patch fixes this and makes it possible prepare these statements. Changes: The commands later are made available in PS. RESET has been forbidden in SF/Trigger. Solution: All current server commands where checked and those missing (see later) we added. Tests for all of the commands with repeated executions were added - testing with SP, SF and PS. SHOW BINLOG EVENTS SHOW (MASTER | SLAVE) STATUS SHOW (MASTER | BINARY) LOGS SHOW (PROCEDURE | FUNCTION) CODE (parsable only in debug builds) SHOW CREATE (PROCEDURE | FUNCTION | EVENT | TABLE | VIEW) SHOW (AUTHORS | CONTRIBUTORS | WARNINGS | ERRORS) CHANGE MASTER RESET (MASTER | SLAVE | QUERY CACHE) SLAVE (START | STOP) CHECKSUM (TABLE | TABLES) INSTALL PLUGIN UNINSTALL PLUGIN CACHE INDEX LOAD INDEX INTO CACHE GRANT REVOKE KILL (CREATE | RENAME | DROP) DATABASE (CREATE | RENAME | DROP) USER FLUSH (TABLE | TABLES | TABLES WITH READ LOCK | HOSTS | PRIVILEGES | LOGS | STATUS | MASTER | SLAVE | DES_KEY_FILE | USER_RESOURCES) --- mysql-test/r/ps.result | 882 ++++++++++++++++++++++++++++++++ mysql-test/r/ps_1general.result | 12 - mysql-test/r/ps_grant.result | 3 - mysql-test/r/sp-dynamic.result | 4 +- mysql-test/t/ps.test | 871 +++++++++++++++++++++++++++++++ mysql-test/t/ps_1general.test | 24 +- mysql-test/t/ps_grant.test | 3 - sql/sp_head.cc | 15 +- sql/sql_prepare.cc | 33 ++ 9 files changed, 1804 insertions(+), 43 deletions(-) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index b2f5cec896f..5188900579e 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1277,3 +1277,885 @@ ERROR 3D000: No database selected create temporary table t1 (i int); ERROR 3D000: No database selected use test; +create procedure proc_1() reset query cache; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin reset query cache; return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +prepare abc from "reset query cache"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() reset master; +drop procedure proc_1; +create function func_1() returns int begin reset master; return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +prepare abc from "reset master"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() reset slave; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin reset slave; return 1; end| +select func_1(), func_1(), func_1() from dual; +ERROR 0A000: FLUSH is not allowed in stored function or trigger +drop function func_1; +prepare abc from "reset slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1(a integer) kill a; +call proc_1(0); +ERROR HY000: Unknown thread id: 0 +call proc_1(0); +ERROR HY000: Unknown thread id: 0 +call proc_1(0); +ERROR HY000: Unknown thread id: 0 +drop procedure proc_1; +create function func_1() returns int begin kill 0; return 1; end| +select func_1() from dual; +ERROR HY000: Unknown thread id: 0 +select func_1() from dual; +ERROR HY000: Unknown thread id: 0 +select func_1() from dual; +ERROR HY000: Unknown thread id: 0 +drop function func_1; +prepare abc from "kill 0"; +execute abc; +ERROR HY000: Unknown thread id: 0 +execute abc; +ERROR HY000: Unknown thread id: 0 +execute abc; +ERROR HY000: Unknown thread id: 0 +deallocate prepare abc; +create procedure proc_1() flush hosts; +call proc_1(); +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush hosts; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush hosts"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush privileges; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush privileges; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush privileges"; +deallocate prepare abc; +create procedure proc_1() flush tables with read lock; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +drop procedure proc_1; +create function func_1() returns int begin flush tables with read lock; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +prepare abc from "flush tables with read lock"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +unlock tables; +create procedure proc_1() flush tables; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush tables; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush tables"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush tables; +flush tables; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 1 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +call proc_1(); +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 1 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +call proc_1(); +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 1 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +call proc_1(); +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 1 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +flush tables; +drop procedure proc_1; +create function func_1() returns int begin flush tables; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +flush tables; +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +prepare abc from "flush tables"; +execute abc; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 1 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +execute abc; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 1 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +execute abc; +show open tables from mysql; +Database Table In_use Name_locked +mysql general_log 1 0 +select Host, User from mysql.user limit 0; +Host User +select Host, Db from mysql.host limit 0; +Host Db +show open tables from mysql; +Database Table In_use Name_locked +mysql user 0 0 +mysql general_log 1 0 +mysql host 0 0 +flush tables; +deallocate prepare abc; +create procedure proc_1() flush logs; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush logs; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush logs"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush status; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush status; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush status"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush slave; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush slave; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush master; +drop procedure proc_1; +create function func_1() returns int begin flush master; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush master"; +deallocate prepare abc; +create procedure proc_1() flush des_key_file; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush des_key_file; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush des_key_file"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() flush user_resources; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +create function func_1() returns int begin flush user_resources; return 1; end| +ERROR 0A000: FLUSH is not allowed in stored function or trigger +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "flush user_resources"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +create procedure proc_1() start slave; +drop procedure proc_1; +create function func_1() returns int begin start slave; return 1; end| +drop function func_1; +prepare abc from "start slave"; +deallocate prepare abc; +create procedure proc_1() stop slave; +drop procedure proc_1; +create function func_1() returns int begin stop slave; return 1; end| +drop function func_1; +prepare abc from "stop slave"; +deallocate prepare abc; +create procedure proc_1() show binlog events; +drop procedure proc_1; +create function func_1() returns int begin show binlog events; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show binlog events"; +deallocate prepare abc; +create procedure proc_1() show slave status; +drop procedure proc_1; +create function func_1() returns int begin show slave status; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show slave status"; +deallocate prepare abc; +create procedure proc_1() show master status; +drop procedure proc_1; +create function func_1() returns int begin show master status; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show master status"; +deallocate prepare abc; +create procedure proc_1() show master logs; +drop procedure proc_1; +create function func_1() returns int begin show master logs; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show master logs"; +deallocate prepare abc; +create procedure proc_1() show events; +call proc_1(); +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +call proc_1(); +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +call proc_1(); +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +drop procedure proc_1; +create function func_1() returns int begin show events; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show events"; +execute abc; +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +execute abc; +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +execute abc; +Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +deallocate prepare abc; +create procedure proc_1() show scheduler status; +drop procedure proc_1; +create function func_1() returns int begin show scheduler status; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show scheduler status"; +ERROR HY000: This command is not supported in the prepared statement protocol yet +deallocate prepare abc; +ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE +drop procedure if exists a; +create procedure a() select 42; +create procedure proc_1(a char(2)) show create procedure a; +call proc_1("bb"); +Procedure sql_mode Create Procedure +a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 +call proc_1("bb"); +Procedure sql_mode Create Procedure +a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 +call proc_1("bb"); +Procedure sql_mode Create Procedure +a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 +drop procedure proc_1; +create function func_1() returns int begin show create procedure a; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create procedure a"; +execute abc; +Procedure sql_mode Create Procedure +a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 +execute abc; +Procedure sql_mode Create Procedure +a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 +execute abc; +Procedure sql_mode Create Procedure +a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() +select 42 +deallocate prepare abc; +drop procedure a; +drop function if exists a; +create function a() returns int return 42+13; +create procedure proc_1(a char(2)) show create function a; +call proc_1("bb"); +Function sql_mode Create Function +a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 +call proc_1("bb"); +Function sql_mode Create Function +a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 +call proc_1("bb"); +Function sql_mode Create Function +a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 +drop procedure proc_1; +create function func_1() returns int begin show create function a; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create function a"; +execute abc; +Function sql_mode Create Function +a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 +execute abc; +Function sql_mode Create Function +a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 +execute abc; +Function sql_mode Create Function +a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) +return 42+13 +deallocate prepare abc; +drop function a; +drop table if exists tab1; +create table tab1(a int, b char(1), primary key(a,b)); +create procedure proc_1() show create table tab1; +call proc_1(); +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` char(1) NOT NULL DEFAULT '', + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call proc_1(); +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` char(1) NOT NULL DEFAULT '', + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call proc_1(); +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` char(1) NOT NULL DEFAULT '', + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop procedure proc_1; +create function func_1() returns int begin show create table tab1; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create table tab1"; +execute abc; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` char(1) NOT NULL DEFAULT '', + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +execute abc; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` char(1) NOT NULL DEFAULT '', + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +execute abc; +Table Create Table +tab1 CREATE TABLE `tab1` ( + `a` int(11) NOT NULL DEFAULT '0', + `b` char(1) NOT NULL DEFAULT '', + PRIMARY KEY (`a`,`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +deallocate prepare abc; +drop table tab1; +drop view if exists v1; +drop table if exists t1; +create table t1(a int, b char(5)); +insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve"); +create view v1 as +(select a, count(*) from t1 group by a) +union all +(select b, count(*) from t1 group by b); +create procedure proc_1() show create view v1; +call proc_1(); +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +call proc_1(); +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +call proc_1(); +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +drop procedure proc_1; +create function func_1() returns int begin show create view v1; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "show create view v1"; +execute abc; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +execute abc; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +execute abc; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +deallocate prepare abc; +drop view v1; +drop table t1; +create procedure proc_1() install plugin my_plug soname '/root/some_plugin.so'; +call proc_1(); +ERROR HY000: No paths allowed for shared library +call proc_1(); +ERROR HY000: No paths allowed for shared library +call proc_1(); +ERROR HY000: No paths allowed for shared library +drop procedure proc_1; +create procedure proc_1() install plugin my_plug soname 'some_plugin.so'; +call proc_1(); +ERROR HY000: Can't open shared library '/work/mysql-5.1-runtime/mysql-test/lib/mysql/some_plugin.so' (errno: 0 cannot open shared object file: No such file or directory) +call proc_1(); +ERROR HY000: Can't open shared library '/work/mysql-5.1-runtime/mysql-test/lib/mysql/some_plugin.so' (errno: 22 cannot open shared object file: No such file or directory) +call proc_1(); +ERROR HY000: Can't open shared library '/work/mysql-5.1-runtime/mysql-test/lib/mysql/some_plugin.so' (errno: 22 cannot open shared object file: No such file or directory) +drop procedure proc_1; +create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "install plugin my_plug soname '/root/some_plugin.so'"; +execute abc; +ERROR HY000: No paths allowed for shared library +execute abc; +ERROR HY000: No paths allowed for shared library +deallocate prepare abc; +prepare abc from "install plugin my_plug soname 'some_plugin.so'"; +deallocate prepare abc; +create procedure proc_1() uninstall plugin my_plug; +call proc_1(); +ERROR 42000: PLUGIN my_plug does not exist +call proc_1(); +ERROR 42000: PLUGIN my_plug does not exist +call proc_1(); +ERROR 42000: PLUGIN my_plug does not exist +drop procedure proc_1; +create function func_1() returns int begin uninstall plugin my_plug; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "uninstall plugin my_plug"; +execute abc; +ERROR 42000: PLUGIN my_plug does not exist +execute abc; +ERROR 42000: PLUGIN my_plug does not exist +execute abc; +ERROR 42000: PLUGIN my_plug does not exist +deallocate prepare abc; +drop database if exists mysqltest_xyz; +create procedure proc_1() create database mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +call proc_1(); +call proc_1(); +ERROR HY000: Can't create database 'mysqltest_xyz'; database exists +drop database if exists mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +drop procedure proc_1; +create function func_1() returns int begin create database mysqltest_xyz; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "create database mysqltest_xyz"; +execute abc; +drop database if exists mysqltest_xyz; +execute abc; +execute abc; +ERROR HY000: Can't create database 'mysqltest_xyz'; database exists +drop database if exists mysqltest_xyz; +execute abc; +drop database if exists mysqltest_xyz; +deallocate prepare abc; +drop table if exists t1; +create table t1 (a int, b char(5)); +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create procedure proc_1() checksum table xyz; +call proc_1(); +Table Checksum +test.xyz NULL +Warnings: +Error 1146 Table 'test.xyz' doesn't exist +call proc_1(); +Table Checksum +test.xyz NULL +Warnings: +Error 1146 Table 'test.xyz' doesn't exist +call proc_1(); +Table Checksum +test.xyz NULL +Warnings: +Error 1146 Table 'test.xyz' doesn't exist +drop procedure proc_1; +create function func_1() returns int begin checksum table t1; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "checksum table t1"; +execute abc; +Table Checksum +test.t1 645809265 +execute abc; +Table Checksum +test.t1 645809265 +execute abc; +Table Checksum +test.t1 645809265 +deallocate prepare abc; +create procedure proc_1() create user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +call proc_1(); +call proc_1(); +ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost' +drop user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +drop procedure proc_1; +create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "create user pstest_xyz@localhost"; +execute abc; +drop user pstest_xyz@localhost; +execute abc; +execute abc; +ERROR HY000: Operation CREATE USER failed for 'pstest_xyz'@'localhost' +drop user pstest_xyz@localhost; +execute abc; +drop user pstest_xyz@localhost; +deallocate prepare abc; +drop event if exists xyz; +create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +select func_1(), func_1(), func_1() from dual; +ERROR 42000: FUNCTION test.func_1 does not exist +drop function func_1; +ERROR 42000: FUNCTION test.func_1 does not exist +prepare abc from "create event xyz on schedule at now() do select 123"; +ERROR HY000: This command is not supported in the prepared statement protocol yet +deallocate prepare abc; +ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +create procedure proc_1() alter event xyz comment 'xyz'; +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +drop event xyz; +drop procedure proc_1; +create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +prepare abc from "alter event xyz comment 'xyz'"; +ERROR HY000: This command is not supported in the prepared statement protocol yet +deallocate prepare abc; +ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +create procedure proc_1() drop event xyz; +call proc_1(); +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +call proc_1(); +ERROR HY000: Unknown event 'xyz' +drop procedure proc_1; +create function func_1() returns int begin drop event xyz; return 1; end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +prepare abc from "drop event xyz"; +ERROR HY000: This command is not supported in the prepared statement protocol yet +deallocate prepare abc; +ERROR HY000: Unknown prepared statement handler (abc) given to DEALLOCATE PREPARE +drop table if exists t1; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +SET GLOBAL new_cache.key_buffer_size=128*1024; +create procedure proc_1() cache index t1 in new_cache; +call proc_1(); +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +drop procedure proc_1; +SET GLOBAL second_cache.key_buffer_size=128*1024; +prepare abc from "cache index t1 in second_cache"; +execute abc; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +execute abc; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +execute abc; +Table Op Msg_type Msg_text +test.t1 assign_to_keycache status OK +deallocate prepare abc; +drop table t1; +drop table if exists t1; +drop table if exists t2; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create table t2 (a int, b char(5)) engine=myisam; +insert into t2 values (1, "one"), (2, "two"), (3, "three"); +create procedure proc_1() load index into cache t1 ignore leaves; +call proc_1(); +Table Op Msg_type Msg_text +test.t1 preload_keys status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 preload_keys status OK +call proc_1(); +Table Op Msg_type Msg_text +test.t1 preload_keys status OK +drop procedure proc_1; +create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +prepare abc from "load index into cache t2 ignore leaves"; +execute abc; +Table Op Msg_type Msg_text +test.t2 preload_keys status OK +execute abc; +Table Op Msg_type Msg_text +test.t2 preload_keys status OK +execute abc; +Table Op Msg_type Msg_text +test.t2 preload_keys status OK +deallocate prepare abc; +drop table t1, t2; +create procedure proc_1() show errors; +call proc_1(); +Level Code Message +call proc_1(); +Level Code Message +call proc_1(); +Level Code Message +drop procedure proc_1; +create function func_1() returns int begin show errors; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +prepare abc from "show errors"; +deallocate prepare abc; +drop table if exists t1; +drop table if exists t2; +create procedure proc_1() show warnings; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +call proc_1(); +Level Code Message +drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' +call proc_1(); +Level Code Message +drop table if exists t1, t2; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' +call proc_1(); +Level Code Message +drop procedure proc_1; +create function func_1() returns int begin show warnings; return 1; end| +ERROR 0A000: Not allowed to return a result set from a function +prepare abc from "show warnings"; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' +execute abc; +Level Code Message +Note 1051 Unknown table 't1' +drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' +execute abc; +Level Code Message +Note 1051 Unknown table 't2' +drop table if exists t1, t2; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' +execute abc; +Level Code Message +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' +deallocate prepare abc; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index c94df7f5c2a..67959920248 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -308,17 +308,11 @@ prepare stmt4 from ' show engine bdb logs '; execute stmt4; prepare stmt4 from ' show grants for user '; prepare stmt4 from ' show create table t2 '; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' show master status '; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' show master logs '; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' show slave status '; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' show warnings limit 20 '; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' show errors limit 20 '; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' show storage engines '; execute stmt4; drop table if exists t5; @@ -387,10 +381,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp prepare stmt4 from ' use test ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt3 from ' create database mysqltest '; -ERROR HY000: This command is not supported in the prepared statement protocol yet create database mysqltest ; prepare stmt3 from ' drop database mysqltest '; -ERROR HY000: This command is not supported in the prepared statement protocol yet drop database mysqltest ; prepare stmt3 from ' describe t2 '; execute stmt3; @@ -412,7 +404,6 @@ execute stmt1 ; prepare stmt1 from ' optimize table t1 ' ; prepare stmt1 from ' analyze table t1 ' ; prepare stmt1 from ' checksum table t1 ' ; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' repair table t1 ' ; prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet @@ -440,11 +431,8 @@ execute stmt5; 1 SET sql_mode=""; prepare stmt1 from ' flush local privileges ' ; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' reset query cache ' ; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' KILL 0 '; -ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' explain select a from t1 order by b '; execute stmt1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/mysql-test/r/ps_grant.result b/mysql-test/r/ps_grant.result index fdc1f97bb4c..8b16123ccea 100644 --- a/mysql-test/r/ps_grant.result +++ b/mysql-test/r/ps_grant.result @@ -78,13 +78,10 @@ ERROR 42000: There is no such grant defined for user 'second_user' on host 'loca drop database mysqltest; prepare stmt3 from ' grant all on test.t1 to drop_user@localhost identified by ''looser'' '; -ERROR HY000: This command is not supported in the prepared statement protocol yet grant all on test.t1 to drop_user@localhost identified by 'looser' ; prepare stmt3 from ' revoke all privileges on test.t1 from drop_user@localhost '; -ERROR HY000: This command is not supported in the prepared statement protocol yet revoke all privileges on test.t1 from drop_user@localhost ; prepare stmt3 from ' drop user drop_user@localhost '; -ERROR HY000: This command is not supported in the prepared statement protocol yet drop user drop_user@localhost; diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result index d9d5706cded..f1c7e6076e5 100644 --- a/mysql-test/r/sp-dynamic.result +++ b/mysql-test/r/sp-dynamic.result @@ -284,11 +284,11 @@ call p1()| select * from t1| id stmt_text status 1 select 1 supported -2 flush tables not supported +2 flush tables supported 3 handler t1 open as ha not supported 4 analyze table t1 supported 5 check table t1 not supported -6 checksum table t1 not supported +6 checksum table t1 supported 7 check table t1 not supported 8 optimize table t1 supported 9 repair table t1 supported diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index aa7b6ebf266..94d6fb3af55 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1330,3 +1330,874 @@ create temporary table t1 (i int); # use test; # End of 5.0 tests + + +# +# Bug #20665: All commands supported in Stored Procedures should work in +# Prepared Statements +# +create procedure proc_1() reset query cache; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin reset query cache; return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +prepare abc from "reset query cache"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() reset master; +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin reset master; return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +prepare abc from "reset master"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() reset slave; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin reset slave; return 1; end| +delimiter ;| +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +select func_1(), func_1(), func_1() from dual; +drop function func_1; +prepare abc from "reset slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1(a integer) kill a; +--error ER_NO_SUCH_THREAD +call proc_1(0); +--error ER_NO_SUCH_THREAD +call proc_1(0); +--error ER_NO_SUCH_THREAD +call proc_1(0); +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin kill 0; return 1; end| +delimiter ;| +--error ER_NO_SUCH_THREAD +select func_1() from dual; +--error ER_NO_SUCH_THREAD +select func_1() from dual; +--error ER_NO_SUCH_THREAD +select func_1() from dual; +drop function func_1; +prepare abc from "kill 0"; +--error ER_NO_SUCH_THREAD +execute abc; +--error ER_NO_SUCH_THREAD +execute abc; +--error ER_NO_SUCH_THREAD +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush hosts; +call proc_1(); +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush hosts; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush hosts"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush privileges; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush privileges; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush privileges"; +deallocate prepare abc; + + +create procedure proc_1() flush tables with read lock; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +call proc_1(); +unlock tables; +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush tables with read lock; return 1; end| +delimiter ;| +prepare abc from "flush tables with read lock"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +unlock tables; + + +create procedure proc_1() flush tables; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush tables; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush tables"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush tables; +flush tables; +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +call proc_1(); +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +call proc_1(); +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +call proc_1(); +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +flush tables; +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush tables; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +flush tables; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +prepare abc from "flush tables"; +execute abc; +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +execute abc; +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +execute abc; +show open tables from mysql; +select Host, User from mysql.user limit 0; +select Host, Db from mysql.host limit 0; +show open tables from mysql; +flush tables; +deallocate prepare abc; + + +create procedure proc_1() flush logs; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush logs; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush logs"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush status; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush status; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush status"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush slave; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush slave; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush slave"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush master; +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush master; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush master"; +deallocate prepare abc; + + +create procedure proc_1() flush des_key_file; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush des_key_file; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush des_key_file"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() flush user_resources; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin flush user_resources; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "flush user_resources"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() start slave; +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin start slave; return 1; end| +delimiter ;| +drop function func_1; +prepare abc from "start slave"; +deallocate prepare abc; + + +create procedure proc_1() stop slave; +drop procedure proc_1; +delimiter |; +create function func_1() returns int begin stop slave; return 1; end| +delimiter ;| +drop function func_1; +prepare abc from "stop slave"; +deallocate prepare abc; + + +create procedure proc_1() show binlog events; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show binlog events; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show binlog events"; +deallocate prepare abc; + + +create procedure proc_1() show slave status; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show slave status; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show slave status"; +deallocate prepare abc; + + +create procedure proc_1() show master status; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show master status; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show master status"; +deallocate prepare abc; + + +create procedure proc_1() show master logs; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show master logs; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show master logs"; +deallocate prepare abc; + + +create procedure proc_1() show events; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show events; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show events"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() show scheduler status; +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show scheduler status; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +--error ER_UNSUPPORTED_PS +prepare abc from "show scheduler status"; +--error ER_UNKNOWN_STMT_HANDLER +deallocate prepare abc; + + +--disable_warnings +drop procedure if exists a; +--enable_warnings +create procedure a() select 42; +create procedure proc_1(a char(2)) show create procedure a; +call proc_1("bb"); +call proc_1("bb"); +call proc_1("bb"); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create procedure a; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create procedure a"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop procedure a; + + +--disable_warnings +drop function if exists a; +--enable_warnings +create function a() returns int return 42+13; +create procedure proc_1(a char(2)) show create function a; +call proc_1("bb"); +call proc_1("bb"); +call proc_1("bb"); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create function a; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create function a"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop function a; + + +--disable_warnings +drop table if exists tab1; +--enable_warnings +create table tab1(a int, b char(1), primary key(a,b)); +create procedure proc_1() show create table tab1; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create table tab1; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create table tab1"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop table tab1; + + +--disable_warnings +drop view if exists v1; +drop table if exists t1; +--enable_warnings +create table t1(a int, b char(5)); +insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve"); +create view v1 as + (select a, count(*) from t1 group by a) + union all + (select b, count(*) from t1 group by b); +create procedure proc_1() show create view v1; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show create view v1; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "show create view v1"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop view v1; +drop table t1; + + +create procedure proc_1() install plugin my_plug soname '/root/some_plugin.so'; +--error ER_UDF_NO_PATHS +call proc_1(); +--error ER_UDF_NO_PATHS +call proc_1(); +--error ER_UDF_NO_PATHS +call proc_1(); +drop procedure proc_1; +create procedure proc_1() install plugin my_plug soname 'some_plugin.so'; +--error ER_CANT_OPEN_LIBRARY +call proc_1(); +--error ER_CANT_OPEN_LIBRARY +call proc_1(); +--error ER_CANT_OPEN_LIBRARY +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "install plugin my_plug soname '/root/some_plugin.so'"; +--error ER_UDF_NO_PATHS +execute abc; +--error ER_UDF_NO_PATHS +execute abc; +deallocate prepare abc; +prepare abc from "install plugin my_plug soname 'some_plugin.so'"; +deallocate prepare abc; + + +create procedure proc_1() uninstall plugin my_plug; +--error ER_SP_DOES_NOT_EXIST +call proc_1(); +--error ER_SP_DOES_NOT_EXIST +call proc_1(); +--error ER_SP_DOES_NOT_EXIST +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin uninstall plugin my_plug; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "uninstall plugin my_plug"; +--error ER_SP_DOES_NOT_EXIST +execute abc; +--error ER_SP_DOES_NOT_EXIST +execute abc; +--error ER_SP_DOES_NOT_EXIST +execute abc; +deallocate prepare abc; + + +--disable_warnings +drop database if exists mysqltest_xyz; +--enable_warnings +create procedure proc_1() create database mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +call proc_1(); +--error ER_DB_CREATE_EXISTS +call proc_1(); +drop database if exists mysqltest_xyz; +call proc_1(); +drop database if exists mysqltest_xyz; +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin create database mysqltest_xyz; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "create database mysqltest_xyz"; +execute abc; +drop database if exists mysqltest_xyz; +execute abc; +--error ER_DB_CREATE_EXISTS +execute abc; +drop database if exists mysqltest_xyz; +execute abc; +drop database if exists mysqltest_xyz; +deallocate prepare abc; + + +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int, b char(5)); +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create procedure proc_1() checksum table xyz; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin checksum table t1; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "checksum table t1"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; + + +create procedure proc_1() create user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +call proc_1(); +--error ER_CANNOT_USER +call proc_1(); +drop user pstest_xyz@localhost; +call proc_1(); +drop user pstest_xyz@localhost; +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +prepare abc from "create user pstest_xyz@localhost"; +execute abc; +drop user pstest_xyz@localhost; +execute abc; +--error ER_CANNOT_USER +execute abc; +drop user pstest_xyz@localhost; +execute abc; +drop user pstest_xyz@localhost; +deallocate prepare abc; + + +--disable_warnings +drop event if exists xyz; +--enable_warnings +#create procedure proc_1() create event xyz on schedule every 5 minute disable do select 123; +#call proc_1(); +#drop event xyz; +#call proc_1(); +#--error ER_EVENT_ALREADY_EXISTS +#call proc_1(); +#drop event xyz; +#call proc_1(); +#drop event xyz; +#drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end| +delimiter ;| +--error ER_SP_DOES_NOT_EXIST +select func_1(), func_1(), func_1() from dual; +--error ER_SP_DOES_NOT_EXIST +drop function func_1; +--error ER_UNSUPPORTED_PS +prepare abc from "create event xyz on schedule at now() do select 123"; +--error ER_UNKNOWN_STMT_HANDLER +deallocate prepare abc; + + +--disable_warnings +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +--enable_warnings +create procedure proc_1() alter event xyz comment 'xyz'; +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +drop event xyz; +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +drop event xyz; +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end| +delimiter ;| +--error ER_UNSUPPORTED_PS +prepare abc from "alter event xyz comment 'xyz'"; +--error ER_UNKNOWN_STMT_HANDLER +deallocate prepare abc; + + +--disable_warnings +drop event if exists xyz; +create event xyz on schedule every 5 minute disable do select 123; +--enable_warnings +create procedure proc_1() drop event xyz; +call proc_1(); +create event xyz on schedule every 5 minute disable do select 123; +call proc_1(); +--error ER_EVENT_DOES_NOT_EXIST +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +create function func_1() returns int begin drop event xyz; return 1; end| +delimiter ;| +--error ER_UNSUPPORTED_PS +prepare abc from "drop event xyz"; +--error ER_UNKNOWN_STMT_HANDLER +deallocate prepare abc; + + +--disable_warnings +drop table if exists t1; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +--enable_warnings +SET GLOBAL new_cache.key_buffer_size=128*1024; +create procedure proc_1() cache index t1 in new_cache; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +SET GLOBAL second_cache.key_buffer_size=128*1024; +prepare abc from "cache index t1 in second_cache"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop table t1; + +--disable_warnings +drop table if exists t1; +drop table if exists t2; +create table t1 (a int, b char(5)) engine=myisam; +insert into t1 values (1, "one"), (2, "two"), (3, "three"); +create table t2 (a int, b char(5)) engine=myisam; +insert into t2 values (1, "one"), (2, "two"), (3, "three"); +--enable_warnings +create procedure proc_1() load index into cache t1 ignore leaves; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end| +delimiter ;| +prepare abc from "load index into cache t2 ignore leaves"; +execute abc; +execute abc; +execute abc; +deallocate prepare abc; +drop table t1, t2; + +# +# Bug #21422: GRANT/REVOKE possible inside stored function, probably in a trigger +# This is disabled for now till it is resolved in 5.0 +# + +#create procedure proc_1() grant all on *.* to abc@host; +#drop procedure proc_1; +#delimiter |; +#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +#create function func_1() returns int begin grant all on *.* to abc@host; return 1; end| +#delimiter ;| +#prepare abc from "grant all on *.* to abc@host"; +# +#create procedure proc_1() revoke all on *.* from abc@host; +#drop procedure proc_1; +#delimiter |;#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +#create function func_1() returns int begin revoke all on *.* from abc@host; return 1; end| +#delimiter ;| +#prepare abc from "revoke all on *.* from abc@host"; + +create procedure proc_1() show errors; +call proc_1(); +call proc_1(); +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show errors; return 1; end| +delimiter ;| +prepare abc from "show errors"; +deallocate prepare abc; + +--disable_warnings +drop table if exists t1; +drop table if exists t2; +--enable_warnings +create procedure proc_1() show warnings; +drop table if exists t1; +call proc_1(); +drop table if exists t2; +call proc_1(); +drop table if exists t1, t2; +call proc_1(); +drop procedure proc_1; +delimiter |; +--error ER_SP_NO_RETSET +create function func_1() returns int begin show warnings; return 1; end| +delimiter ;| +prepare abc from "show warnings"; +drop table if exists t1; +execute abc; +drop table if exists t2; +execute abc; +drop table if exists t1, t2; +execute abc; +deallocate prepare abc; + diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index c15bc1633a6..c0b81796731 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -330,17 +330,11 @@ prepare stmt4 from ' show engine bdb logs '; execute stmt4; --enable_result_log prepare stmt4 from ' show grants for user '; ---error 1295 prepare stmt4 from ' show create table t2 '; ---error 1295 prepare stmt4 from ' show master status '; ---error 1295 prepare stmt4 from ' show master logs '; ---error 1295 prepare stmt4 from ' show slave status '; ---error 1295 prepare stmt4 from ' show warnings limit 20 '; ---error 1295 prepare stmt4 from ' show errors limit 20 '; prepare stmt4 from ' show storage engines '; # The output depends upon the precise order in which @@ -427,14 +421,12 @@ prepare stmt1 from ' execute stmt2 ' ; prepare stmt1 from ' deallocate prepare never_prepared ' ; ## switch the database connection ---error 1295 +--error ER_UNSUPPORTED_PS prepare stmt4 from ' use test ' ; ## create/drop database ---error 1295 prepare stmt3 from ' create database mysqltest '; create database mysqltest ; ---error 1295 prepare stmt3 from ' drop database mysqltest '; drop database mysqltest ; @@ -446,12 +438,12 @@ drop table t2 ; --error 1146 execute stmt3; ## lock/unlock ---error 1295 +--error ER_UNSUPPORTED_PS prepare stmt3 from ' lock tables t1 read ' ; ---error 1295 +--error ER_UNSUPPORTED_PS prepare stmt3 from ' unlock tables ' ; ## Load/Unload table contents ---error 1295 +--error ER_UNSUPPORTED_PS prepare stmt1 from ' load data infile ''data.txt'' into table t1 fields terminated by ''\t'' '; prepare stmt1 from ' select * into outfile ''data.txt'' from t1 '; @@ -459,13 +451,12 @@ execute stmt1 ; ## prepare stmt1 from ' optimize table t1 ' ; prepare stmt1 from ' analyze table t1 ' ; ---error 1295 prepare stmt1 from ' checksum table t1 ' ; prepare stmt1 from ' repair table t1 ' ; ---error 1295 +--error ER_UNSUPPORTED_PS prepare stmt1 from ' restore table t1 from ''data.txt'' ' ; ## handler ---error 1295 +--error ER_UNSUPPORTED_PS prepare stmt1 from ' handler t1 open '; @@ -491,11 +482,8 @@ SET sql_mode=ansi; execute stmt5; SET sql_mode=""; ---error 1295 prepare stmt1 from ' flush local privileges ' ; ---error 1295 prepare stmt1 from ' reset query cache ' ; ---error 1295 prepare stmt1 from ' KILL 0 '; ## simple explain diff --git a/mysql-test/t/ps_grant.test b/mysql-test/t/ps_grant.test index 81c842de459..4c48b4d151f 100644 --- a/mysql-test/t/ps_grant.test +++ b/mysql-test/t/ps_grant.test @@ -117,15 +117,12 @@ drop database mysqltest; # # grant/revoke + drop user # ---error 1295 prepare stmt3 from ' grant all on test.t1 to drop_user@localhost identified by ''looser'' '; grant all on test.t1 to drop_user@localhost identified by 'looser' ; ---error 1295 prepare stmt3 from ' revoke all privileges on test.t1 from drop_user@localhost '; revoke all privileges on test.t1 from drop_user@localhost ; ---error 1295 prepare stmt3 from ' drop user drop_user@localhost '; drop user drop_user@localhost; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index b88ff13cd7a..475419631f7 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -161,17 +161,20 @@ sp_get_flags_for_command(LEX *lex) } /* fallthrough */ case SQLCOM_ANALYZE: + case SQLCOM_BACKUP_TABLE: case SQLCOM_OPTIMIZE: case SQLCOM_PRELOAD_KEYS: case SQLCOM_ASSIGN_TO_KEYCACHE: case SQLCOM_CHECKSUM: case SQLCOM_CHECK: case SQLCOM_HA_READ: + case SQLCOM_SHOW_AUTHORS: case SQLCOM_SHOW_BINLOGS: case SQLCOM_SHOW_BINLOG_EVENTS: case SQLCOM_SHOW_CHARSETS: case SQLCOM_SHOW_COLLATIONS: case SQLCOM_SHOW_COLUMN_TYPES: + case SQLCOM_SHOW_CONTRIBUTORS: case SQLCOM_SHOW_CREATE: case SQLCOM_SHOW_CREATE_DB: case SQLCOM_SHOW_CREATE_FUNC: @@ -180,16 +183,20 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_ERRORS: case SQLCOM_SHOW_FIELDS: + case SQLCOM_SHOW_FUNC_CODE: case SQLCOM_SHOW_GRANTS: case SQLCOM_SHOW_ENGINE_STATUS: case SQLCOM_SHOW_ENGINE_LOGS: case SQLCOM_SHOW_ENGINE_MUTEX: + case SQLCOM_SHOW_EVENTS: case SQLCOM_SHOW_KEYS: case SQLCOM_SHOW_MASTER_STAT: case SQLCOM_SHOW_NEW_MASTER: case SQLCOM_SHOW_OPEN_TABLES: case SQLCOM_SHOW_PRIVILEGES: case SQLCOM_SHOW_PROCESSLIST: + case SQLCOM_SHOW_PROC_CODE: + case SQLCOM_SHOW_SCHEDULER_STATUS: case SQLCOM_SHOW_SLAVE_HOSTS: case SQLCOM_SHOW_SLAVE_STAT: case SQLCOM_SHOW_STATUS: @@ -199,12 +206,7 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_TABLES: case SQLCOM_SHOW_VARIABLES: case SQLCOM_SHOW_WARNS: - case SQLCOM_SHOW_PROC_CODE: - case SQLCOM_SHOW_FUNC_CODE: - case SQLCOM_SHOW_AUTHORS: - case SQLCOM_SHOW_CONTRIBUTORS: case SQLCOM_REPAIR: - case SQLCOM_BACKUP_TABLE: case SQLCOM_RESTORE_TABLE: flags= sp_head::MULTI_RESULTS; break; @@ -262,6 +264,9 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_CREATE_EVENT: case SQLCOM_ALTER_EVENT: case SQLCOM_DROP_EVENT: + case SQLCOM_FLUSH: + case SQLCOM_INSTALL_PLUGIN: + case SQLCOM_UNINSTALL_PLUGIN: flags= sp_head::HAS_COMMIT_OR_ROLLBACK; break; default: diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 16508516df7..337f1cc2492 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1740,6 +1740,20 @@ static bool check_prepared_statement(Prepared_statement *stmt, case SQLCOM_SHOW_ENGINE_MUTEX: case SQLCOM_SHOW_CREATE_DB: case SQLCOM_SHOW_GRANTS: + case SQLCOM_SHOW_BINLOG_EVENTS: + case SQLCOM_SHOW_MASTER_STAT: + case SQLCOM_SHOW_SLAVE_STAT: + case SQLCOM_SHOW_CREATE_PROC: + case SQLCOM_SHOW_CREATE_FUNC: + case SQLCOM_SHOW_CREATE_EVENT: + case SQLCOM_SHOW_CREATE: + case SQLCOM_SHOW_PROC_CODE: + case SQLCOM_SHOW_FUNC_CODE: + case SQLCOM_SHOW_AUTHORS: + case SQLCOM_SHOW_CONTRIBUTORS: + case SQLCOM_SHOW_WARNS: + case SQLCOM_SHOW_ERRORS: + case SQLCOM_SHOW_BINLOGS: case SQLCOM_DROP_TABLE: case SQLCOM_RENAME_TABLE: case SQLCOM_ALTER_TABLE: @@ -1754,6 +1768,25 @@ static bool check_prepared_statement(Prepared_statement *stmt, case SQLCOM_REPAIR: case SQLCOM_ANALYZE: case SQLCOM_OPTIMIZE: + case SQLCOM_CHANGE_MASTER: + case SQLCOM_RESET: + case SQLCOM_FLUSH: + case SQLCOM_SLAVE_START: + case SQLCOM_SLAVE_STOP: + case SQLCOM_INSTALL_PLUGIN: + case SQLCOM_UNINSTALL_PLUGIN: + case SQLCOM_CREATE_DB: + case SQLCOM_DROP_DB: + case SQLCOM_RENAME_DB: + case SQLCOM_CHECKSUM: + case SQLCOM_CREATE_USER: + case SQLCOM_RENAME_USER: + case SQLCOM_DROP_USER: + case SQLCOM_ASSIGN_TO_KEYCACHE: + case SQLCOM_PRELOAD_KEYS: + case SQLCOM_GRANT: + case SQLCOM_REVOKE: + case SQLCOM_KILL: break; default: From e36be72adbca91524e8575132ffa939ed93068f7 Mon Sep 17 00:00:00 2001 From: "petr/cps@mysql.com/owlet.local" <> Date: Thu, 24 Aug 2006 16:17:42 +0400 Subject: [PATCH 68/68] after merge fix --- mysql-test/t/csv.test | 2 +- storage/csv/ha_tina.cc | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index a042f163635..9815da4fb55 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1575,7 +1575,7 @@ create table bug15205 (val int(11) default null) engine=csv; create table bug15205_2 (val int(11) default null) engine=csv; --exec rm $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV # system error (can't open the datafile) ---error ER_GET_ERRNO +--error 13 select * from bug15205; select * from bug15205_2; --exec touch $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index bec236becd0..5d18ed99a9a 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -229,6 +229,11 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) MY_REPLACE_EXT|MY_UNPACK_FILENAME); fn_format(meta_file_name, table_name, "", CSM_EXT, MY_REPLACE_EXT|MY_UNPACK_FILENAME); + + if (my_stat(share->data_file_name, &file_stat, MYF(MY_WME)) == NULL) + goto error; + share->saved_data_file_length= file_stat.st_size; + if (my_hash_insert(&tina_open_tables, (byte*) share)) goto error; thr_lock_init(&share->lock); @@ -250,10 +255,6 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) */ if (read_meta_file(share->meta_file, &share->rows_recorded)) share->crashed= TRUE; - - if (my_stat(share->data_file_name, &file_stat, MYF(MY_WME)) == NULL) - goto error2; - share->saved_data_file_length= file_stat.st_size; } share->use_count++; pthread_mutex_unlock(&tina_mutex);