diff options
62 files changed, 1429 insertions, 318 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index b88eb69544d..940af9510b2 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -36,6 +36,7 @@ brian@private-client-ip-101.oz.net brian@zim.(none) carsten@tsort.bitbybit.dk davida@isil.mysql.com +dean@mysql.com dellis@goetia.(none) dlenev@brandersnatch.localdomain dlenev@build.mysql.com diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index 184c6243ef8..93151f3e2b6 100755 --- a/BitKeeper/triggers/post-commit +++ b/BitKeeper/triggers/post-commit @@ -19,6 +19,13 @@ BK_STATUS=$BK_STATUS$BK_COMMIT if [ "$BK_STATUS" = OK ] then +HAS_ACTUAL_CHANGES=`bk cset -r+ -d | grep -v "^#"` +if [ "$HAS_ACTUAL_CHANGES" = "" ] +then + echo ChangeSet had no real changes, not sending emails + exit +fi + CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet` BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/\1/p'` WL=`bk -R prs -r+ -h -d':C:' ChangeSet | sed -ne 's/^.*[Ww][Ll] *# *\([0-9][0-9]*\).*$/ WL#\1/p'` diff --git a/Build-tools/Do-hpux-depot b/Build-tools/Do-hpux-depot new file mode 100755 index 00000000000..f7e8e2c020d --- /dev/null +++ b/Build-tools/Do-hpux-depot @@ -0,0 +1,85 @@ +#!/usr/bin/perl + +# +# By Matt Wagner <matt@mysql.com> 2005 +# +# This script generates HP Depot packages for MySQL Server. +# It basically repackages a binary tarball as a depot. +# +# Usage: ./Do-hpux-depot <untarred-binary-tarball> +# + +$fullname = shift @ARGV; +$fullname or die "No package name was specified"; +-d $fullname or die "That directory is not present!"; + +$fullname =~ s,/+$,,; # Remove ending slash if any + +chomp($pwd= `pwd`); + +%title= ( + "mysql-standard" => "MySQL Community Edition - Standard (GPL)", + "mysql-debug" => "MySQL Community Edition - Debug (GPL)", + "mysql-max" => "MySQL Community Edition - Experimental (GPL)", + "mysql-pro" => "MySQL Pro (Commercial)", + "mysql-classic" => "MySQL Classic (Commercial)", + "mysql-cluster" => "MySQL Cluster (Commercial)", +); + +%architecture= ( + "hpux11.23" => "HP-UX_B.11.23", + "hpux11.11" => "HP-UX_B.11.11", + "hpux11.00" => "HP-UX_B.11.00", +); + +%os_release= ( + "hpux11.23" => "?.11.2?", + "hpux11.11" => "?.11.1?", + "hpux11.00" => "?.11.0?", +); + +%machine_type= ( + "ia64" => "ia64*", + "hppa2.0w" => "9000/*", +); + +$fullname =~ m/^(mysql-\w+)-([\d\.]+)-hp-(hpux11\.\d\d)-(hppa2\.0w|(ia64))-?(64bit)?$/; + +# print "title: $1\n"; +# print "version: $2\n"; +# print "os: $3\n"; +# print "cpu: $4\n"; +# print "64: $6\n"; + +$cpu64= ($6 ne "") ? "_64" : ""; + +open (PSF,">${fullname}.psf") or die "Unable to write PSF file ($!)\n"; + +print PSF <<EOF; +product + tag $1 + vendor_tag "MySQL_AB" + title "$title{$1}" + description "MySQL Database Server and Clients" + revision $2 + + architecture $architecture{$3}$cpu64 + machine_type $machine_type{$4} + os_name HP-UX + os_release $os_release{$3} + directory /usr/local + + fileset + tag all + revision $2 + directory $fullname=/usr/local/$fullname + file_permissions -u 222 -g bin -o bin + file * + end +end +EOF + +close(PSF); + +system("/usr/sbin/swpackage -v -d \"|gzip -c > $fullname.depot.gz\" -x target_type=tape -s ${pwd}/${fullname}.psf"); + diff --git a/cmd-line-utils/readline/bind.c b/cmd-line-utils/readline/bind.c index 7e8ca04e0d6..fd01049f09f 100644 --- a/cmd-line-utils/readline/bind.c +++ b/cmd-line-utils/readline/bind.c @@ -311,7 +311,7 @@ rl_generic_bind (type, keyseq, data, map) mapped to something, `abc' to be mapped to something else, and the function bound to `a' to be executed when the user types `abx', leaving `bx' in the input queue. */ - if (k.function /* && k.type == ISFUNC */) + if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR)) { map[ANYOTHERKEY] = k; k.function = 0; diff --git a/configure.in b/configure.in index f3e93afb72e..d6acef071a6 100644 --- a/configure.in +++ b/configure.in @@ -2811,6 +2811,24 @@ AC_DEFINE_UNQUOTED([MYSQL_DEFAULT_CHARSET_NAME], ["$default_charset"], AC_DEFINE_UNQUOTED([MYSQL_DEFAULT_COLLATION_NAME], ["$default_collation"], [Define the default charset name]) + +# Shall we build the UCA-based Unicode collations +AC_ARG_WITH(uca, + [ --without-uca Skip building of the national Unicode collations.], + [with_uca=$withval], + [with_uca=yes] +) + +AC_MSG_CHECKING([whether to compile national Unicode collations]) + +if test "$with_uca" = "yes" +then + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_UCA_COLLATIONS], [1], [national Unicode collations]) +else + AC_MSG_RESULT(no) +fi + MYSQL_CHECK_ISAM MYSQL_CHECK_BDB MYSQL_CHECK_INNODB diff --git a/include/my_base.h b/include/my_base.h index 7290d0da09b..d702ec45140 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -340,6 +340,7 @@ enum ha_base_keytype { #define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */ #define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ #define HA_STATE_EXTEND_BLOCK 2048 +#define HA_STATE_RNEXT_SAME 4096 /* rnext_same was called */ enum en_fieldtype { FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE, diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 83de6acdab9..7a506fd11c6 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -261,6 +261,10 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, } + /* + If ndocs == 0, this will not allocate RAM for FT_INFO.doc[], + so if ndocs == 0, FT_INFO.doc[] must not be accessed. + */ dlist=(FT_INFO *)my_malloc(sizeof(FT_INFO)+ sizeof(FT_DOC)*(aio.dtree.elements_in_tree-1), MYF(0)); @@ -329,7 +333,8 @@ float ft_nlq_find_relevance(FT_INFO *handler, else a=c; } - if (docs[a].dpos == docid) + /* bounds check to avoid accessing unallocated handler->doc */ + if (a < handler->ndocs && docs[a].dpos == docid) return (float) docs[a].weight; else return 0.0; diff --git a/myisam/ft_stopwords.c b/myisam/ft_stopwords.c index 112af87d201..a4bce6ad4e8 100644 --- a/myisam/ft_stopwords.c +++ b/myisam/ft_stopwords.c @@ -125,4 +125,5 @@ void ft_free_stopwords() my_free((char*) stopwords3,MYF(0)); stopwords3=0; } + ft_stopword_file= 0; } diff --git a/myisam/mi_rnext_same.c b/myisam/mi_rnext_same.c index a50c578e081..06408f57a3f 100644 --- a/myisam/mi_rnext_same.c +++ b/myisam/mi_rnext_same.c @@ -57,7 +57,11 @@ int mi_rnext_same(MI_INFO *info, byte *buf) #endif case HA_KEY_ALG_BTREE: default: - memcpy(info->lastkey2,info->lastkey,info->last_rkey_length); + if (!(info->update & HA_STATE_RNEXT_SAME)) + { + /* First rnext_same; Store old key */ + memcpy(info->lastkey2,info->lastkey,info->last_rkey_length); + } for (;;) { if ((error=_mi_search_next(info,keyinfo,info->lastkey, @@ -81,7 +85,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf) rw_unlock(&info->s->key_root_lock[inx]); /* Don't clear if database-changed */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); - info->update|= HA_STATE_NEXT_FOUND; + info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME; if (error) { diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql index f42f7ca6b5f..cc44165405f 100644 --- a/mysql-test/lib/init_db.sql +++ b/mysql-test/lib/init_db.sql @@ -1,54 +1,470 @@ USE mysql; -CREATE TABLE db (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db,User),KEY User (User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges'; +CREATE TABLE db ( + Host char(60) binary DEFAULT '' NOT NULL, + Db char(64) binary DEFAULT '' NOT NULL, + User char(16) binary DEFAULT '' NOT NULL, + Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, + References_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, + PRIMARY KEY Host (Host,Db,User), + KEY User (User) +) engine=MyISAM +CHARACTER SET utf8 COLLATE utf8_bin +comment='Database privileges'; + -INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); +INSERT INTO db VALUES ('%','test' ,'','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y'); -CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,PRIMARY KEY Host (Host,Db)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; +CREATE TABLE host ( + Host char(60) binary DEFAULT '' NOT NULL, + Db char(64) binary DEFAULT '' NOT NULL, + Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, + References_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, + PRIMARY KEY Host (Host,Db) +) engine=MyISAM +CHARACTER SET utf8 COLLATE utf8_bin +comment='Host privileges; Merged with database privileges'; -CREATE TABLE user (Host char(60) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Password char(41) binary DEFAULT '' NOT NULL,Select_priv enum('N','Y') DEFAULT 'N' NOT NULL,Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL,Update_priv enum('N','Y') DEFAULT 'N' NOT NULL,Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_priv enum('N','Y') DEFAULT 'N' NOT NULL,Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL,Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL,Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL,Process_priv enum('N','Y') DEFAULT 'N' NOT NULL,File_priv enum('N','Y') DEFAULT 'N' NOT NULL,Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL,References_priv enum('N','Y') DEFAULT 'N' NOT NULL,Index_priv enum('N','Y') DEFAULT 'N' NOT NULL,Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL,Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL,Super_priv enum('N','Y') DEFAULT 'N' NOT NULL,Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL,Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL,Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL,Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL,ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL,ssl_cipher BLOB NOT NULL,x509_issuer BLOB NOT NULL,x509_subject BLOB NOT NULL,max_questions int(11) unsigned DEFAULT 0 NOT NULL,max_updates int(11) unsigned DEFAULT 0 NOT NULL,max_connections int(11) unsigned DEFAULT 0 NOT NULL,PRIMARY KEY Host (Host,User)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; -INSERT INTO user VALUES ('%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); -INSERT INTO user VALUES ('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0); +CREATE TABLE user ( + Host char(60) binary DEFAULT '' NOT NULL, + User char(16) binary DEFAULT '' NOT NULL, + Password char(41) binary DEFAULT '' NOT NULL, + Select_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Update_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Create_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Process_priv enum('N','Y') DEFAULT 'N' NOT NULL, + File_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL, + References_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Index_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Super_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL, + Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL, + ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL, + ssl_cipher BLOB NOT NULL, + x509_issuer BLOB NOT NULL, + x509_subject BLOB NOT NULL, + max_questions int(11) unsigned DEFAULT 0 NOT NULL, + max_updates int(11) unsigned DEFAULT 0 NOT NULL, + max_connections int(11) unsigned DEFAULT 0 NOT NULL, + PRIMARY KEY Host (Host,User) +) engine=MyISAM +CHARACTER SET utf8 COLLATE utf8_bin +comment='Users and global privileges'; -CREATE TABLE func (name char(64) binary DEFAULT '' NOT NULL,ret tinyint(1) DEFAULT '0' NOT NULL,dl char(128) DEFAULT '' NOT NULL,type enum ('function','aggregate') NOT NULL,PRIMARY KEY (name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions'; -CREATE TABLE tables_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Grantor char(77) DEFAULT '' NOT NULL,Timestamp timestamp(14),Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL,Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; +INSERT INTO user VALUES ('localhost' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); +INSERT INTO user VALUES ('@HOSTNAME@%','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); +REPLACE INTO user VALUES ('127.0.0.1' ,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0); +INSERT INTO user (host,user) VALUES ('localhost',''); +INSERT INTO user (host,user) VALUES ('@HOSTNAME@%',''); -CREATE TABLE columns_priv (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary DEFAULT '' NOT NULL,User char(16) binary DEFAULT '' NOT NULL,Table_name char(64) binary DEFAULT '' NOT NULL,Column_name char(64) binary DEFAULT '' NOT NULL,Timestamp timestamp(14),Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL,PRIMARY KEY (Host,Db,User,Table_name,Column_name)) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges'; -CREATE TABLE help_topic (help_topic_id int unsigned not null,name varchar(64) not null,help_category_id smallint unsigned not null,description text not null,example text not null,url varchar(128) not null,primary key (help_topic_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help topics'; - -CREATE TABLE help_category (help_category_id smallint unsigned not null,name varchar(64) not null,parent_category_id smallint unsigned null,url varchar(128) not null,primary key (help_category_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help categories'; +CREATE TABLE func ( + name char(64) binary DEFAULT '' NOT NULL, + ret tinyint(1) DEFAULT '0' NOT NULL, + dl char(128) DEFAULT '' NOT NULL, + type enum ('function','aggregate') NOT NULL, + PRIMARY KEY (name) +) engine=MyISAM +CHARACTER SET utf8 COLLATE utf8_bin +comment='User defined functions'; + + +CREATE TABLE tables_priv ( + Host char(60) binary DEFAULT '' NOT NULL, + Db char(64) binary DEFAULT '' NOT NULL, + User char(16) binary DEFAULT '' NOT NULL, + Table_name char(64) binary DEFAULT '' NOT NULL, + Grantor char(77) DEFAULT '' NOT NULL, + Timestamp timestamp(14), + Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, + Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, + PRIMARY KEY (Host,Db,User,Table_name),KEY Grantor (Grantor) +) engine=MyISAM +CHARACTER SET utf8 COLLATE utf8_bin +comment='Table privileges'; + -CREATE TABLE help_keyword (help_keyword_id int unsigned not null,name varchar(64) not null,primary key (help_keyword_id),unique index (name)) engine=MyISAM CHARACTER SET utf8 comment='help keywords'; +CREATE TABLE columns_priv ( + Host char(60) binary DEFAULT '' NOT NULL, + Db char(64) binary DEFAULT '' NOT NULL, + User char(16) binary DEFAULT '' NOT NULL, + Table_name char(64) binary DEFAULT '' NOT NULL, + Column_name char(64) binary DEFAULT '' NOT NULL, + Timestamp timestamp(14), + Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, + PRIMARY KEY (Host,Db,User,Table_name,Column_name) +) engine=MyISAM +CHARACTER SET utf8 COLLATE utf8_bin +comment='Column privileges'; -CREATE TABLE help_relation (help_topic_id int unsigned not null references help_topic,help_keyword_id int unsigned not null references help_keyword,primary key (help_keyword_id, help_topic_id)) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation'; -CREATE TABLE time_zone_name (Name char(64) NOT NULL,Time_zone_id int unsigned NOT NULL,PRIMARY KEY Name (Name)) engine=MyISAM CHARACTER SET utf8 comment='Time zone names'; +CREATE TABLE help_topic ( + help_topic_id int unsigned not null, + name varchar(64) not null, + help_category_id smallint unsigned not null, + description text not null, + example text not null, + url varchar(128) not null, + primary key (help_topic_id), + unique index (name) +) engine=MyISAM +CHARACTER SET utf8 +comment='help topics'; + -INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES ('MET', 1), ('UTC', 2), ('Universal', 2), ('Europe/Moscow',3), ('leap/Europe/Moscow',4), ('Japan', 5); +CREATE TABLE help_category ( + help_category_id smallint unsigned not null, + name varchar(64) not null, + parent_category_id smallint unsigned null, + url varchar(128) not null, + primary key (help_category_id),unique index (name) +) engine=MyISAM +CHARACTER SET utf8 +comment='help categories'; + + +CREATE TABLE help_keyword ( + help_keyword_id int unsigned not null, + name varchar(64) not null, + primary key (help_keyword_id),unique index (name) +) engine=MyISAM +CHARACTER SET utf8 +comment='help keywords'; + +CREATE TABLE help_relation ( + help_topic_id int unsigned not null references help_topic, + help_keyword_id int unsigned not null references help_keyword, + primary key (help_keyword_id, help_topic_id) +) engine=MyISAM +CHARACTER SET utf8 +comment='keyword-topic relation'; + + +CREATE TABLE time_zone_name ( + Name char(64) NOT NULL, + Time_zone_id int unsigned NOT NULL, + PRIMARY KEY Name (Name) +) engine=MyISAM +CHARACTER SET utf8 +comment='Time zone names'; -CREATE TABLE time_zone (Time_zone_id int unsigned NOT NULL auto_increment,Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL,PRIMARY KEY TzId (Time_zone_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zones'; -INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); +INSERT INTO time_zone_name (Name, Time_Zone_id) VALUES + ('MET', 1), ('UTC', 2), ('Universal', 2), + ('Europe/Moscow',3), ('leap/Europe/Moscow',4), + ('Japan', 5); -CREATE TABLE time_zone_transition (Time_zone_id int unsigned NOT NULL,Transition_time bigint signed NOT NULL,Transition_type_id int unsigned NOT NULL,PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions'; +CREATE TABLE time_zone ( + Time_zone_id int unsigned NOT NULL auto_increment, + Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL, + PRIMARY KEY TzId (Time_zone_id) +) engine=MyISAM +CHARACTER SET utf8 +comment='Time zones'; + -INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES (1, -1693706400, 0) ,(1, -1680483600, 1),(1, -1663455600, 2) ,(1, -1650150000, 3),(1, -1632006000, 2) ,(1, -1618700400, 3),(1, -938905200, 2) ,(1, -857257200, 3),(1, -844556400, 2) ,(1, -828226800, 3),(1, -812502000, 2) ,(1, -796777200, 3),(1, 228877200, 2) ,(1, 243997200, 3),(1, 260326800, 2) ,(1, 276051600, 3),(1, 291776400, 2) ,(1, 307501200, 3),(1, 323830800, 2) ,(1, 338950800, 3),(1, 354675600, 2) ,(1, 370400400, 3),(1, 386125200, 2) ,(1, 401850000, 3),(1, 417574800, 2) ,(1, 433299600, 3),(1, 449024400, 2) ,(1, 465354000, 3),(1, 481078800, 2) ,(1, 496803600, 3),(1, 512528400, 2) ,(1, 528253200, 3),(1, 543978000, 2) ,(1, 559702800, 3),(1, 575427600, 2) ,(1, 591152400, 3),(1, 606877200, 2) ,(1, 622602000, 3),(1, 638326800, 2) ,(1, 654656400, 3),(1, 670381200, 2) ,(1, 686106000, 3),(1, 701830800, 2) ,(1, 717555600, 3),(1, 733280400, 2) ,(1, 749005200, 3),(1, 764730000, 2) ,(1, 780454800, 3),(1, 796179600, 2) ,(1, 811904400, 3),(1, 828234000, 2) ,(1, 846378000, 3),(1, 859683600, 2) ,(1, 877827600, 3),(1, 891133200, 2) ,(1, 909277200, 3),(1, 922582800, 2) ,(1, 941331600, 3),(1, 954032400, 2) ,(1, 972781200, 3),(1, 985482000, 2) ,(1, 1004230800, 3),(1, 1017536400, 2) ,(1, 1035680400, 3),(1, 1048986000, 2) ,(1, 1067130000, 3),(1, 1080435600, 2) ,(1, 1099184400, 3),(1, 1111885200, 2) ,(1, 1130634000, 3),(1, 1143334800, 2) ,(1, 1162083600, 3),(1, 1174784400, 2) ,(1, 1193533200, 3),(1, 1206838800, 2) ,(1, 1224982800, 3),(1, 1238288400, 2) ,(1, 1256432400, 3),(1, 1269738000, 2) ,(1, 1288486800, 3),(1, 1301187600, 2) ,(1, 1319936400, 3),(1, 1332637200, 2) ,(1, 1351386000, 3),(1, 1364691600, 2) ,(1, 1382835600, 3),(1, 1396141200, 2) ,(1, 1414285200, 3),(1, 1427590800, 2) ,(1, 1445734800, 3),(1, 1459040400, 2) ,(1, 1477789200, 3),(1, 1490490000, 2) ,(1, 1509238800, 3),(1, 1521939600, 2) ,(1, 1540688400, 3),(1, 1553994000, 2) ,(1, 1572138000, 3),(1, 1585443600, 2) ,(1, 1603587600, 3),(1, 1616893200, 2) ,(1, 1635642000, 3),(1, 1648342800, 2) ,(1, 1667091600, 3),(1, 1679792400, 2) ,(1, 1698541200, 3),(1, 1711846800, 2) ,(1, 1729990800, 3),(1, 1743296400, 2) ,(1, 1761440400, 3),(1, 1774746000, 2) ,(1, 1792890000, 3),(1, 1806195600, 2) ,(1, 1824944400, 3),(1, 1837645200, 2) ,(1, 1856394000, 3),(1, 1869094800, 2) ,(1, 1887843600, 3),(1, 1901149200, 2) ,(1, 1919293200, 3),(1, 1932598800, 2) ,(1, 1950742800, 3),(1, 1964048400, 2) ,(1, 1982797200, 3),(1, 1995498000, 2) ,(1, 2014246800, 3),(1, 2026947600, 2) ,(1, 2045696400, 3),(1, 2058397200, 2) ,(1, 2077146000, 3),(1, 2090451600, 2) ,(1, 2108595600, 3),(1, 2121901200, 2) ,(1, 2140045200, 3),(3, -1688265000, 2) ,(3, -1656819048, 1),(3, -1641353448, 2) ,(3, -1627965048, 3),(3, -1618716648, 1) ,(3, -1596429048, 3),(3, -1593829848, 5) ,(3, -1589860800, 4),(3, -1542427200, 5) ,(3, -1539493200, 6),(3, -1525323600, 5) ,(3, -1522728000, 4),(3, -1491188400, 7) ,(3, -1247536800, 4),(3, 354920400, 5) ,(3, 370728000, 4),(3, 386456400, 5) ,(3, 402264000, 4),(3, 417992400, 5) ,(3, 433800000, 4),(3, 449614800, 5) ,(3, 465346800, 8),(3, 481071600, 9) ,(3, 496796400, 8),(3, 512521200, 9) ,(3, 528246000, 8),(3, 543970800, 9) ,(3, 559695600, 8),(3, 575420400, 9) ,(3, 591145200, 8),(3, 606870000, 9) ,(3, 622594800, 8),(3, 638319600, 9) ,(3, 654649200, 8),(3, 670374000, 10) ,(3, 686102400, 11),(3, 695779200, 8) ,(3, 701812800, 5),(3, 717534000, 4) ,(3, 733273200, 9),(3, 748998000, 8) ,(3, 764722800, 9),(3, 780447600, 8) ,(3, 796172400, 9),(3, 811897200, 8) ,(3, 828226800, 9),(3, 846370800, 8) ,(3, 859676400, 9),(3, 877820400, 8) ,(3, 891126000, 9),(3, 909270000, 8) ,(3, 922575600, 9),(3, 941324400, 8) ,(3, 954025200, 9),(3, 972774000, 8) ,(3, 985474800, 9),(3, 1004223600, 8) ,(3, 1017529200, 9),(3, 1035673200, 8) ,(3, 1048978800, 9),(3, 1067122800, 8) ,(3, 1080428400, 9),(3, 1099177200, 8) ,(3, 1111878000, 9),(3, 1130626800, 8) ,(3, 1143327600, 9),(3, 1162076400, 8) ,(3, 1174777200, 9),(3, 1193526000, 8) ,(3, 1206831600, 9),(3, 1224975600, 8) ,(3, 1238281200, 9),(3, 1256425200, 8) ,(3, 1269730800, 9),(3, 1288479600, 8) ,(3, 1301180400, 9),(3, 1319929200, 8) ,(3, 1332630000, 9),(3, 1351378800, 8) ,(3, 1364684400, 9),(3, 1382828400, 8) ,(3, 1396134000, 9),(3, 1414278000, 8) ,(3, 1427583600, 9),(3, 1445727600, 8) ,(3, 1459033200, 9),(3, 1477782000, 8) ,(3, 1490482800, 9),(3, 1509231600, 8) ,(3, 1521932400, 9),(3, 1540681200, 8) ,(3, 1553986800, 9),(3, 1572130800, 8) ,(3, 1585436400, 9),(3, 1603580400, 8) ,(3, 1616886000, 9),(3, 1635634800, 8) ,(3, 1648335600, 9),(3, 1667084400, 8) ,(3, 1679785200, 9),(3, 1698534000, 8) ,(3, 1711839600, 9),(3, 1729983600, 8) ,(3, 1743289200, 9),(3, 1761433200, 8) ,(3, 1774738800, 9),(3, 1792882800, 8) ,(3, 1806188400, 9),(3, 1824937200, 8) ,(3, 1837638000, 9),(3, 1856386800, 8) ,(3, 1869087600, 9),(3, 1887836400, 8) ,(3, 1901142000, 9),(3, 1919286000, 8) ,(3, 1932591600, 9),(3, 1950735600, 8) ,(3, 1964041200, 9),(3, 1982790000, 8) ,(3, 1995490800, 9),(3, 2014239600, 8) ,(3, 2026940400, 9),(3, 2045689200, 8) ,(3, 2058390000, 9),(3, 2077138800, 8) ,(3, 2090444400, 9),(3, 2108588400, 8) ,(3, 2121894000, 9),(3, 2140038000, 8),(4, -1688265000, 2) ,(4, -1656819048, 1),(4, -1641353448, 2) ,(4, -1627965048, 3),(4, -1618716648, 1) ,(4, -1596429048, 3),(4, -1593829848, 5) ,(4, -1589860800, 4),(4, -1542427200, 5) ,(4, -1539493200, 6),(4, -1525323600, 5) ,(4, -1522728000, 4),(4, -1491188400, 7) ,(4, -1247536800, 4),(4, 354920409, 5) ,(4, 370728010, 4),(4, 386456410, 5) ,(4, 402264011, 4),(4, 417992411, 5) ,(4, 433800012, 4),(4, 449614812, 5) ,(4, 465346812, 8),(4, 481071612, 9) ,(4, 496796413, 8),(4, 512521213, 9) ,(4, 528246013, 8),(4, 543970813, 9) ,(4, 559695613, 8),(4, 575420414, 9) ,(4, 591145214, 8),(4, 606870014, 9) ,(4, 622594814, 8),(4, 638319615, 9) ,(4, 654649215, 8),(4, 670374016, 10) ,(4, 686102416, 11),(4, 695779216, 8) ,(4, 701812816, 5),(4, 717534017, 4) ,(4, 733273217, 9),(4, 748998018, 8) ,(4, 764722818, 9),(4, 780447619, 8) ,(4, 796172419, 9),(4, 811897219, 8) ,(4, 828226820, 9),(4, 846370820, 8) ,(4, 859676420, 9),(4, 877820421, 8) ,(4, 891126021, 9),(4, 909270021, 8) ,(4, 922575622, 9),(4, 941324422, 8) ,(4, 954025222, 9),(4, 972774022, 8) ,(4, 985474822, 9),(4, 1004223622, 8) ,(4, 1017529222, 9),(4, 1035673222, 8) ,(4, 1048978822, 9),(4, 1067122822, 8) ,(4, 1080428422, 9),(4, 1099177222, 8) ,(4, 1111878022, 9),(4, 1130626822, 8) ,(4, 1143327622, 9),(4, 1162076422, 8) ,(4, 1174777222, 9),(4, 1193526022, 8) ,(4, 1206831622, 9),(4, 1224975622, 8) ,(4, 1238281222, 9),(4, 1256425222, 8) ,(4, 1269730822, 9),(4, 1288479622, 8) ,(4, 1301180422, 9),(4, 1319929222, 8) ,(4, 1332630022, 9),(4, 1351378822, 8) ,(4, 1364684422, 9),(4, 1382828422, 8) ,(4, 1396134022, 9),(4, 1414278022, 8) ,(4, 1427583622, 9),(4, 1445727622, 8) ,(4, 1459033222, 9),(4, 1477782022, 8) ,(4, 1490482822, 9),(4, 1509231622, 8) ,(4, 1521932422, 9),(4, 1540681222, 8) ,(4, 1553986822, 9),(4, 1572130822, 8) ,(4, 1585436422, 9),(4, 1603580422, 8) ,(4, 1616886022, 9),(4, 1635634822, 8) ,(4, 1648335622, 9),(4, 1667084422, 8) ,(4, 1679785222, 9),(4, 1698534022, 8) ,(4, 1711839622, 9),(4, 1729983622, 8) ,(4, 1743289222, 9),(4, 1761433222, 8) ,(4, 1774738822, 9),(4, 1792882822, 8) ,(4, 1806188422, 9),(4, 1824937222, 8) ,(4, 1837638022, 9),(4, 1856386822, 8) ,(4, 1869087622, 9),(4, 1887836422, 8) ,(4, 1901142022, 9),(4, 1919286022, 8) ,(4, 1932591622, 9),(4, 1950735622, 8) ,(4, 1964041222, 9),(4, 1982790022, 8) ,(4, 1995490822, 9),(4, 2014239622, 8) ,(4, 2026940422, 9),(4, 2045689222, 8) ,(4, 2058390022, 9),(4, 2077138822, 8) ,(4, 2090444422, 9),(4, 2108588422, 8) ,(4, 2121894022, 9),(4, 2140038022, 8); +INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) + VALUES (1,'N'), (2,'N'), (3,'N'), (4,'Y'), (5,'N'); + +CREATE TABLE time_zone_transition ( + Time_zone_id int unsigned NOT NULL, + Transition_time bigint signed NOT NULL, + Transition_type_id int unsigned NOT NULL, + PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) +) engine=MyISAM +CHARACTER SET utf8 +comment='Time zone transitions'; -CREATE TABLE time_zone_transition_type (Time_zone_id int unsigned NOT NULL,Transition_type_id int unsigned NOT NULL,Offset int signed DEFAULT 0 NOT NULL,Is_DST tinyint unsigned DEFAULT 0 NOT NULL,Abbreviation char(8) DEFAULT '' NOT NULL,PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id)) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types'; -INSERT INTO time_zone_transition_type (Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') ,(2, 0, 0, 0, 'UTC') ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST'); +INSERT INTO time_zone_transition + (Time_zone_id, Transition_time, Transition_type_id) +VALUES + (1, -1693706400, 0) ,(1, -1680483600, 1) + ,(1, -1663455600, 2) ,(1, -1650150000, 3) + ,(1, -1632006000, 2) ,(1, -1618700400, 3) + ,(1, -938905200, 2) ,(1, -857257200, 3) + ,(1, -844556400, 2) ,(1, -828226800, 3) + ,(1, -812502000, 2) ,(1, -796777200, 3) + ,(1, 228877200, 2) ,(1, 243997200, 3) + ,(1, 260326800, 2) ,(1, 276051600, 3) + ,(1, 291776400, 2) ,(1, 307501200, 3) + ,(1, 323830800, 2) ,(1, 338950800, 3) + ,(1, 354675600, 2) ,(1, 370400400, 3) + ,(1, 386125200, 2) ,(1, 401850000, 3) + ,(1, 417574800, 2) ,(1, 433299600, 3) + ,(1, 449024400, 2) ,(1, 465354000, 3) + ,(1, 481078800, 2) ,(1, 496803600, 3) + ,(1, 512528400, 2) ,(1, 528253200, 3) + ,(1, 543978000, 2) ,(1, 559702800, 3) + ,(1, 575427600, 2) ,(1, 591152400, 3) + ,(1, 606877200, 2) ,(1, 622602000, 3) + ,(1, 638326800, 2) ,(1, 654656400, 3) + ,(1, 670381200, 2) ,(1, 686106000, 3) + ,(1, 701830800, 2) ,(1, 717555600, 3) + ,(1, 733280400, 2) ,(1, 749005200, 3) + ,(1, 764730000, 2) ,(1, 780454800, 3) + ,(1, 796179600, 2) ,(1, 811904400, 3) + ,(1, 828234000, 2) ,(1, 846378000, 3) + ,(1, 859683600, 2) ,(1, 877827600, 3) + ,(1, 891133200, 2) ,(1, 909277200, 3) + ,(1, 922582800, 2) ,(1, 941331600, 3) + ,(1, 954032400, 2) ,(1, 972781200, 3) + ,(1, 985482000, 2) ,(1, 1004230800, 3) + ,(1, 1017536400, 2) ,(1, 1035680400, 3) + ,(1, 1048986000, 2) ,(1, 1067130000, 3) + ,(1, 1080435600, 2) ,(1, 1099184400, 3) + ,(1, 1111885200, 2) ,(1, 1130634000, 3) + ,(1, 1143334800, 2) ,(1, 1162083600, 3) + ,(1, 1174784400, 2) ,(1, 1193533200, 3) + ,(1, 1206838800, 2) ,(1, 1224982800, 3) + ,(1, 1238288400, 2) ,(1, 1256432400, 3) + ,(1, 1269738000, 2) ,(1, 1288486800, 3) + ,(1, 1301187600, 2) ,(1, 1319936400, 3) + ,(1, 1332637200, 2) ,(1, 1351386000, 3) + ,(1, 1364691600, 2) ,(1, 1382835600, 3) + ,(1, 1396141200, 2) ,(1, 1414285200, 3) + ,(1, 1427590800, 2) ,(1, 1445734800, 3) + ,(1, 1459040400, 2) ,(1, 1477789200, 3) + ,(1, 1490490000, 2) ,(1, 1509238800, 3) + ,(1, 1521939600, 2) ,(1, 1540688400, 3) + ,(1, 1553994000, 2) ,(1, 1572138000, 3) + ,(1, 1585443600, 2) ,(1, 1603587600, 3) + ,(1, 1616893200, 2) ,(1, 1635642000, 3) + ,(1, 1648342800, 2) ,(1, 1667091600, 3) + ,(1, 1679792400, 2) ,(1, 1698541200, 3) + ,(1, 1711846800, 2) ,(1, 1729990800, 3) + ,(1, 1743296400, 2) ,(1, 1761440400, 3) + ,(1, 1774746000, 2) ,(1, 1792890000, 3) + ,(1, 1806195600, 2) ,(1, 1824944400, 3) + ,(1, 1837645200, 2) ,(1, 1856394000, 3) + ,(1, 1869094800, 2) ,(1, 1887843600, 3) + ,(1, 1901149200, 2) ,(1, 1919293200, 3) + ,(1, 1932598800, 2) ,(1, 1950742800, 3) + ,(1, 1964048400, 2) ,(1, 1982797200, 3) + ,(1, 1995498000, 2) ,(1, 2014246800, 3) + ,(1, 2026947600, 2) ,(1, 2045696400, 3) + ,(1, 2058397200, 2) ,(1, 2077146000, 3) + ,(1, 2090451600, 2) ,(1, 2108595600, 3) + ,(1, 2121901200, 2) ,(1, 2140045200, 3) + ,(3, -1688265000, 2) ,(3, -1656819048, 1) + ,(3, -1641353448, 2) ,(3, -1627965048, 3) + ,(3, -1618716648, 1) ,(3, -1596429048, 3) + ,(3, -1593829848, 5) ,(3, -1589860800, 4) + ,(3, -1542427200, 5) ,(3, -1539493200, 6) + ,(3, -1525323600, 5) ,(3, -1522728000, 4) + ,(3, -1491188400, 7) ,(3, -1247536800, 4) + ,(3, 354920400, 5) ,(3, 370728000, 4) + ,(3, 386456400, 5) ,(3, 402264000, 4) + ,(3, 417992400, 5) ,(3, 433800000, 4) + ,(3, 449614800, 5) ,(3, 465346800, 8) + ,(3, 481071600, 9) ,(3, 496796400, 8) + ,(3, 512521200, 9) ,(3, 528246000, 8) + ,(3, 543970800, 9) ,(3, 559695600, 8) + ,(3, 575420400, 9) ,(3, 591145200, 8) + ,(3, 606870000, 9) ,(3, 622594800, 8) + ,(3, 638319600, 9) ,(3, 654649200, 8) + ,(3, 670374000, 10) ,(3, 686102400, 11) + ,(3, 695779200, 8) ,(3, 701812800, 5) + ,(3, 717534000, 4) ,(3, 733273200, 9) + ,(3, 748998000, 8) ,(3, 764722800, 9) + ,(3, 780447600, 8) ,(3, 796172400, 9) + ,(3, 811897200, 8) ,(3, 828226800, 9) + ,(3, 846370800, 8) ,(3, 859676400, 9) + ,(3, 877820400, 8) ,(3, 891126000, 9) + ,(3, 909270000, 8) ,(3, 922575600, 9) + ,(3, 941324400, 8) ,(3, 954025200, 9) + ,(3, 972774000, 8) ,(3, 985474800, 9) + ,(3, 1004223600, 8) ,(3, 1017529200, 9) + ,(3, 1035673200, 8) ,(3, 1048978800, 9) + ,(3, 1067122800, 8) ,(3, 1080428400, 9) + ,(3, 1099177200, 8) ,(3, 1111878000, 9) + ,(3, 1130626800, 8) ,(3, 1143327600, 9) + ,(3, 1162076400, 8) ,(3, 1174777200, 9) + ,(3, 1193526000, 8) ,(3, 1206831600, 9) + ,(3, 1224975600, 8) ,(3, 1238281200, 9) + ,(3, 1256425200, 8) ,(3, 1269730800, 9) + ,(3, 1288479600, 8) ,(3, 1301180400, 9) + ,(3, 1319929200, 8) ,(3, 1332630000, 9) + ,(3, 1351378800, 8) ,(3, 1364684400, 9) + ,(3, 1382828400, 8) ,(3, 1396134000, 9) + ,(3, 1414278000, 8) ,(3, 1427583600, 9) + ,(3, 1445727600, 8) ,(3, 1459033200, 9) + ,(3, 1477782000, 8) ,(3, 1490482800, 9) + ,(3, 1509231600, 8) ,(3, 1521932400, 9) + ,(3, 1540681200, 8) ,(3, 1553986800, 9) + ,(3, 1572130800, 8) ,(3, 1585436400, 9) + ,(3, 1603580400, 8) ,(3, 1616886000, 9) + ,(3, 1635634800, 8) ,(3, 1648335600, 9) + ,(3, 1667084400, 8) ,(3, 1679785200, 9) + ,(3, 1698534000, 8) ,(3, 1711839600, 9) + ,(3, 1729983600, 8) ,(3, 1743289200, 9) + ,(3, 1761433200, 8) ,(3, 1774738800, 9) + ,(3, 1792882800, 8) ,(3, 1806188400, 9) + ,(3, 1824937200, 8) ,(3, 1837638000, 9) + ,(3, 1856386800, 8) ,(3, 1869087600, 9) + ,(3, 1887836400, 8) ,(3, 1901142000, 9) + ,(3, 1919286000, 8) ,(3, 1932591600, 9) + ,(3, 1950735600, 8) ,(3, 1964041200, 9) + ,(3, 1982790000, 8) ,(3, 1995490800, 9) + ,(3, 2014239600, 8) ,(3, 2026940400, 9) + ,(3, 2045689200, 8) ,(3, 2058390000, 9) + ,(3, 2077138800, 8) ,(3, 2090444400, 9) + ,(3, 2108588400, 8) ,(3, 2121894000, 9) + ,(3, 2140038000, 8) + ,(4, -1688265000, 2) ,(4, -1656819048, 1) + ,(4, -1641353448, 2) ,(4, -1627965048, 3) + ,(4, -1618716648, 1) ,(4, -1596429048, 3) + ,(4, -1593829848, 5) ,(4, -1589860800, 4) + ,(4, -1542427200, 5) ,(4, -1539493200, 6) + ,(4, -1525323600, 5) ,(4, -1522728000, 4) + ,(4, -1491188400, 7) ,(4, -1247536800, 4) + ,(4, 354920409, 5) ,(4, 370728010, 4) + ,(4, 386456410, 5) ,(4, 402264011, 4) + ,(4, 417992411, 5) ,(4, 433800012, 4) + ,(4, 449614812, 5) ,(4, 465346812, 8) + ,(4, 481071612, 9) ,(4, 496796413, 8) + ,(4, 512521213, 9) ,(4, 528246013, 8) + ,(4, 543970813, 9) ,(4, 559695613, 8) + ,(4, 575420414, 9) ,(4, 591145214, 8) + ,(4, 606870014, 9) ,(4, 622594814, 8) + ,(4, 638319615, 9) ,(4, 654649215, 8) + ,(4, 670374016, 10) ,(4, 686102416, 11) + ,(4, 695779216, 8) ,(4, 701812816, 5) + ,(4, 717534017, 4) ,(4, 733273217, 9) + ,(4, 748998018, 8) ,(4, 764722818, 9) + ,(4, 780447619, 8) ,(4, 796172419, 9) + ,(4, 811897219, 8) ,(4, 828226820, 9) + ,(4, 846370820, 8) ,(4, 859676420, 9) + ,(4, 877820421, 8) ,(4, 891126021, 9) + ,(4, 909270021, 8) ,(4, 922575622, 9) + ,(4, 941324422, 8) ,(4, 954025222, 9) + ,(4, 972774022, 8) ,(4, 985474822, 9) + ,(4, 1004223622, 8) ,(4, 1017529222, 9) + ,(4, 1035673222, 8) ,(4, 1048978822, 9) + ,(4, 1067122822, 8) ,(4, 1080428422, 9) + ,(4, 1099177222, 8) ,(4, 1111878022, 9) + ,(4, 1130626822, 8) ,(4, 1143327622, 9) + ,(4, 1162076422, 8) ,(4, 1174777222, 9) + ,(4, 1193526022, 8) ,(4, 1206831622, 9) + ,(4, 1224975622, 8) ,(4, 1238281222, 9) + ,(4, 1256425222, 8) ,(4, 1269730822, 9) + ,(4, 1288479622, 8) ,(4, 1301180422, 9) + ,(4, 1319929222, 8) ,(4, 1332630022, 9) + ,(4, 1351378822, 8) ,(4, 1364684422, 9) + ,(4, 1382828422, 8) ,(4, 1396134022, 9) + ,(4, 1414278022, 8) ,(4, 1427583622, 9) + ,(4, 1445727622, 8) ,(4, 1459033222, 9) + ,(4, 1477782022, 8) ,(4, 1490482822, 9) + ,(4, 1509231622, 8) ,(4, 1521932422, 9) + ,(4, 1540681222, 8) ,(4, 1553986822, 9) + ,(4, 1572130822, 8) ,(4, 1585436422, 9) + ,(4, 1603580422, 8) ,(4, 1616886022, 9) + ,(4, 1635634822, 8) ,(4, 1648335622, 9) + ,(4, 1667084422, 8) ,(4, 1679785222, 9) + ,(4, 1698534022, 8) ,(4, 1711839622, 9) + ,(4, 1729983622, 8) ,(4, 1743289222, 9) + ,(4, 1761433222, 8) ,(4, 1774738822, 9) + ,(4, 1792882822, 8) ,(4, 1806188422, 9) + ,(4, 1824937222, 8) ,(4, 1837638022, 9) + ,(4, 1856386822, 8) ,(4, 1869087622, 9) + ,(4, 1887836422, 8) ,(4, 1901142022, 9) + ,(4, 1919286022, 8) ,(4, 1932591622, 9) + ,(4, 1950735622, 8) ,(4, 1964041222, 9) + ,(4, 1982790022, 8) ,(4, 1995490822, 9) + ,(4, 2014239622, 8) ,(4, 2026940422, 9) + ,(4, 2045689222, 8) ,(4, 2058390022, 9) + ,(4, 2077138822, 8) ,(4, 2090444422, 9) + ,(4, 2108588422, 8) ,(4, 2121894022, 9) + ,(4, 2140038022, 8) + ,(5, -1009875600, 1); + + +CREATE TABLE time_zone_transition_type ( + Time_zone_id int unsigned NOT NULL, + Transition_type_id int unsigned NOT NULL, + Offset int signed DEFAULT 0 NOT NULL, + Is_DST tinyint unsigned DEFAULT 0 NOT NULL, + Abbreviation char(8) DEFAULT '' NOT NULL, + PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) +) engine=MyISAM +CHARACTER SET utf8 +comment='Time zone transition types'; -CREATE TABLE time_zone_leap_second (Transition_time bigint signed NOT NULL,Correction int signed NOT NULL,PRIMARY KEY TranTime (Transition_time)) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; -INSERT INTO time_zone_leap_second (Transition_time, Correction) VALUES (78796800, 1) ,(94694401, 2) ,(126230402, 3) ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) ,(915148821, 22); +INSERT INTO time_zone_transition_type ( + Time_zone_id,Transition_type_id, Offset, Is_DST, Abbreviation) VALUES + (1, 0, 7200, 1, 'MEST') ,(1, 1, 3600, 0, 'MET') + ,(1, 2, 7200, 1, 'MEST') ,(1, 3, 3600, 0, 'MET') + ,(2, 0, 0, 0, 'UTC') + ,(3, 0, 9000, 0, 'MMT') ,(3, 1, 12648, 1, 'MST') + ,(3, 2, 9048, 0, 'MMT') ,(3, 3, 16248, 1, 'MDST') + ,(3, 4, 10800, 0, 'MSK') ,(3, 5, 14400, 1, 'MSD') + ,(3, 6, 18000, 1, 'MSD') ,(3, 7, 7200, 0, 'EET') + ,(3, 8, 10800, 0, 'MSK') ,(3, 9, 14400, 1, 'MSD') + ,(3, 10, 10800, 1, 'EEST') ,(3, 11, 7200, 0, 'EET') + ,(4, 0, 9000, 0, 'MMT') ,(4, 1, 12648, 1, 'MST') + ,(4, 2, 9048, 0, 'MMT') ,(4, 3, 16248, 1, 'MDST') + ,(4, 4, 10800, 0, 'MSK') ,(4, 5, 14400, 1, 'MSD') + ,(4, 6, 18000, 1, 'MSD') ,(4, 7, 7200, 0, 'EET') + ,(4, 8, 10800, 0, 'MSK') ,(4, 9, 14400, 1, 'MSD') + ,(4, 10, 10800, 1, 'EEST') ,(4, 11, 7200, 0, 'EET') + ,(5, 0, 32400, 0, 'CJT') ,(5, 1, 32400, 0, 'JST'); +CREATE TABLE time_zone_leap_second ( + Transition_time bigint signed NOT NULL, + Correction int signed NOT NULL, + PRIMARY KEY TranTime (Transition_time) +) engine=MyISAM +CHARACTER SET utf8 +comment='Leap seconds information for time zones'; + + +INSERT INTO time_zone_leap_second ( + Transition_time, Correction) VALUES + (78796800, 1) ,(94694401, 2) ,(126230402, 3) + ,(157766403, 4) ,(189302404, 5) ,(220924805, 6) + ,(252460806, 7) ,(283996807, 8) ,(315532808, 9) + ,(362793609, 10) ,(394329610, 11) ,(425865611, 12) + ,(489024012, 13) ,(567993613, 14) ,(631152014, 15) + ,(662688015, 16) ,(709948816, 17) ,(741484817, 18) + ,(773020818, 19) ,(820454419, 20) ,(867715220, 21) + ,(915148821, 22); diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl index e1461a9730c..8aefc235d72 100644 --- a/mysql-test/lib/mtr_process.pl +++ b/mysql-test/lib/mtr_process.pl @@ -123,6 +123,17 @@ sub spawn_impl ($$$$$$$) { $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't + if ( $::glob_cygwin_shell and $mode eq 'test' ) + { + # Programs started from mysqltest under Cygwin, are to + # execute them within Cygwin. Else simple things in test + # files like + # --system "echo 1 > file" + # will fail. + # FIXME not working :-( +# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c"; + } + if ( $output ) { if ( ! open(STDOUT,">",$output) ) @@ -130,6 +141,7 @@ sub spawn_impl ($$$$$$$) { mtr_error("can't redirect STDOUT to \"$output\": $!"); } } + if ( $error ) { if ( $output eq $error ) @@ -147,6 +159,7 @@ sub spawn_impl ($$$$$$$) { } } } + if ( $input ) { if ( ! open(STDIN,"<",$input) ) @@ -154,7 +167,11 @@ sub spawn_impl ($$$$$$$) { mtr_error("can't redirect STDIN to \"$input\": $!"); } } - exec($path,@$arg_list_t); + + if ( ! exec($path,@$arg_list_t) ) + { + mtr_error("failed to execute \"$path\": $!"); + } } } } @@ -569,7 +586,7 @@ sub mtr_stop_mysqld_servers ($) { sub mtr_mysqladmin_shutdown () { my $spec= shift; - my @mysql_admin_pids; + my %mysql_admin_pids; my @to_kill_specs; foreach my $srv ( @$spec ) @@ -611,13 +628,19 @@ sub mtr_mysqladmin_shutdown () { # We don't wait for termination of mysqladmin my $pid= mtr_spawn($::exe_mysqladmin, $args, "", $::path_manager_log, $::path_manager_log, ""); - push(@mysql_admin_pids, $pid); + $mysql_admin_pids{$pid}= 1; } # We wait blocking, we wait for the last one anyway - foreach my $pid (@mysql_admin_pids) + while (keys %mysql_admin_pids) { - waitpid($pid,0); # FIXME no need to check -1 or 0? + foreach my $pid (keys %mysql_admin_pids) + { + if ( waitpid($pid,0) > 0 ) + { + delete $mysql_admin_pids{$pid}; + } + } } # If we trusted "mysqladmin --shutdown_timeout= ..." we could just diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index c45bb1601ce..3729ff512ee 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -50,12 +50,14 @@ sub mtr_show_failed_diff ($) { $result_file= "$result_file$::opt_result_ext"; } + my $diffopts= $::opt_udiff ? "-u" : "-c"; + if ( -f $reject_file ) { print "Below are the diffs between actual and expected results:\n"; print "-------------------------------------------------------\n"; # FIXME check result code?! - mtr_run("diff",["-c",$result_file,$reject_file], "", "", "", ""); + mtr_run("diff",[$diffopts,$result_file,$reject_file], "", "", "", ""); print "-------------------------------------------------------\n"; print "Please follow the instructions outlined at\n"; print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n"; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f204fee50ed..795df3623b0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -156,13 +156,13 @@ our @mysqld_src_dirs= our $glob_win32= 0; # OS and native Win32 executables our $glob_win32_perl= 0; # ActiveState Win32 Perl our $glob_cygwin_perl= 0; # Cygwin Perl +our $glob_cygwin_shell= undef; our $glob_mysql_test_dir= undef; our $glob_mysql_bench_dir= undef; our $glob_hostname= undef; our $glob_scriptname= undef; our $glob_use_running_server= 0; our $glob_use_running_ndbcluster= 0; -our $glob_user= 'test'; our $glob_use_embedded_server= 0; our $glob_basedir; @@ -281,6 +281,8 @@ our $opt_wait_timeout= 10; our $opt_warnings; +our $opt_udiff; + our $opt_with_ndbcluster; our $opt_with_openssl; @@ -358,6 +360,10 @@ sub main () { if ( $opt_start_and_exit ) { + if ( ndbcluster_start() ) + { + mtr_error("Can't start ndbcluster"); + } if ( mysqld_start('master',0,[],[]) ) { mtr_report("Servers started, exiting"); @@ -422,7 +428,9 @@ sub initial_setup () { { # Windows programs like 'mysqld' needs Windows paths $glob_mysql_test_dir= `cygpath -m $glob_mysql_test_dir`; + $glob_cygwin_shell= `cygpath -w $ENV{'SHELL'}`; # The Windows path c:\... chomp($glob_mysql_test_dir); + chomp($glob_cygwin_shell); } $glob_basedir= dirname($glob_mysql_test_dir); $glob_mysql_bench_dir= "$glob_basedir/mysql-bench"; # FIXME make configurable @@ -524,6 +532,7 @@ sub command_line_setup () { 'start-from=s' => \$opt_start_from, 'timer' => \$opt_timer, 'tmpdir=s' => \$opt_tmpdir, + 'unified-diff|udiff' => \$opt_udiff, 'user-test=s' => \$opt_user_test, 'user=s' => \$opt_user, 'verbose' => \$opt_verbose, @@ -712,17 +721,16 @@ sub command_line_setup () { # } #} - if ( $opt_user ) - { - $glob_user= $opt_user; - } - elsif ( $glob_use_running_server ) + if ( ! $opt_user ) { - $glob_user= "test"; - } - else - { - $glob_user= "root"; # We want to do FLUSH xxx commands + if ( $glob_use_running_server ) + { + $opt_user= "test"; + } + else + { + $opt_user= "root"; # We want to do FLUSH xxx commands + } } } @@ -837,7 +845,7 @@ sub executable_setup () { } else { - error("Cannot find embedded server 'mysqltest_embedded'"); + mtr_error("Cannot find embedded server 'mysqltest_embedded'"); } if ( -d "$path_tests_bindir/mysql_client_test_embedded" ) { @@ -860,9 +868,6 @@ sub executable_setup () { $exe_ndb_mgm= "$glob_basedir/bin/ndb_mgm"; } - # FIXME special $exe_master_mysqld and $exe_slave_mysqld - # are not used that much.... - if ( ! $exe_master_mysqld ) { $exe_master_mysqld= $exe_mysqld; @@ -1054,7 +1059,7 @@ sub ndbcluster_start () { "--data-dir=$glob_mysql_test_dir/var"], "", "/dev/null", "", "") ) { - mtr_error("Error ndbcluster_install"); + mtr_error("Error ndbcluster_start"); return 1; } @@ -1102,7 +1107,7 @@ sub run_benchmarks ($) { mtr_init_args(\$args); mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'}); - mtr_add_arg($args, "--user=root"); + mtr_add_arg($args, "--user=%s", $opt_user); if ( $opt_small_bench ) { @@ -1226,15 +1231,41 @@ sub install_db ($$) { my $type= shift; my $data_dir= shift; - my $init_db_sql= "lib/init_db.sql"; # FIXME this is too simple maybe + my $init_db_sql= "lib/init_db.sql"; + my $init_db_sql_tmp= "/tmp/init_db.sql$$"; my $args; mtr_report("Installing \u$type Databases"); + open(IN, $init_db_sql) + or error("Can't open $init_db_sql: $!"); + open(OUT, ">", $init_db_sql_tmp) + or error("Can't write to $init_db_sql_tmp: $!"); + while (<IN>) + { + chomp; + s/\@HOSTNAME\@/$glob_hostname/; + if ( /^\s*$/ ) + { + print OUT "\n"; + } + elsif (/;$/) + { + print OUT "$_\n"; + } + else + { + print OUT "$_ "; + } + } + close OUT; + close IN; + mtr_init_args(\$args); mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--bootstrap"); + mtr_add_arg($args, "--console"); mtr_add_arg($args, "--skip-grant-tables"); mtr_add_arg($args, "--basedir=%s", $path_my_basedir); mtr_add_arg($args, "--datadir=%s", $data_dir); @@ -1248,12 +1279,14 @@ sub install_db ($$) { mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir); } - if ( mtr_run($exe_mysqld, $args, $init_db_sql, + if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp, $path_manager_log, $path_manager_log, "") != 0 ) { + unlink($init_db_sql_tmp); mtr_error("Error executing mysqld --bootstrap\n" . "Could not install $type test DBs"); } + unlink($init_db_sql_tmp); } @@ -1491,8 +1524,8 @@ sub report_failure_and_restart ($) { # but stop before actually running mysqld or anything. sub do_before_start_master ($$) { - my $tname= shift; - my $master_init_script= shift; + my $tname= shift; + my $init_script= shift; # FIXME what about second master..... @@ -1502,8 +1535,8 @@ sub do_before_start_master ($$) { $tname ne "rpl_crash_binlog_ib_3b") { # FIXME we really want separate dir for binlogs - `rm -fr $glob_mysql_test_dir/var/log/master-bin.*`; -# unlink("$glob_mysql_test_dir/var/log/master-bin.*"); + `rm -f $glob_mysql_test_dir/var/log/master-bin*`; +# unlink("$glob_mysql_test_dir/var/log/master-bin*"); } # Remove old master.info and relay-log.info files @@ -1512,23 +1545,19 @@ sub do_before_start_master ($$) { unlink("$glob_mysql_test_dir/var/master1-data/master.info"); unlink("$glob_mysql_test_dir/var/master1-data/relay-log.info"); - #run master initialization shell script if one exists - - if ( $master_init_script and - mtr_run($master_init_script, [], "", "", "", "") != 0 ) + # Run master initialization shell script if one exists + if ( $init_script ) { - mtr_error("Can't run $master_init_script"); + # We ignore the return code + mtr_run("/bin/sh", ["-c",$init_script], "", "", "", ""); } # for gcov FIXME needed? If so we need more absolute paths # chdir($glob_basedir); } sub do_before_start_slave ($$) { - my $tname= shift; - my $slave_init_script= shift; - - # When testing fail-safe replication, we will have more than one slave - # in this case, we start secondary slaves with an argument + my $tname= shift; + my $init_script= shift; # Remove stale binary logs and old master.info files # except for too tests which need them @@ -1544,14 +1573,15 @@ sub do_before_start_slave ($$) { unlink("$glob_mysql_test_dir/var/slave-data/relay-log.info"); } - #run slave initialization shell script if one exists - if ( $slave_init_script and - mtr_run($slave_init_script, [], "", "", "", "") != 0 ) + # Run slave initialization shell script if one exists + if ( $init_script ) { - mtr_error("Can't run $slave_init_script"); + # We ignore the return code + mtr_run("/bin/sh", ["-c",$init_script], "", "", "", ""); } - unlink("$glob_mysql_test_dir/var/slave-data/log.*"); + `rm -f $glob_mysql_test_dir/var/slave-data/log.*`; +# unlink("$glob_mysql_test_dir/var/slave-data/log.*"); } sub mysqld_arguments ($$$$$) { @@ -1579,6 +1609,7 @@ sub mysqld_arguments ($$$$$) { mtr_add_arg($args, "%s--no-defaults", $prefix); } + mtr_add_arg($args, "%s--console", $prefix); mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); mtr_add_arg($args, "%s--core", $prefix); @@ -1669,12 +1700,12 @@ sub mysqld_arguments ($$$$$) { { if ( $type eq 'master' ) { - mtr_add_arg($args, "--debug=d:t:i:A,%s/var/log/master%s.trace", + mtr_add_arg($args, "%s--debug=d:t:i:A,%s/var/log/master%s.trace", $prefix, $glob_mysql_test_dir, $sidx); } if ( $type eq 'slave' ) { - mtr_add_arg($args, "--debug=d:t:i:A,%s/var/log/slave%s.trace", + mtr_add_arg($args, "%s--debug=d:t:i:A,%s/var/log/slave%s.trace", $prefix, $glob_mysql_test_dir, $sidx); } } @@ -1789,18 +1820,17 @@ sub mysqld_start ($$$$) { my $exe; my $pid; - # FIXME code duplication, make up your mind.... - if ( $opt_source_dist ) + if ( $type eq 'master' ) { - $exe= "$glob_basedir/sql/mysqld"; + $exe= $exe_master_mysqld; + } + elsif ( $type eq 'slave' ) + { + $exe= $exe_slave_mysqld; } else { - $exe ="$glob_basedir/libexec/mysqld"; - if ( ! -x $exe ) - { - $exe ="$glob_basedir/bin/mysqld"; - } + $exe= $exe_mysqld; } mtr_init_args(\$args); @@ -1983,7 +2013,7 @@ sub run_mysqltest ($$) { mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_mysock'}); mtr_add_arg($args, "--database=test"); - mtr_add_arg($args, "--user=%s", $glob_user); + mtr_add_arg($args, "--user=%s", $opt_user); mtr_add_arg($args, "--password="); mtr_add_arg($args, "--silent"); mtr_add_arg($args, "-v"); @@ -2054,7 +2084,7 @@ sub run_mysqltest ($$) { mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]); } - return mtr_run($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,""); + return mtr_run_test($exe_mysqltest,$args,$tinfo->{'path'},"",$path_timefile,""); } ############################################################################## @@ -2136,6 +2166,7 @@ Misc options start-and-exit Only initiate and start the "mysqld" servers fast Don't try to cleanup from earlier runs help Get this help text + unified-diff | udiff When presenting differences, use unified diff Options not yet described, or that I want to look into more diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index 6df9d963498..f57d8c191bf 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -326,3 +326,15 @@ latin1_german2_ci 6109 latin1_german2_ci 61 latin1_german2_ci 6120 drop table t1; +SET NAMES latin1; +CREATE TABLE t1 ( +col1 varchar(255) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 collate latin1_german2_ci; +INSERT INTO t1 VALUES ('ß'),('ss'),('ss'); +ALTER TABLE t1 ADD KEY ifword(col1); +SELECT * FROM t1 WHERE col1='ß' ORDER BY col1, BINARY col1; +col1 +ss +ss +ß +DROP TABLE t1; diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index 1f414f89e20..98e5992f374 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -91,3 +91,7 @@ sjis_bin 6109 sjis_bin 61 sjis_bin 6120 drop table t1; +SET NAMES sjis; +SELECT HEX('²“‘@\Œ\') FROM DUAL; +HEX('²“‘@_Œ\') +8DB2939181408C5C diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 67644a68598..dd5b0407eb3 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -402,6 +402,12 @@ select count(*) from t1; count(*) 1 drop table t1; +CREATE TABLE t1 ( a TEXT, FULLTEXT (a) ); +INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance'); +SELECT MATCH(a) AGAINST ('nosuchword') FROM t1; +MATCH(a) AGAINST ('nosuchword') +0 +DROP TABLE t1; create table t1 (a int primary key, b text, fulltext(b)); create table t2 (a int, b text); insert t1 values (1, "aaaa"), (2, "bbbb"); diff --git a/mysql-test/r/fulltext_cache.result b/mysql-test/r/fulltext_cache.result index 6a94189d8b4..80c101357c5 100644 --- a/mysql-test/r/fulltext_cache.result +++ b/mysql-test/r/fulltext_cache.result @@ -21,17 +21,17 @@ INSERT INTO t2 VALUES (5,2,'um copo de Vodka'); INSERT INTO t2 VALUES (6,2,'um chocolate Snickers'); INSERT INTO t2 VALUES (7,1,'Bife'); INSERT INTO t2 VALUES (8,1,'Pizza de Salmao'); -SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8) +SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x -aaaaaaaaa dsaass de sushi 1 1.92378664 -aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000 -aaaaaaaaa dsaass de Feijoada 3 0.00000000 -aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000 -ssde df s fsda sad er um copo de Vodka 5 0.00000000 -ssde df s fsda sad er um chocolate Snickers 6 0.00000000 -aaaaaaaaa dsaass de Bife 7 0.00000000 -aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000 +aaaaaaaaa dsaass de sushi 1 1.923787 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000 +aaaaaaaaa dsaass de Feijoada 3 0.000000 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000 +ssde df s fsda sad er um copo de Vodka 5 0.000000 +ssde df s fsda sad er um chocolate Snickers 6 0.000000 +aaaaaaaaa dsaass de Bife 7 0.000000 +aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000 SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x @@ -43,17 +43,17 @@ ssde df s fsda sad er um copo de Vodka 5 0 ssde df s fsda sad er um chocolate Snickers 6 0 aaaaaaaaa dsaass de Bife 7 0 aaaaaaaaa dsaass de Pizza de Salmao 8 0 -SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8) +SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6) as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x -aaaaaaaaa dsaass de sushi 1 1.92378664 -aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000 -aaaaaaaaa dsaass de Feijoada 3 0.00000000 -aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000 -ssde df s fsda sad er um copo de Vodka 5 0.00000000 -ssde df s fsda sad er um chocolate Snickers 6 0.00000000 -aaaaaaaaa dsaass de Bife 7 0.00000000 -aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000 +aaaaaaaaa dsaass de sushi 1 1.923787 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000 +aaaaaaaaa dsaass de Feijoada 3 0.000000 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000 +ssde df s fsda sad er um copo de Vodka 5 0.000000 +ssde df s fsda sad er um chocolate Snickers 6 0.000000 +aaaaaaaaa dsaass de Bife 7 0.000000 +aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000 SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; q item id x diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result index 753dc2cd749..ff7ec1ba73f 100644 --- a/mysql-test/r/insert_update.result +++ b/mysql-test/r/insert_update.result @@ -140,10 +140,10 @@ a b c 5 6 130 TRUNCATE TABLE t1; INSERT t1 VALUES (1,2,10), (3,4,20); -CREATE TABLE t2 (x INT, y INT, z INT, d INT); +CREATE TABLE t2 (a INT, b INT, c INT, d INT); INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1); INSERT t2 VALUES (2,1,11,2), (7,4,40,2); -INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100; +INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100; SELECT * FROM t1; a b c 1 2 10 @@ -157,7 +157,7 @@ a b c 3 4 120 5 0 30 8 9 60 -INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); +INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); SELECT *, VALUES(a) FROM t1; a b c VALUES(a) 1 2 10 NULL diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result index a79b6b04063..8361b66817a 100644 --- a/mysql-test/r/lowercase_table2.result +++ b/mysql-test/r/lowercase_table2.result @@ -141,3 +141,21 @@ select * from T1; a b 1 abc drop table T1; +create database mysqltest_LC2; +use mysqltest_LC2; +create table myUC (i int); +insert into myUC values (1),(2),(3); +select * from myUC; +i +1 +2 +3 +use test; +drop database mysqltest_LC2; +create database mysqltest_LC2; +use mysqltest_LC2; +create table myUC (i int); +select * from myUC; +i +use test; +drop database mysqltest_LC2; diff --git a/mysql-test/r/lowercase_table_grant.result b/mysql-test/r/lowercase_table_grant.result new file mode 100644 index 00000000000..3889bd418db --- /dev/null +++ b/mysql-test/r/lowercase_table_grant.result @@ -0,0 +1,23 @@ +use mysql; +create database MYSQLtest; +grant all on MySQLtest.* to mysqltest_1@localhost; +show grants for mysqltest_1@localhost; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' +select * from db where user = 'mysqltest_1'; +Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv +localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y +update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost'; +flush privileges; +show grants for mysqltest_1@localhost; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' +select * from db where user = 'mysqltest_1'; +Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv +localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y +delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost'; +flush privileges; +drop user mysqltest_1@localhost; +drop database MYSQLtest; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 70ac33964ad..1a3b2ab22e6 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2400,3 +2400,25 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 1 SIMPLE t2 ref a a 23 test.t1.a 2 DROP TABLE t1, t2; +CREATE TABLE t1 ( city char(30) ); +INSERT INTO t1 VALUES ('London'); +INSERT INTO t1 VALUES ('Paris'); +SELECT * FROM t1 WHERE city='London'; +city +London +SELECT * FROM t1 WHERE city='london'; +city +London +EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT * FROM t1 WHERE city='London' AND city='london'; +city +London +EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; +city +London +DROP TABLE t1; diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result new file mode 100644 index 00000000000..d8d873699a5 --- /dev/null +++ b/mysql-test/r/skip_name_resolve.result @@ -0,0 +1,7 @@ +GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255'; +SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255'; +Grants for mysqltest_1@127.0.0.1/255.255.255.255 +GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255' +GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255' +REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255'; +DROP USER mysqltest_1@'127.0.0.1/255.255.255.255'; diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index ebb24159373..141878a7bf6 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -21,18 +21,18 @@ db CREATE TABLE `db` ( `Host` char(60) collate utf8_bin NOT NULL default '', `Db` char(64) collate utf8_bin NOT NULL default '', `User` char(16) collate utf8_bin NOT NULL default '', - `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N', PRIMARY KEY (`Host`,`Db`,`User`), KEY `User` (`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges' @@ -41,18 +41,18 @@ Table Create Table host CREATE TABLE `host` ( `Host` char(60) collate utf8_bin NOT NULL default '', `Db` char(64) collate utf8_bin NOT NULL default '', - `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', + `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N', PRIMARY KEY (`Host`,`Db`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges' show create table user; @@ -61,28 +61,28 @@ user CREATE TABLE `user` ( `Host` varchar(60) collate utf8_bin NOT NULL default '', `User` varchar(16) collate utf8_bin NOT NULL default '', `Password` varchar(41) collate utf8_bin NOT NULL default '', - `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Reload_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Shutdown_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Process_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `File_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Show_db_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Super_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Execute_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Repl_slave_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `Repl_client_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') collate utf8_bin NOT NULL default '', + `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Reload_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Shutdown_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Process_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `File_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Show_db_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Super_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Repl_slave_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `Repl_client_priv` enum('N','Y') character set utf8 NOT NULL default 'N', + `ssl_type` enum('','ANY','X509','SPECIFIED') character set utf8 NOT NULL default '', `ssl_cipher` blob NOT NULL, `x509_issuer` blob NOT NULL, `x509_subject` blob NOT NULL, @@ -97,7 +97,7 @@ func CREATE TABLE `func` ( `name` char(64) collate utf8_bin NOT NULL default '', `ret` tinyint(1) NOT NULL default '0', `dl` char(128) collate utf8_bin NOT NULL default '', - `type` enum('function','aggregate') collate utf8_bin NOT NULL default 'function', + `type` enum('function','aggregate') character set utf8 NOT NULL default 'function', PRIMARY KEY (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions' show create table tables_priv; @@ -109,8 +109,8 @@ tables_priv CREATE TABLE `tables_priv` ( `Table_name` char(64) collate utf8_bin NOT NULL default '', `Grantor` char(77) collate utf8_bin NOT NULL default '', `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') collate utf8_bin NOT NULL default '', - `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '', + `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') character set utf8 NOT NULL default '', + `Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges' @@ -123,7 +123,7 @@ columns_priv CREATE TABLE `columns_priv` ( `Table_name` char(64) collate utf8_bin NOT NULL default '', `Column_name` char(64) collate utf8_bin NOT NULL default '', `Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, - `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '', + `Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' show tables; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 6b700f7f6a2..633f7c139fd 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -482,3 +482,8 @@ SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8; SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE'; Variable_name Value myisam_data_pointer_size 8 +SET GLOBAL table_cache=-1; +SHOW VARIABLES LIKE 'table_cache'; +Variable_name Value +table_cache 1 +SET GLOBAL table_cache=DEFAULT; diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index ce4fdc4e3c9..512ae88a445 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -116,3 +116,19 @@ SELECT FIELD('ue',s1), FIELD('Ü',s1), s1='ue', s1='Ü' FROM t1; DROP TABLE t1; -- source include/ctype_filesort.inc + +# +# Bug#7878 with utf8_general_ci, equals (=) has problem with +# accent insensitivity. +# Although originally this problem was found with UTF8 character set, +# '=' behaved wrong for latin1_german2_ci as well. +# Let's check it does not work incorrect anymore. +# +SET NAMES latin1; +CREATE TABLE t1 ( + col1 varchar(255) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 collate latin1_german2_ci; +INSERT INTO t1 VALUES ('ß'),('ss'),('ss'); +ALTER TABLE t1 ADD KEY ifword(col1); +SELECT * FROM t1 WHERE col1='ß' ORDER BY col1, BINARY col1; +DROP TABLE t1; diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test index 58ca3c6a997..50d286f28b9 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -68,3 +68,10 @@ SET collation_connection='sjis_japanese_ci'; -- source include/ctype_filesort.inc SET collation_connection='sjis_bin'; -- source include/ctype_filesort.inc + +# Check parsing of string literals in SJIS with multibyte characters that +# have an embedded \ in them. (Bug #8303) + +--character_set sjis +SET NAMES sjis; +SELECT HEX('²“‘@\Œ\') FROM DUAL; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 50d01da080f..4809f6f0357 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -310,6 +310,14 @@ select count(*) from t1; drop table t1; # +# testing out of bounds memory access in ft_nlq_find_relevance() +# (bug#8522); visible in valgrind. +# +CREATE TABLE t1 ( a TEXT, FULLTEXT (a) ); +INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance'); +SELECT MATCH(a) AGAINST ('nosuchword') FROM t1; +DROP TABLE t1; +# # bug#6784 # mi_flush_bulk_insert (on dup key error in mi_write) # was mangling info->dupp_key_pos diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test index 234deab91e6..b01f0d18b76 100644 --- a/mysql-test/t/fulltext_cache.test +++ b/mysql-test/t/fulltext_cache.test @@ -29,13 +29,13 @@ INSERT INTO t2 VALUES (6,2,'um chocolate Snickers'); INSERT INTO t2 VALUES (7,1,'Bife'); INSERT INTO t2 VALUES (8,1,'Pizza de Salmao'); -SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8) +SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; -SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8) +SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6) as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id; SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE) diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 182baa641da..188de8a5379 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -68,14 +68,15 @@ INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4; SELECT * FROM t1; TRUNCATE TABLE t1; INSERT t1 VALUES (1,2,10), (3,4,20); -CREATE TABLE t2 (x INT, y INT, z INT, d INT); +CREATE TABLE t2 (a INT, b INT, c INT, d INT); +# column names deliberately clash with columns in t1 (Bug#8147) INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1); INSERT t2 VALUES (2,1,11,2), (7,4,40,2); -INSERT t1 SELECT x,y,z FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100; +INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100; SELECT * FROM t1; INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0; SELECT * FROM t1; -INSERT t1 SELECT x,y,z FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); +INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a); SELECT *, VALUES(a) FROM t1; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test index a766e39abab..eff5f2a99ec 100644 --- a/mysql-test/t/lowercase_table2.test +++ b/mysql-test/t/lowercase_table2.test @@ -111,3 +111,20 @@ select * from T1; alter table T1 add index (a); select * from T1; drop table T1; + +# +# Bug #8355: Tables not dropped from table cache on drop db +# +create database mysqltest_LC2; +use mysqltest_LC2; +create table myUC (i int); +insert into myUC values (1),(2),(3); +select * from myUC; +use test; +drop database mysqltest_LC2; +create database mysqltest_LC2; +use mysqltest_LC2; +create table myUC (i int); +select * from myUC; +use test; +drop database mysqltest_LC2; diff --git a/mysql-test/t/lowercase_table_grant-master.opt b/mysql-test/t/lowercase_table_grant-master.opt new file mode 100644 index 00000000000..c718e2feb1b --- /dev/null +++ b/mysql-test/t/lowercase_table_grant-master.opt @@ -0,0 +1 @@ +--lower_case_table_names diff --git a/mysql-test/t/lowercase_table_grant.test b/mysql-test/t/lowercase_table_grant.test new file mode 100644 index 00000000000..5ac35c81c21 --- /dev/null +++ b/mysql-test/t/lowercase_table_grant.test @@ -0,0 +1,25 @@ +# Test of grants when lower_case_table_names is on +use mysql; + +# mixed-case database name for testing +create database MYSQLtest; + +# check that database name gets forced to lowercase +grant all on MySQLtest.* to mysqltest_1@localhost; +show grants for mysqltest_1@localhost; + +# now force it to mixed case, but see that it is lowercased in the acl cache +select * from db where user = 'mysqltest_1'; +update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost'; +flush privileges; +show grants for mysqltest_1@localhost; +select * from db where user = 'mysqltest_1'; + +# clear out the user we created +# +# can't use REVOKE because of the mixed-case database name +delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost'; +flush privileges; +drop user mysqltest_1@localhost; + +drop database MYSQLtest; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 5450512b959..4ab81dfcac5 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -599,6 +599,7 @@ drop table t2; prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ; create table t5 (a int) ; # rename must fail, t7 does not exist +--replace_result \\ / --error 1017 execute stmt1 ; create table t7 (a int) ; diff --git a/mysql-test/t/rpl_delete_all.test b/mysql-test/t/rpl_delete_all.test index 23848720107..ad2ce29c610 100644 --- a/mysql-test/t/rpl_delete_all.test +++ b/mysql-test/t/rpl_delete_all.test @@ -6,7 +6,7 @@ connection master; drop database if exists mysqltest; sync_slave_with_master; # can't read dir ---replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" +--replace_result "Errcode: 1" "Errcode: X" "Errcode: 2" "Errcode: X" \\ / --error 12 show tables from mysqltest; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index c00395d95e7..53f569c773e 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1945,3 +1945,22 @@ EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a; EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; DROP TABLE t1, t2; + + +# +# Test case for bug 7098: substitution of a constant for a string field +# + +CREATE TABLE t1 ( city char(30) ); +INSERT INTO t1 VALUES ('London'); +INSERT INTO t1 VALUES ('Paris'); + +SELECT * FROM t1 WHERE city='London'; +SELECT * FROM t1 WHERE city='london'; +EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london'; +SELECT * FROM t1 WHERE city='London' AND city='london'; +EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; +SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London'; + +DROP TABLE t1; + diff --git a/mysql-test/t/skip_name_resolve-master.opt b/mysql-test/t/skip_name_resolve-master.opt new file mode 100644 index 00000000000..ab6ca1731f5 --- /dev/null +++ b/mysql-test/t/skip_name_resolve-master.opt @@ -0,0 +1 @@ +--skip-name-resolve diff --git a/mysql-test/t/skip_name_resolve.test b/mysql-test/t/skip_name_resolve.test new file mode 100644 index 00000000000..68dcf329427 --- /dev/null +++ b/mysql-test/t/skip_name_resolve.test @@ -0,0 +1,5 @@ +# Bug #8471: IP address with mask fail when skip-name-resolve is on +GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255'; +SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255'; +REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255'; +DROP USER mysqltest_1@'127.0.0.1/255.255.255.255'; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 3a76ae5136e..f80ca6378a1 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -362,3 +362,11 @@ drop table t1; SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8; SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE'; + +# +# Bug #6958: negative arguments to integer options wrap around +# + +SET GLOBAL table_cache=-1; +SHOW VARIABLES LIKE 'table_cache'; +SET GLOBAL table_cache=DEFAULT; diff --git a/mysys/charset-def.c b/mysys/charset-def.c index 3dcd2a2d116..3278566788c 100644 --- a/mysys/charset-def.c +++ b/mysys/charset-def.c @@ -22,6 +22,8 @@ init_compiled_charsets() that only adds those that he wants */ +#ifdef HAVE_UCA_COLLATIONS + #ifdef HAVE_CHARSET_ucs2 extern CHARSET_INFO my_charset_ucs2_general_uca; extern CHARSET_INFO my_charset_ucs2_icelandic_uca_ci; @@ -62,6 +64,8 @@ extern CHARSET_INFO my_charset_utf8_roman_uca_ci; extern CHARSET_INFO my_charset_utf8_persian_uca_ci; #endif +#endif /* HAVE_UCA_COLLATIONS */ + my_bool init_compiled_charsets(myf flags __attribute__((unused))) { CHARSET_INFO *cs; @@ -113,6 +117,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_ucs2 add_compiled_collation(&my_charset_ucs2_general_ci); add_compiled_collation(&my_charset_ucs2_bin); +#ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_ucs2_general_uca); add_compiled_collation(&my_charset_ucs2_icelandic_uca_ci); add_compiled_collation(&my_charset_ucs2_latvian_uca_ci); @@ -131,6 +136,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_ucs2_roman_uca_ci); add_compiled_collation(&my_charset_ucs2_persian_uca_ci); #endif +#endif #ifdef HAVE_CHARSET_ujis add_compiled_collation(&my_charset_ujis_japanese_ci); @@ -140,6 +146,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) #ifdef HAVE_CHARSET_utf8 add_compiled_collation(&my_charset_utf8_general_ci); add_compiled_collation(&my_charset_utf8_bin); +#ifdef HAVE_UCA_COLLATIONS add_compiled_collation(&my_charset_utf8_general_uca_ci); add_compiled_collation(&my_charset_utf8_icelandic_uca_ci); add_compiled_collation(&my_charset_utf8_latvian_uca_ci); @@ -158,6 +165,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused))) add_compiled_collation(&my_charset_utf8_roman_uca_ci); add_compiled_collation(&my_charset_utf8_persian_uca_ci); #endif +#endif /* Copy compiled charsets */ for (cs=compiled_charsets; cs->name; cs++) diff --git a/mysys/charset.c b/mysys/charset.c index cb2379f8723..bb8f2d178b9 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -215,7 +215,7 @@ static int add_collation(CHARSET_INFO *cs) if (!strcmp(cs->csname,"ucs2") ) { -#ifdef HAVE_CHARSET_ucs2 +#if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS) new->cset= my_charset_ucs2_general_uca.cset; new->coll= my_charset_ucs2_general_uca.coll; new->strxfrm_multiply= my_charset_ucs2_general_uca.strxfrm_multiply; @@ -581,6 +581,23 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, from--; continue; } + /* + If the next character appears to begin a multi-byte character, we + escape that first byte of that apparent multi-byte character. (The + character just looks like a multi-byte character -- if it were actually + a multi-byte character, it would have been passed through in the test + above.) + + Without this check, we can create a problem by converting an invalid + multi-byte character into a valid one. For example, 0xbf27 is not + a valid GBK character, but 0xbf5c is. (0x27 = ', 0x5c = \) + */ + if (use_mb_flag && (l= my_mbcharlen(charset_info, *from)) > 1) + { + *to++= '\\'; + *to++= *from; + continue; + } #endif switch (*from) { case 0: /* Must be escaped for 'mysql' */ diff --git a/ndb/include/mgmapi/mgmapi.h b/ndb/include/mgmapi/mgmapi.h index 3d4a34d6488..fa0774afa06 100644 --- a/ndb/include/mgmapi/mgmapi.h +++ b/ndb/include/mgmapi/mgmapi.h @@ -376,6 +376,7 @@ extern "C" { int ndb_mgm_set_connectstring(NdbMgmHandle handle, const char *connect_string); + int ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid); int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle); int ndb_mgm_get_connected_port(NdbMgmHandle handle); const char *ndb_mgm_get_connected_host(NdbMgmHandle handle); diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp index 8461658748e..be6d656e1a5 100644 --- a/ndb/include/mgmcommon/ConfigRetriever.hpp +++ b/ndb/include/mgmcommon/ConfigRetriever.hpp @@ -55,6 +55,8 @@ public: */ Uint32 allocNodeId(int no_retries, int retry_delay_in_seconds); + int setNodeId(Uint32 nodeid); + /** * Get config using socket */ diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index db00cc1510f..fd04ad393eb 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -316,6 +316,12 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 return true; } +int +ConfigRetriever::setNodeId(Uint32 nodeid) +{ + return ndb_mgm_set_configuration_nodeid(m_handle, nodeid); +} + Uint32 ConfigRetriever::allocNodeId(int no_retries, int retry_delay_in_seconds) { diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index f35a5859ff8..de78a4e927c 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -141,6 +141,8 @@ Configuration::init(int argc, char** argv) else _programName = strdup(""); + globalData.ownId= 0; + return true; } @@ -215,6 +217,13 @@ Configuration::fetch_configuration(){ ConfigRetriever &cr= *m_config_retriever; + /** + * if we have a nodeid set (e.g in a restart situation) + * reuse it + */ + if (globalData.ownId) + cr.setNodeId(globalData.ownId); + globalData.ownId = cr.allocNodeId(2 /*retry*/,3 /*delay*/); if(globalData.ownId == 0){ diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp index 5a95c6e9ac1..68106c4689d 100644 --- a/ndb/src/mgmapi/mgmapi.cpp +++ b/ndb/src/mgmapi/mgmapi.cpp @@ -1722,6 +1722,15 @@ ndb_mgm_destroy_configuration(struct ndb_mgm_configuration *cfg) extern "C" int +ndb_mgm_set_configuration_nodeid(NdbMgmHandle handle, int nodeid) +{ + CHECK_HANDLE(handle, -1); + handle->cfg._ownNodeId= nodeid; + return 0; +} + +extern "C" +int ndb_mgm_get_configuration_nodeid(NdbMgmHandle handle) { CHECK_HANDLE(handle, 0); diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index 025bed2bc09..c3b0ee7fe97 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -1069,16 +1069,19 @@ print_nodes(ndb_mgm_cluster_state *state, ndb_mgm_configuration_iterator *it, } ndbout << ")" << endl; } else { - if(ndb_mgm_find(it, CFG_NODE_ID, node_id) != 0){ + ndb_mgm_first(it); + if(ndb_mgm_find(it, CFG_NODE_ID, node_id) == 0){ + const char *config_hostname= 0; + ndb_mgm_get_string_parameter(it, CFG_NODE_HOST, &config_hostname); + if (config_hostname == 0 || config_hostname[0] == 0) + config_hostname= "any host"; + ndbout_c(" (not connected, accepting connect from %s)", + config_hostname); + } + else + { ndbout_c("Unable to find node with id: %d", node_id); - return; } - const char *config_hostname= 0; - ndb_mgm_get_string_parameter(it, CFG_NODE_HOST, &config_hostname); - if (config_hostname == 0 || config_hostname[0] == 0) - config_hostname= "any host"; - ndbout << " (not connected, accepting connect from " - << config_hostname << ")" << endl; } } } diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh index 83fdc0639ce..993efcb0fda 100644 --- a/scripts/mysql_create_system_tables.sh +++ b/scripts/mysql_create_system_tables.sh @@ -54,18 +54,18 @@ then c_d="$c_d Host char(60) binary DEFAULT '' NOT NULL," c_d="$c_d Db char(64) binary DEFAULT '' NOT NULL," c_d="$c_d User char(16) binary DEFAULT '' NOT NULL," - c_d="$c_d Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_d="$c_d Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_d="$c_d Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_d="$c_d Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," c_d="$c_d PRIMARY KEY Host (Host,Db,User)," c_d="$c_d KEY User (User)" c_d="$c_d ) engine=MyISAM" @@ -85,18 +85,18 @@ then c_h="$c_h CREATE TABLE host (" c_h="$c_h Host char(60) binary DEFAULT '' NOT NULL," c_h="$c_h Db char(64) binary DEFAULT '' NOT NULL," - c_h="$c_h Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_h="$c_h Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," + c_h="$c_h Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_h="$c_h Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," c_h="$c_h PRIMARY KEY Host (Host,Db)" c_h="$c_h ) engine=MyISAM" c_h="$c_h CHARACTER SET utf8 COLLATE utf8_bin" @@ -113,28 +113,28 @@ then c_u="$c_u Host char(60) binary DEFAULT '' NOT NULL," c_u="$c_u User char(16) binary DEFAULT '' NOT NULL," c_u="$c_u Password char(41) binary DEFAULT '' NOT NULL," - c_u="$c_u Select_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Insert_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Update_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Delete_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Create_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Drop_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Reload_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Shutdown_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Process_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u File_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Grant_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u References_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Index_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Alter_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Super_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL," - c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') DEFAULT '' NOT NULL," + c_u="$c_u Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," + c_u="$c_u ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL," c_u="$c_u ssl_cipher BLOB NOT NULL," c_u="$c_u x509_issuer BLOB NOT NULL," c_u="$c_u x509_subject BLOB NOT NULL," @@ -178,7 +178,7 @@ then c_f="$c_f name char(64) binary DEFAULT '' NOT NULL," c_f="$c_f ret tinyint(1) DEFAULT '0' NOT NULL," c_f="$c_f dl char(128) DEFAULT '' NOT NULL," - c_f="$c_f type enum ('function','aggregate') NOT NULL," + c_f="$c_f type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL," c_f="$c_f PRIMARY KEY (name)" c_f="$c_f ) engine=MyISAM" c_f="$c_f CHARACTER SET utf8 COLLATE utf8_bin" @@ -198,8 +198,8 @@ then c_t="$c_t Table_name char(64) binary DEFAULT '' NOT NULL," c_t="$c_t Grantor char(77) DEFAULT '' NOT NULL," c_t="$c_t Timestamp timestamp(14)," - c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL," - c_t="$c_t Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL," + c_t="$c_t Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL," + c_t="$c_t Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL," c_t="$c_t PRIMARY KEY (Host,Db,User,Table_name)," c_t="$c_t KEY Grantor (Grantor)" c_t="$c_t ) engine=MyISAM" @@ -220,7 +220,7 @@ then c_c="$c_c Table_name char(64) binary DEFAULT '' NOT NULL," c_c="$c_c Column_name char(64) binary DEFAULT '' NOT NULL," c_c="$c_c Timestamp timestamp(14)," - c_c="$c_c Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL," + c_c="$c_c Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL," c_c="$c_c PRIMARY KEY (Host,Db,User,Table_name,Column_name)" c_c="$c_c ) engine=MyISAM" c_c="$c_c CHARACTER SET utf8 COLLATE utf8_bin" @@ -328,7 +328,7 @@ then c_tz="$c_tz CREATE TABLE time_zone (" c_tz="$c_tz Time_zone_id int unsigned NOT NULL auto_increment," - c_tz="$c_tz Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL," + c_tz="$c_tz Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL," c_tz="$c_tz PRIMARY KEY TzId (Time_zone_id)" c_tz="$c_tz ) engine=MyISAM CHARACTER SET utf8" c_tz="$c_tz comment='Time zones';" diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql index 536b263f7bd..8f398689bd9 100644 --- a/scripts/mysql_fix_privilege_tables.sql +++ b/scripts/mysql_fix_privilege_tables.sql @@ -9,54 +9,23 @@ -- this sql script. -- On windows you should do 'mysql --force mysql < mysql_fix_privilege_tables.sql' --- Convert all tables to UTF-8 with binary collation --- and reset all char columns to correct width -ALTER TABLE user - MODIFY Host char(60) NOT NULL default '', - MODIFY User char(16) NOT NULL default '', - MODIFY Password char(41) NOT NULL default '', - ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; -ALTER TABLE db - MODIFY Host char(60) NOT NULL default '', - MODIFY Db char(64) NOT NULL default '', - MODIFY User char(16) NOT NULL default '', - ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; -ALTER TABLE host - MODIFY Host char(60) NOT NULL default '', - MODIFY Db char(64) NOT NULL default '', - ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; -ALTER TABLE func - ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; -ALTER TABLE columns_priv - MODIFY Host char(60) NOT NULL default '', - MODIFY Db char(64) NOT NULL default '', - MODIFY User char(16) NOT NULL default '', - MODIFY Table_name char(64) NOT NULL default '', - MODIFY Column_name char(64) NOT NULL default '', - ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; -ALTER TABLE tables_priv - MODIFY Host char(60) NOT NULL default '', - MODIFY Db char(64) NOT NULL default '', - MODIFY User char(16) NOT NULL default '', - MODIFY Table_name char(64) NOT NULL default '', - MODIFY Grantor char(77) NOT NULL default '', - ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; -ALTER TABLE user add File_priv enum('N','Y') NOT NULL; CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, - type enum ('function','aggregate') NOT NULL, + type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL; + -- Detect whether or not we had the Grant_priv column SET @hadGrantPriv:=0; SELECT @hadGrantPriv:=1 FROM user WHERE Grant_priv LIKE '%'; -ALTER TABLE user add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL; -ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL; -ALTER TABLE db add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') NOT NULL,add Index_priv enum('N','Y') NOT NULL,add Alter_priv enum('N','Y') NOT NULL; +ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL; +ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL; +ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL; --- Fix privileges for old tables UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0; @@ -68,7 +37,7 @@ UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Cr -- Adding columns needed by GRANT .. REQUIRE (openssl)" ALTER TABLE user -ADD ssl_type enum('','ANY','X509', 'SPECIFIED') NOT NULL, +ADD ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci NOT NULL, ADD ssl_cipher BLOB NOT NULL, ADD x509_issuer BLOB NOT NULL, ADD x509_subject BLOB NOT NULL; @@ -85,10 +54,14 @@ CREATE TABLE IF NOT EXISTS tables_priv ( Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp(14), - Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') DEFAULT '' NOT NULL, - Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, + Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, + Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name) ) CHARACTER SET utf8 COLLATE utf8_bin; +-- Fix collation of set fields +ALTER TABLE tables_priv + modify Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, + modify Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL; CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) DEFAULT '' NOT NULL, @@ -97,22 +70,25 @@ CREATE TABLE IF NOT EXISTS columns_priv ( Table_name char(60) DEFAULT '' NOT NULL, Column_name char(59) DEFAULT '' NOT NULL, Timestamp timestamp(14), - Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL, + Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) CHARACTER SET utf8 COLLATE utf8_bin; +-- Fix collation of set fields +ALTER TABLE columns_priv + MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL; -- -- Name change of Type -> Column_priv from MySQL 3.22.12 -- -ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') DEFAULT '' NOT NULL; +ALTER TABLE columns_priv change Type Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL; -- -- Add the new 'type' column to the func table. -- -ALTER TABLE func add type enum ('function','aggregate') NOT NULL; +ALTER TABLE func add type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL; -- -- Change the user,db and host tables to MySQL 4.0 format @@ -123,13 +99,13 @@ SET @hadShowDbPriv:=0; SELECT @hadShowDbPriv:=1 FROM user WHERE Show_db_priv LIKE '%'; ALTER TABLE user -ADD Show_db_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Alter_priv, -ADD Super_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Show_db_priv, -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Super_priv, -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv, -ADD Execute_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, -ADD Repl_slave_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Execute_priv, -ADD Repl_client_priv enum('N','Y') DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; +ADD Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Alter_priv, +ADD Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Show_db_priv, +ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Super_priv, +ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Create_tmp_table_priv, +ADD Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Lock_tables_priv, +ADD Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Execute_priv, +ADD Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Repl_slave_priv; -- Convert privileges so that users have similar privileges as before @@ -150,11 +126,11 @@ ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; -- ALTER TABLE db -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; +ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, +ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; ALTER TABLE host -ADD Create_tmp_table_priv enum('N','Y') DEFAULT 'N' NOT NULL, -ADD Lock_tables_priv enum('N','Y') DEFAULT 'N' NOT NULL; +ADD Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, +ADD Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; alter table db change Db Db char(64) binary DEFAULT '' NOT NULL; alter table host change Db Db char(64) binary DEFAULT '' NOT NULL; @@ -170,6 +146,95 @@ alter table func comment='User defined functions'; alter table tables_priv comment='Table privileges'; alter table columns_priv comment='Column privileges'; +-- Convert all tables to UTF-8 with binary collation +-- and reset all char columns to correct width +ALTER TABLE user + MODIFY Host char(60) NOT NULL default '', + MODIFY User char(16) NOT NULL default '', + MODIFY Password char(41) NOT NULL default '', + ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE user + MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL; +ALTER TABLE db + MODIFY Host char(60) NOT NULL default '', + MODIFY Db char(64) NOT NULL default '', + MODIFY User char(16) NOT NULL default '', + ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE db + MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; +ALTER TABLE host + MODIFY Host char(60) NOT NULL default '', + MODIFY Db char(64) NOT NULL default '', + ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE host + MODIFY Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + MODIFY Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; +ALTER TABLE func + ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE func + MODIFY type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL; +ALTER TABLE columns_priv + MODIFY Host char(60) NOT NULL default '', + MODIFY Db char(64) NOT NULL default '', + MODIFY User char(16) NOT NULL default '', + MODIFY Table_name char(64) NOT NULL default '', + MODIFY Column_name char(64) NOT NULL default '', + ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE columns_priv + MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL; +ALTER TABLE tables_priv + MODIFY Host char(60) NOT NULL default '', + MODIFY Db char(64) NOT NULL default '', + MODIFY User char(16) NOT NULL default '', + MODIFY Table_name char(64) NOT NULL default '', + MODIFY Grantor char(77) NOT NULL default '', + ENGINE=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; +ALTER TABLE tables_priv + MODIFY Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, + MODIFY Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL; + # # Create some possible missing tables # @@ -217,9 +282,12 @@ PRIMARY KEY Name (Name) CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, -Use_leap_seconds enum('Y','N') DEFAULT 'N' NOT NULL, +Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) CHARACTER SET utf8 comment='Time zones'; +-- Make enum field case-insensitive +ALTER TABLE time_zone + MODIFY Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL; CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, diff --git a/sql/item.h b/sql/item.h index db5010799fa..dd06d4ce61a 100644 --- a/sql/item.h +++ b/sql/item.h @@ -742,7 +742,7 @@ public: Item *new_item() { return new Item_string(name, str_value.ptr(), - str_value.length(), &my_charset_bin); + str_value.length(), collation.collation); } Item *safe_charset_converter(CHARSET_INFO *tocs); String *const_string() { return &str_value; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 6218bc49f53..f851e36dcad 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -750,7 +750,7 @@ bool close_temporary_table(THD *thd, const char *db, const char *table_name); void close_temporary(TABLE *table, bool delete_table=1); bool rename_temporary_table(THD* thd, TABLE *table, const char *new_db, const char *table_name); -void remove_db_from_cache(const my_string db); +void remove_db_from_cache(const char *db); void flush_tables(); bool remove_table_from_cache(THD *thd, const char *db, const char *table, bool return_if_owned_by_thd=0); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 53dca59bc92..3a0e02a3d74 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -298,12 +298,14 @@ my_bool lower_case_file_system= 0; my_bool opt_innodb_safe_binlog= 0; volatile bool mqh_used = 0; +#ifdef HAVE_INITGROUPS +static bool calling_initgroups= FALSE; /* Used in SIGSEGV handler. */ +#endif uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options; uint delay_key_write_options, protocol_version; uint lower_case_table_names; uint opt_crash_binlog_innodb; uint volatile thread_count, thread_running, kill_cached_threads, wake_thread; - ulong back_log, connect_timeout, concurrency; ulong server_id, thd_startup_options; ulong table_cache_size, thread_stack, thread_stack_min, what_to_log; @@ -950,6 +952,7 @@ void clean_up(bool print_message) item_user_lock_free(); lex_free(); /* Free some memory */ set_var_free(); + free_charsets(); #ifdef HAVE_DLOPEN if (!opt_noacl) udf_free(); @@ -1142,7 +1145,15 @@ static void set_user(const char *user, struct passwd *user_info) #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) DBUG_ASSERT(user_info); #ifdef HAVE_INITGROUPS - initgroups((char*) user,user_info->pw_gid); + /* + We can get a SIGSEGV when calling initgroups() on some systems when NSS + is configured to use LDAP and the server is statically linked. We set + calling_initgroups as a flag to the SIGSEGV handler that is then used to + output a specific message to help the user resolve this problem. + */ + calling_initgroups= TRUE; + initgroups((char*) user, user_info->pw_gid); + calling_initgroups= FALSE; #endif if (setgid(user_info->pw_gid) == -1) { @@ -1896,6 +1907,17 @@ information that should help you find out what is causing the crash.\n"); fflush(stderr); #endif /* HAVE_STACKTRACE */ +#ifdef HAVE_INITGROUPS + if (calling_initgroups) + fprintf(stderr, "\n\ +This crash occured while the server was calling initgroups(). This is\n\ +often due to the use of a mysqld that is statically linked against glibc\n\ +and configured to use LDAP in /etc/nsswitch.conf. You will need to either\n\ +upgrade to a version of glibc that does not have this problem (2.3.4 or\n\ +later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\ +mysqld that is not statically linked.\n"); +#endif + if (test_flags & TEST_CORE_ON_SIGNAL) { fprintf(stderr, "Writing a core file\n"); diff --git a/sql/set_var.cc b/sql/set_var.cc index ca7987d2636..7f393363ed6 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1223,6 +1223,12 @@ static void fix_server_id(THD *thd, enum_var_type type) server_id_supplied = 1; } +bool sys_var_long_ptr::check(THD *thd, set_var *var) +{ + longlong v= var->value->val_int(); + var->save_result.ulonglong_value= v < 0 ? 0 : v; + return 0; +} bool sys_var_long_ptr::update(THD *thd, set_var *var) { diff --git a/sql/set_var.h b/sql/set_var.h index df2fd41c7bd..080a2a95ae0 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -93,6 +93,7 @@ public: sys_var_long_ptr(const char *name_arg, ulong *value_ptr, sys_after_update_func func) :sys_var(name_arg,func), value(value_ptr) {} + bool check(THD *thd, set_var *var); bool update(THD *thd, set_var *var); void set_default(THD *thd, enum_var_type type); SHOW_TYPE type() { return SHOW_LONG; } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 7c17a4ef275..f6b304406d5 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -139,6 +139,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) MYSQL_LOCK *lock; my_bool return_val=1; bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE; + char tmp_name[NAME_LEN+1]; DBUG_ENTER("acl_init"); @@ -197,6 +198,24 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) ACL_HOST host; update_hostname(&host.host,get_field(&mem, table->field[0])); host.db= get_field(&mem, table->field[1]); + if (lower_case_table_names) + { + /* + We make a temporary copy of the database, force it to lower case, + and then copy it back over the original name. We can't just update + the host.db pointer, because tmp_name is allocated on the stack. + */ + (void)strmov(tmp_name, host.db); + my_casedn_str(files_charset_info, tmp_name); + if (strcmp(host.db, tmp_name) != 0) + { + sql_print_warning("'host' entry '%s|%s' had database in mixed " + "case that has been forced to lowercase because " + "lower_case_table_names is set.", + host.host.hostname, host.db); + (void)strmov(host.db, tmp_name); + } + } host.access= get_access(table,2); host.access= fix_rights_for_db(host.access); host.sort= get_sort(2,host.host.hostname,host.db); @@ -380,6 +399,24 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) } db.access=get_access(table,3); db.access=fix_rights_for_db(db.access); + if (lower_case_table_names) + { + /* + We make a temporary copy of the database, force it to lower case, + and then copy it back over the original name. We can't just update + the db.db pointer, because tmp_name is allocated on the stack. + */ + (void)strmov(tmp_name, db.db); + my_casedn_str(files_charset_info, tmp_name); + if (strcmp(db.db, tmp_name) != 0) + { + sql_print_warning("'db' entry '%s %s@%s' had database in mixed " + "case that has been forced to lowercase because " + "lower_case_table_names is set.", + db.db, db.user, db.host.hostname, db.host.hostname); + (void)strmov(db.db, tmp_name); + } + } db.sort=get_sort(3,db.host.hostname,db.db,db.user); #ifndef TO_BE_REMOVED if (table->fields <= 9) @@ -1339,7 +1376,7 @@ bool hostname_requires_resolving(const char *hostname) return FALSE; for (; (cur=*hostname); hostname++) { - if ((cur != '%') && (cur != '_') && (cur != '.') && + if ((cur != '%') && (cur != '_') && (cur != '.') && (cur != '/') && ((cur < '0') || (cur > '9'))) return TRUE; } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 7434897ab90..8d694c48849 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2868,8 +2868,18 @@ static void mysql_rm_tmp_tables(void) ** and afterwards delete those marked unused. */ -void remove_db_from_cache(const my_string db) +void remove_db_from_cache(const char *db) { + char name_buff[NAME_LEN+1]; + if (db && lower_case_table_names) + { + /* + convert database to lower case for comparision. + */ + strmake(name_buff, db, sizeof(name_buff)-1); + my_casedn_str(files_charset_info, name_buff); + db= name_buff; + } for (uint idx=0 ; idx < open_cache.records ; idx++) { TABLE *table=(TABLE*) hash_element(&open_cache,idx); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ed974a48ad3..d6dcd9ce9ae 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -295,7 +295,18 @@ static char *get_text(LEX *lex) found_escape=1; if (lex->ptr == lex->end_of_query) return 0; - yySkip(); +#ifdef USE_MB + int l; + if (use_mb(cs) && + (l = my_ismbchar(cs, + (const char *)lex->ptr, + (const char *)lex->end_of_query))) { + lex->ptr += l; + continue; + } + else +#endif + yySkip(); } else if (c == sep) { @@ -323,6 +334,10 @@ static char *get_text(LEX *lex) else { uchar *to; + + /* Re-use found_escape for tracking state of escapes */ + found_escape= 0; + for (to=start ; str != end ; str++) { #ifdef USE_MB @@ -336,7 +351,7 @@ static char *get_text(LEX *lex) continue; } #endif - if (*str == '\\' && str+1 != end) + if (!found_escape && *str == '\\' && str+1 != end) { switch(*++str) { case 'n': @@ -362,15 +377,20 @@ static char *get_text(LEX *lex) *to++= '\\'; // remember prefix for wildcard /* Fall through */ default: - *to++ = *str; + found_escape= 1; + str--; break; } } - else if (*str == sep) - *to++= *str++; // Two ' or " + else if (!found_escape && *str == sep) + { + found_escape= 1; + } else + { *to++ = *str; - + found_escape= 0; + } } *to=0; lex->yytoklen=(uint) (to-start); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 1329a6cd732..84102db19b3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -47,6 +47,7 @@ extern "C" int gethostname(char *name, int namelen); #endif +static void time_out_user_resource_limits(THD *thd, USER_CONN *uc); #ifndef NO_EMBEDDED_ACCESS_CHECKS static int check_for_max_user_connections(THD *thd, USER_CONN *uc); #endif @@ -442,6 +443,7 @@ static int check_for_max_user_connections(THD *thd, USER_CONN *uc) error=1; goto end; } + time_out_user_resource_limits(thd, uc); if (uc->user_resources.connections && uc->user_resources.connections <= uc->conn_per_hour) { @@ -543,36 +545,56 @@ bool is_update_query(enum enum_sql_command command) } /* - Check if maximum queries per hour limit has been reached - returns 0 if OK. + Reset per-hour user resource limits when it has been more than + an hour since they were last checked - In theory we would need a mutex in the USER_CONN structure for this to - be 100 % safe, but as the worst scenario is that we would miss counting - a couple of queries, this isn't critical. -*/ + SYNOPSIS: + time_out_user_resource_limits() + thd Thread handler + uc User connection details + NOTE: + This assumes that the LOCK_user_conn mutex has been acquired, so it is + safe to test and modify members of the USER_CONN structure. +*/ -static bool check_mqh(THD *thd, uint check_command) +static void time_out_user_resource_limits(THD *thd, USER_CONN *uc) { -#ifdef NO_EMBEDDED_ACCESS_CHECKS - return(0); -#else - bool error=0; + bool error= 0; time_t check_time = thd->start_time ? thd->start_time : time(NULL); - USER_CONN *uc=thd->user_connect; - DBUG_ENTER("check_mqh"); - DBUG_ASSERT(uc != 0); + DBUG_ENTER("time_out_user_resource_limits"); /* If more than a hour since last check, reset resource checking */ if (check_time - uc->intime >= 3600) { - (void) pthread_mutex_lock(&LOCK_user_conn); uc->questions=1; uc->updates=0; uc->conn_per_hour=0; uc->intime=check_time; - (void) pthread_mutex_unlock(&LOCK_user_conn); } + + DBUG_VOID_RETURN; +} + + +/* + Check if maximum queries per hour limit has been reached + returns 0 if OK. +*/ + +static bool check_mqh(THD *thd, uint check_command) +{ +#ifndef NO_EMBEDDED_ACCESS_CHECKS + bool error= 0; + time_t check_time = thd->start_time ? thd->start_time : time(NULL); + USER_CONN *uc=thd->user_connect; + DBUG_ENTER("check_mqh"); + DBUG_ASSERT(uc != 0); + + (void) pthread_mutex_lock(&LOCK_user_conn); + + time_out_user_resource_limits(thd, uc); + /* Check that we have not done too many questions / hour */ if (uc->user_resources.questions && uc->questions++ >= uc->user_resources.questions) @@ -595,7 +617,10 @@ static bool check_mqh(THD *thd, uint check_command) } } end: + (void) pthread_mutex_unlock(&LOCK_user_conn); DBUG_RETURN(error); +#else + return (0); #endif /* NO_EMBEDDED_ACCESS_CHECKS */ } @@ -2775,18 +2800,23 @@ unsent_create_error: select_lex->options |= OPTION_BUFFER_RESULT; } - if (!(res= open_and_lock_tables(thd, tables)) && - !(res= mysql_prepare_insert(thd, tables, first_local_table, - tables->table, lex->field_list, 0, + if ((res= open_and_lock_tables(thd, tables))) + break; + + TABLE *table= tables->table; + /* Skip first table, which is the table we are inserting in */ + tables= (TABLE_LIST *) + lex->select_lex.table_list.first= (byte*) first_local_table->next; + first_local_table->next= 0; + + if (!(res= mysql_prepare_insert(thd, tables, first_local_table, + table, lex->field_list, 0, lex->update_list, lex->value_list, lex->duplicates)) && - (result= new select_insert(tables->table, &lex->field_list, + (result= new select_insert(table, &lex->field_list, &lex->update_list, &lex->value_list, lex->duplicates, lex->ignore))) { - TABLE *table= tables->table; - /* Skip first table, which is the table we are inserting in */ - lex->select_lex.table_list.first= (byte*) first_local_table->next; /* insert/replace from SELECT give its SELECT_LEX for SELECT, and item_list belong to SELECT @@ -2794,7 +2824,6 @@ unsent_create_error: lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE; res= handle_select(thd, lex, result); /* revert changes for SP */ - lex->select_lex.table_list.first= (byte*) first_local_table; lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; delete result; table->insert_values= 0; @@ -2803,6 +2832,8 @@ unsent_create_error: } else res= -1; + first_local_table->next= tables; + lex->select_lex.table_list.first= (byte*) first_local_table; break; } case SQLCOM_TRUNCATE: diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 663f2d2be34..6c12381b4bd 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -574,7 +574,10 @@ int mysql_multi_update_lock(THD *thd, else { DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias)); - tl->lock_type= TL_READ; + // If we are using the binary log, we need TL_READ_NO_INSERT to get + // correct order of statements. Otherwise, we use a TL_READ lock to + // improve performance. + tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ; tl->updating= 0; wants= SELECT_ACL; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 988323811ac..9f25e17b6fd 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1111,7 +1111,7 @@ create_select: SELECT_SYM { LEX *lex=Lex; - lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; + lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ; if (lex->sql_command == SQLCOM_INSERT) lex->sql_command= SQLCOM_INSERT_SELECT; else if (lex->sql_command == SQLCOM_REPLACE) diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 452ca263433..7678ee05120 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -36,6 +36,7 @@ #include "m_string.h" #include "m_ctype.h" +#ifdef HAVE_UCA_COLLATIONS #define MY_UCA_NPAGES 256 #define MY_UCA_NCHARS 256 @@ -8990,4 +8991,6 @@ CHARSET_INFO my_charset_utf8_persian_uca_ci= &my_collation_any_uca_handler }; -#endif +#endif /* HAVE_CHARSET_utf8 */ + +#endif /* HAVE_UCA_COLLATIONS */ diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index b06ba462b26..07c8e6a46fb 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -276,7 +276,6 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ --includedir=%{_includedir} \ --mandir=%{_mandir} \ --enable-thread-safe-client \ - --with-comment=\"Official MySQL RPM\" \ --with-readline ; # Add this for more debugging support # --with-debug @@ -333,6 +332,7 @@ BuildMySQL "--enable-shared \ --with-csv-storage-engine \ --with-example-storage-engine \ --with-embedded-server \ + --with-comment=\"MySQL Community Edition - Max (GPL)\" \ --with-server-suffix='-Max'" # Save everything for debug @@ -379,6 +379,7 @@ BuildMySQL "--disable-shared \ --with-client-ldflags='-all-static' \ $USE_OTHER_LIBC_DIR \ %endif + --with-comment=\"MySQL Community Edition - Standard (GPL)\" \ --with-server-suffix='%{server_suffix}' \ --without-embedded-server \ --without-berkeley-db \ @@ -694,7 +695,12 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog -* Monday Feb 7 2005 Tomas Ulin <tomas@mysql.com> +* Mon Feb 14 2005 Lenz Grimmer <lenz@mysql.com> + +* Fixed the compilation comments and moved them into the separate build sections + for Max and Standard + +* Mon Feb 7 2005 Tomas Ulin <tomas@mysql.com> - enabled the "Ndbcluster" storage engine for the max binary - added extra make install in ndb subdir after Max build to get ndb binaries diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 14b3ddbf8b2..3974bacc2eb 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11606,6 +11606,54 @@ static void test_bug7990() /* + Test mysql_real_escape_string() with gbk charset + + The important part is that 0x27 (') is the second-byte in a invalid + two-byte GBK character here. But 0xbf5c is a valid GBK character, so + it needs to be escaped as 0x5cbf27 +*/ +#define TEST_BUG8378_IN "\xef\xbb\xbf\x27\xbf\x10" +#define TEST_BUG8378_OUT "\xef\xbb\x5c\xbf\x5c\x27\x5c\xbf\x10" + +static void test_bug8378() +{ + MYSQL *lmysql; + char out[9]; /* strlen(TEST_BUG8378)*2+1 */ + int len; + + myheader("test_bug8378"); + + if (!opt_silent) + fprintf(stdout, "\n Establishing a test connection ..."); + if (!(lmysql= mysql_init(NULL))) + { + myerror("mysql_init() failed"); + exit(1); + } + if (mysql_options(lmysql, MYSQL_SET_CHARSET_NAME, "gbk")) + { + myerror("mysql_options() failed"); + exit(1); + } + if (!(mysql_real_connect(lmysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0))) + { + myerror("connection failed"); + exit(1); + } + if (!opt_silent) + fprintf(stdout, " OK"); + + len= mysql_real_escape_string(lmysql, out, TEST_BUG8378_IN, 4); + + /* No escaping should have actually happened. */ + DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0); + + mysql_close(lmysql); +} + +/* Read and parse arguments and MySQL options from my.cnf */ @@ -11814,6 +11862,7 @@ static struct my_tests_st my_tests[]= { { "test_bug6761", test_bug6761 }, { "test_bug8330", test_bug8330 }, { "test_bug7990", test_bug7990 }, + { "test_bug8378", test_bug8378 }, { 0, 0 } }; |