diff options
author | unknown <monty@narttu.mysql.fi> | 2003-03-10 12:48:43 +0200 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-03-10 12:48:43 +0200 |
commit | 012ffb5d505cc563ae980bd8cbee9b668f517cac (patch) | |
tree | 8651694def257832c6e225eead2eec4c5a7c9aeb | |
parent | 66e8db8241bfcad048d08fa1a24532fae8ee5f0a (diff) | |
parent | 73c2d4ad498890c2ba2cfa9a2c20fae4d37b1859 (diff) | |
download | mariadb-git-012ffb5d505cc563ae980bd8cbee9b668f517cac.tar.gz |
Merge with 3.23 to get fixes for --user and BACKUP TABLE
BitKeeper/etc/ignore:
auto-union
BitKeeper/deleted/.del-delete.result:
Delete: mysql-test/r/delete.result
BitKeeper/deleted/.del-stamp-h.in~4a5d6676232516c5:
Auto merged
client/mysqlbinlog.cc:
Auto merged
include/my_sys.h:
Auto merged
libmysql/libmysql.c:
Auto merged
mysql-test/t/delete.test:
Auto merged
mysql-test/t/join.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
mysys/my_copy.c:
Auto merged
sql/field.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/share/polish/errmsg.txt:
Auto merged
sql/sql_rename.cc:
Auto merged
sql/sql_select.cc:
Auto merged
mysql-test/mysql-test-run.sh:
merge with 3.23.56
mysql-test/r/backup.result:
merge (needs to be updated)
mysql-test/r/join.result:
merge (needs to be updated)
mysql-test/r/type_datetime.result:
merge (needs to be updated)
mysql-test/t/backup.test:
merge with 3.23
scripts/mysqld_safe.sh:
Only use first --user option
sql/ha_myisam.cc:
Don't let BACKUP TABLE overwrite old files
sql/log_event.h:
merge
sql/mysql_priv.h:
merge
sql/mysqld.cc:
Use first --user option
sql/slave.cc:
use local version
sql/sql_repl.h:
use local version
-rw-r--r-- | .bzrignore | 14 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 2 | ||||
-rw-r--r-- | include/my_sys.h | 1 | ||||
-rw-r--r-- | libmysql/libmysql.c | 66 | ||||
-rw-r--r-- | mysql-test/mysql-test-run.sh | 2 | ||||
-rw-r--r-- | mysql-test/r/join.result | 4 | ||||
-rwxr-xr-x | mysql-test/t/backup-master.sh | 5 | ||||
-rw-r--r-- | mysql-test/t/backup.test | 32 | ||||
-rw-r--r-- | mysql-test/t/delete.test | 20 | ||||
-rw-r--r-- | mysql-test/t/join.test | 24 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 5 | ||||
-rw-r--r-- | mysys/my_copy.c | 30 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 7 | ||||
-rw-r--r-- | sql/field.h | 2 | ||||
-rw-r--r-- | sql/ha_myisam.cc | 14 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 | ||||
-rw-r--r-- | sql/opt_range.cc | 12 | ||||
-rw-r--r-- | sql/share/polish/errmsg.txt | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 5 |
19 files changed, 182 insertions, 73 deletions
diff --git a/.bzrignore b/.bzrignore index f5e9775ee80..f497aa69ffd 100644 --- a/.bzrignore +++ b/.bzrignore @@ -206,6 +206,7 @@ config.h.in config.log config.status configure +configure.lineno core core.2430 db-*.*.* @@ -214,6 +215,7 @@ depcomp extra/comp_err extra/my_print_defaults extra/mysql_install +extra/mysql_waitpid extra/perror extra/replace extra/resolve_stack_dump @@ -232,6 +234,7 @@ innobase/autom4te.cache/* innobase/autom4te.cache/output.0 innobase/autom4te.cache/requests innobase/autom4te.cache/traces.0 +innobase/configure.lineno innobase/conftest.s1 innobase/conftest.subs innobase/ib_config.h @@ -499,6 +502,11 @@ stamp-h1 strings/conf_to_src strings/ctype_autoconf.c strings/ctype_extra_sources.c +support-files/MacOSX/Description.plist +support-files/MacOSX/Info.plist +support-files/MacOSX/StartupParameters.plist +support-files/MacOSX/postinstall +support-files/MacOSX/preinstall support-files/binary-configure support-files/my-huge.cnf support-files/my-large.cnf @@ -522,9 +530,3 @@ vio/test-ssl vio/test-sslclient vio/test-sslserver vio/viotest-ssl -extra/mysql_waitpid -support-files/MacOSX/Description.plist -support-files/MacOSX/Info.plist -support-files/MacOSX/StartupParameters.plist -support-files/MacOSX/postinstall -support-files/MacOSX/preinstall diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 4cf86eb31c7..1fe3dc86b35 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -27,7 +27,7 @@ #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) char server_version[SERVER_VERSION_LENGTH]; -uint32 server_id = 0; +ulong server_id = 0; // needed by net_serv.c ulong bytes_sent = 0L, bytes_received = 0L; diff --git a/include/my_sys.h b/include/my_sys.h index 9610033e2a9..c67a150f24f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -73,6 +73,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */ #define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */ #define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */ +#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 04d2d9d12e4..af74182eb22 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -170,9 +170,10 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, struct timeval tv; time_t start_time, now_time; - /* If they passed us a timeout of zero, we should behave - * exactly like the normal connect() call does. - */ + /* + If they passed us a timeout of zero, we should behave + exactly like the normal connect() call does. + */ if (timeout == 0) return connect(s, (struct sockaddr*) name, namelen); @@ -193,30 +194,31 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, if (res == 0) /* Connected quickly! */ return(0); - /* Otherwise, our connection is "in progress." We can use - * the select() call to wait up to a specified period of time - * for the connection to suceed. If select() returns 0 - * (after waiting howevermany seconds), our socket never became - * writable (host is probably unreachable.) Otherwise, if - * select() returns 1, then one of two conditions exist: - * - * 1. An error occured. We use getsockopt() to check for this. - * 2. The connection was set up sucessfully: getsockopt() will - * return 0 as an error. - * - * Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk> - * who posted this method of timing out a connect() in - * comp.unix.programmer on August 15th, 1997. - */ + /* + Otherwise, our connection is "in progress." We can use + the select() call to wait up to a specified period of time + for the connection to suceed. If select() returns 0 + (after waiting howevermany seconds), our socket never became + writable (host is probably unreachable.) Otherwise, if + select() returns 1, then one of two conditions exist: + + 1. An error occured. We use getsockopt() to check for this. + 2. The connection was set up sucessfully: getsockopt() will + return 0 as an error. + + Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk> + who posted this method of timing out a connect() in + comp.unix.programmer on August 15th, 1997. + */ FD_ZERO(&sfds); FD_SET(s, &sfds); /* - * select could be interrupted by a signal, and if it is, - * the timeout should be adjusted and the select restarted - * to work around OSes that don't restart select and - * implementations of select that don't adjust tv upon - * failure to reflect the time remaining + select could be interrupted by a signal, and if it is, + the timeout should be adjusted and the select restarted + to work around OSes that don't restart select and + implementations of select that don't adjust tv upon + failure to reflect the time remaining */ start_time = time(NULL); for (;;) @@ -224,22 +226,25 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, tv.tv_sec = (long) timeout; tv.tv_usec = 0; #if defined(HPUX10) && defined(THREAD) - if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) >= 0) + if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) > 0) break; #else - if ((res = select(s+1, NULL, &sfds, NULL, &tv)) >= 0) + if ((res = select(s+1, NULL, &sfds, NULL, &tv)) > 0) break; #endif + if (res == 0) /* timeout */ + return -1; now_time=time(NULL); timeout-= (uint) (now_time - start_time); if (errno != EINTR || (int) timeout <= 0) return -1; } - /* select() returned something more interesting than zero, let's - * see if we have any errors. If the next two statements pass, - * we've got an open socket! - */ + /* + select() returned something more interesting than zero, let's + see if we have any errors. If the next two statements pass, + we've got an open socket! + */ s_err=0; if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0) @@ -250,7 +255,8 @@ int my_connect(my_socket s, const struct sockaddr *name, uint namelen, errno = s_err; return(-1); /* but return an error... */ } - return(0); /* It's all good! */ + return (0); /* ok */ + #endif } diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index f66300bb852..e0e9af2432a 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1160,7 +1160,7 @@ run_testcase () echo "CURRENT_TEST: $tname" >> $MASTER_MYERR start_master else - if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] ; + if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || [ -f $master_init_script ] then EXTRA_MASTER_OPT="" stop_master diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index ddea0ac1a57..d8c45ca09ce 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -251,3 +251,7 @@ t1_id t2_id type cost_unit min_value max_value t3_id item_id id name 22 1 Percent Cost 100 -1 6 291 1 s1 23 1 Percent Cost 100 -1 21 291 1 s1 drop table t1,t2; +rate_code base_rate +cust 20 +rate_code base_rate +cust 20 diff --git a/mysql-test/t/backup-master.sh b/mysql-test/t/backup-master.sh new file mode 100755 index 00000000000..99da5857afe --- /dev/null +++ b/mysql-test/t/backup-master.sh @@ -0,0 +1,5 @@ +#!/bin/sh +if [ "$MYSQL_TEST_DIR" ] +then + rm -f $MYSQL_TEST_DIR/var/tmp/*.frm $MYSQL_TEST_DIR/var/tmp/*.MY? +fi diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index 55fe140850d..0346e6ba456 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -1,15 +1,22 @@ +# +# This test is a bit tricky as we can't use backup table to overwrite an old +# table +# connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; set SQL_LOG_BIN=0; -drop table if exists t1; +create table t4(n int); +--replace_result "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X" +backup table t4 to '../bogus'; +backup table t4 to '../tmp'; +--replace_result "errno: 17" "errno: X" +backup table t4 to '../tmp'; +drop table t4; +restore table t4 from '../tmp'; +select count(*) from t4; + create table t1(n int); ---replace_result "errno = 1" "errno = X" "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X" -backup table t1 to '../bogus'; -backup table t1 to '../tmp'; -drop table t1; -restore table t1 from '../tmp'; -select count(*) from t1; insert into t1 values (23),(45),(67); backup table t1 to '../tmp'; drop table t1; @@ -20,23 +27,24 @@ create table t2(m int not null primary key); create table t3(k int not null primary key); insert into t2 values (123),(145),(167); insert into t3 values (223),(245),(267); -backup table t1,t2,t3 to '../tmp'; +backup table t2,t3 to '../tmp'; drop table t1,t2,t3; restore table t1,t2,t3 from '../tmp'; select n from t1; select m from t2; select k from t3; -drop table t1,t2,t3; +drop table t1,t2,t3,t4; restore table t1 from '../tmp'; connection con2; +rename table t1 to t5; --send -lock tables t1 write; +lock tables t5 write; connection con1; --send -backup table t1 to '../tmp'; +backup table t5 to '../tmp'; connection con2; reap; unlock tables; connection con1; reap; -drop table t1; +drop table t5; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 953e22cdd55..13fa617b3cf 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -35,3 +35,23 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; + +# +# CHAR(0) bug - not actually DELETE bug, but anyway... +# + +CREATE TABLE t1 ( + bool char(0) default NULL, + not_null varchar(20) binary NOT NULL default '', + misc integer not null, + PRIMARY KEY (not_null) +) TYPE=MyISAM; + +INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7); + +select * from t1 where misc > 5 and bool is null; +delete from t1 where misc > 5 and bool is null; +select * from t1 where misc > 5 and bool is null; + +drop table t1; + diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 70980f656ab..63ec90f854c 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -247,3 +247,27 @@ CREATE TABLE t2 ( INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; drop table t1,t2; + +# +# Bug in range optimiser with MAYBE_KEY +# + +CREATE TABLE t1 ( + siteid varchar(25) NOT NULL default '', + emp_id varchar(30) NOT NULL default '', + rate_code varchar(10) default NULL, + UNIQUE KEY site_emp (siteid,emp_id), + KEY siteid (siteid) +) TYPE=MyISAM; +INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust'); +CREATE TABLE t2 ( + siteid varchar(25) NOT NULL default '', + rate_code varchar(10) NOT NULL default '', + base_rate float NOT NULL default '0', + PRIMARY KEY (siteid,rate_code), + FULLTEXT KEY rate_code (rate_code) +) TYPE=MyISAM; +INSERT INTO t2 VALUES ('rivercats','cust',20); +SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats'; +SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith'; +drop table t1,t2; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index a516bc89f99..f5103958979 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -59,3 +59,8 @@ INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00'); SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00'; drop table t1; +create table t1 (a datetime not null, b datetime not null); +insert into t1 values (now(), now()); +insert into t1 values (now(), now()); +select * from t1 where a is null or b is null; +drop table t1; diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 012eaec4ea8..84eda781a09 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -31,17 +31,29 @@ struct utimbuf { #endif - /* - Ordinary ownership and accesstimes are copied from 'from-file' - if MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then - the modes of to-file isn't changed - Dont set MY_FNABP or MY_NABP bits on when calling this function ! - */ +/* + int my_copy(const char *from, const char *to, myf MyFlags) + + NOTES + Ordinary ownership and accesstimes are copied from 'from-file' + If MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then + the modes of to-file isn't changed + If MyFlags & MY_DONT_OVERWRITE_FILE is set, we will give an error + if the file existed. + + WARNING + Don't set MY_FNABP or MY_NABP bits on when calling this function ! + + RETURN + 0 ok + # Error + +*/ int my_copy(const char *from, const char *to, myf MyFlags) { uint Count; - int new_file_stat; + int new_file_stat, create_flag; File from_file,to_file; char buff[IO_SIZE]; struct stat stat_buff,new_stat_buff; @@ -62,8 +74,10 @@ int my_copy(const char *from, const char *to, myf MyFlags) } if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) stat_buff=new_stat_buff; + create_flag= (MyFlags & MY_DONT_OVERWRITE_FILE) ? O_EXCL : O_TRUNC; + if ((to_file= my_create(to,(int) stat_buff.st_mode, - O_WRONLY | O_TRUNC | O_BINARY | O_SHARE, + O_WRONLY | create_flag | O_BINARY | O_SHARE, MyFlags)) < 0) goto err; diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 3ccf5301503..bc29ac1c555 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -38,7 +38,12 @@ parse_arguments() { --basedir=*) MY_BASEDIR_VERSION=`echo "$arg" | sed -e "s;--basedir=;;"` ;; --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;; - --user=*) user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 ;; + --user=*) + if [ $SET_USER == 0 ] + then + user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 + fi + ;; # these two might have been set in a [mysqld_safe] section of my.cnf # they get passed via environment variables to mysqld_safe diff --git a/sql/field.h b/sql/field.h index f064724f6a2..29c185505c7 100644 --- a/sql/field.h +++ b/sql/field.h @@ -65,7 +65,7 @@ public: virtual String *val_str(String*,String *)=0; virtual Item_result result_type () const=0; virtual Item_result cmp_type () const { return result_type(); } - bool eq(Field *field) { return ptr == field->ptr; } + bool eq(Field *field) { return ptr == field->ptr && null_ptr == field->null_ptr; } virtual bool eq_def(Field *field); virtual uint32 pack_length() const { return (uint32) field_length; } virtual void reset(void) { bzero(ptr,pack_length()); } diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 6e055f57c83..0fa7b3d6bad 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -407,7 +407,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) param.db_name = table->table_cache_key; param.table_name = table->table_name; param.testflag = 0; - mi_check_print_error(¶m,errmsg, my_errno); + mi_check_print_error(¶m, errmsg, my_errno); DBUG_RETURN(error); } } @@ -425,17 +425,17 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir, reg_ext)) { - errmsg = "Failed in fn_format() for .frm file: errno = %d"; + errmsg = "Failed in fn_format() for .frm file (errno: %d)"; error = HA_ADMIN_INVALID; goto err; } if (my_copy(fn_format(src_path, table->path,"", reg_ext, MY_UNPACK_FILENAME), dst_path, - MYF(MY_WME | MY_HOLD_ORIGINAL_MODES))) + MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE))) { error = HA_ADMIN_FAILED; - errmsg = "Failed copying .frm file: errno = %d"; + errmsg = "Failed copying .frm file (errno: %d)"; goto err; } @@ -443,7 +443,7 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) if (!fn_format(dst_path, dst_path, "", MI_NAME_DEXT, MY_REPLACE_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH)) { - errmsg = "Failed in fn_format() for .MYD file: errno = %d"; + errmsg = "Failed in fn_format() for .MYD file (errno: %d)"; error = HA_ADMIN_INVALID; goto err; } @@ -451,9 +451,9 @@ int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt) if (my_copy(fn_format(src_path, table->path,"", MI_NAME_DEXT, MY_UNPACK_FILENAME), dst_path, - MYF(MY_WME | MY_HOLD_ORIGINAL_MODES))) + MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE))) { - errmsg = "Failed copying .MYD file: errno = %d"; + errmsg = "Failed copying .MYD file (errno: %d)"; error= HA_ADMIN_FAILED; goto err; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a5241d33132..7eab432ff49 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3596,7 +3596,7 @@ struct my_option my_long_options[] = IF_PURIFY(0,1), 0, 0, 0, 0, 0}, #endif {"user", 'u', "Run mysqld daemon as user", (gptr*) &mysqld_user, - (gptr*) &mysqld_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + (gptr*) &mysqld_user, 0, 0, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'v', "Synonym for option -v", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, @@ -4219,6 +4219,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), /* Correct pointer set by my_getopt (for embedded library) */ mysql_data_home= mysql_real_data_home; break; + case 'u': + if (!mysqld_user) + mysqld_user=optarg; + else + fprintf(stderr, "Warning: Ignoring user change to '%s' becasue the user is set to '%s' earlier on the command line\n", optarg, mysqld_user); + break; case 'L': strmake(language, argument, sizeof(language)-1); break; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index c1b03ed629f..aeeabb7d29c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1340,7 +1340,8 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag) } if (((clone_flag & CLONE_KEY2_MAYBE) && - !(clone_flag & CLONE_KEY1_MAYBE)) || + !(clone_flag & CLONE_KEY1_MAYBE) && + key2->type != SEL_ARG::MAYBE_KEY) || key1->type == SEL_ARG::MAYBE_KEY) { // Put simple key in key2 swap(SEL_ARG *,key1,key2); @@ -1368,7 +1369,10 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag) { key1->maybe_smaller(); if (key2->next_key_part) + { + key1->use_count--; // Incremented in and_all_keys return and_all_keys(key1,key2,clone_flag); + } key2->use_count--; // Key2 doesn't have a tree } return key1; @@ -2067,7 +2071,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root) { if (this == root && use_count != 1) { - sql_print_error("Use_count: Wrong count %lu for root",use_count); + sql_print_error("Note: Use_count: Wrong count %lu for root",use_count); return; } if (this->type != SEL_ARG::KEY_RANGE) @@ -2081,7 +2085,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root) ulong count=count_key_part_usage(root,pos->next_key_part); if (count > pos->next_key_part->use_count) { - sql_print_error("Use_count: Wrong count for key at %lx, %lu should be %lu", + sql_print_error("Note: Use_count: Wrong count for key at %lx, %lu should be %lu", pos,pos->next_key_part->use_count,count); return; } @@ -2089,7 +2093,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root) } } if (e_count != elements) - sql_print_error("Wrong use count: %u for tree at %lx", e_count, + sql_print_error("Warning: Wrong use count: %u for tree at %lx", e_count, (gptr) this); } diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 648bb71ae24..e5bede3b48c 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -7,8 +7,8 @@ "hashchk", "isamchk", -"TAK", "NIE", +"TAK", "Nie można stworzyć pliku '%-.64s' (Kod błędu: %d)", "Nie można stworzyć tabeli '%-.64s' (Kod błędu: %d)", "Nie można stworzyć bazy danych '%-.64s'. Bł?d %d", diff --git a/sql/sql_select.cc b/sql/sql_select.cc index cf7f310bbd5..d3934fbd620 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3330,6 +3330,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value) == Item_func::COND_AND_FUNC; List_iterator<Item> li(*((Item_cond*) cond)->argument_list()); Item::cond_result tmp_cond_value; + bool should_fix_fields=0; *cond_value=Item::COND_UNDEF; Item *item; @@ -3349,6 +3350,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value) delete item; // This may be shared #endif VOID(li.replace(new_item)); + should_fix_fields=1; } if (*cond_value == Item::COND_UNDEF) *cond_value=tmp_cond_value; @@ -3375,6 +3377,9 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value) break; /* purecov: deadcode */ } } + if (should_fix_fields) + cond->fix_fields(current_thd,0); + if (!((Item_cond*) cond)->argument_list()->elements || *cond_value != Item::COND_OK) return (COND*) 0; |