From 68baa2ac2e6e72b0b36ffa4e5c36c0965fdfc6d1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Jan 2005 18:22:52 -0800 Subject: [PATCH 01/32] Fix bug in bundled GNU readline library, based on similar report for GNU bash (http://lists.gnu.org/archive/html/bug-bash/2002-08/msg00042.html) and current code from GNU readline 5.0. (Bug #5672) cmd-line-utils/readline/bind.c: Import fix from readline-5.0 for endless recursion problem with some misunderstood key codes --- cmd-line-utils/readline/bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From 4ddeaf265f67c2c251239c2aaf4a6d55fed51ccb Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 7 Feb 2005 20:32:56 +0100 Subject: [PATCH 02/32] mysql-test-run.pl: Corrected user name passing Honor the --master-binary and --slave-binary options Insert the host name into 'user' table Added --udiff option, to get unified diff output Call special mtr_run_test() for running "mysqltest" mtr_report.pl: Added --udiff option, to get unified diff output init_db.sql: Insert the host name into 'user' table mysql-test/lib/init_db.sql: Insert the host name into 'user' table mysql-test/lib/mtr_report.pl: Added --udiff option, to get unified diff output mysql-test/mysql-test-run.pl: Corrected user name passing Honor the --master-binary and --slave-binary options Insert the host name into 'user' table Added --udiff option, to get unified diff output Call special mtr_run_test() for running "mysqltest" --- mysql-test/lib/init_db.sql | 10 ++-- mysql-test/lib/mtr_report.pl | 4 +- mysql-test/mysql-test-run.pl | 109 +++++++++++++++++++++-------------- 3 files changed, 76 insertions(+), 47 deletions(-) diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql index f42f7ca6b5f..54591e9b9ff 100644 --- a/mysql-test/lib/init_db.sql +++ b/mysql-test/lib/init_db.sql @@ -10,9 +10,11 @@ CREATE TABLE host (Host char(60) binary DEFAULT '' NOT NULL,Db char(64) binary D 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); +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 ('g4%' ,'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 ('g4%',''); 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'; @@ -40,7 +42,7 @@ INSERT INTO time_zone (Time_zone_id, Use_leap_seconds) VALUES (1,'N'), (2,'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'; -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_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'; 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 3dd6f5803d7..8c6706dded5 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; @@ -422,7 +424,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 +528,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, @@ -706,17 +711,16 @@ sub command_line_setup () { # } #} - if ( $opt_user ) + if ( ! $opt_user ) { - $glob_user= $opt_user; - } - elsif ( $glob_use_running_server ) - { - $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 + } } } @@ -828,7 +832,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" ) { @@ -848,9 +852,6 @@ sub executable_setup () { } } - # FIXME special $exe_master_mysqld and $exe_slave_mysqld - # are not used that much.... - if ( ! $exe_master_mysqld ) { $exe_master_mysqld= $exe_mysqld; @@ -1048,7 +1049,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 ) { @@ -1170,11 +1171,36 @@ 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 () + { + 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"); @@ -1192,12 +1218,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); } @@ -1434,8 +1462,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 @@ -1444,8 +1472,7 @@ 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 - + # Run master initialization shell script if one exists if ( $master_init_script and mtr_run($master_init_script, [], "", "", "", "") != 0 ) { @@ -1459,9 +1486,6 @@ 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 - # Remove stale binary logs and old master.info files # except for too tests which need them if ( $tname ne "rpl_crash_binlog_ib_1b" and @@ -1476,14 +1500,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 + # Run slave initialization shell script if one exists if ( $slave_init_script and mtr_run($slave_init_script, [], "", "", "", "") != 0 ) { mtr_error("Can't run $slave_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 ($$$$$) { @@ -1601,12 +1626,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); } } @@ -1617,12 +1642,12 @@ sub mysqld_arguments ($$$$$) { if ( $glob_use_running_ndbcluster ) { - mtr_add_arg($args,"--ndb-connectstring=%s", $prefix, - $opt_ndbconnectstring); + mtr_add_arg($args,"%s--ndb-connectstring=%s", + $prefix, $opt_ndbconnectstring); } else { - mtr_add_arg($args,"--ndb-connectstring=host=localhost:%d", + mtr_add_arg($args,"%s--ndb-connectstring=host=localhost:%d", $prefix, $opt_ndbcluster_port); } } @@ -1730,18 +1755,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); @@ -1911,7 +1935,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"); @@ -1982,7 +2006,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,""); } ############################################################################## @@ -2064,6 +2088,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 From 1de817e9c467178b82690618223cf320d48a4b0b Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 8 Feb 2005 15:14:14 -0800 Subject: [PATCH 03/32] Fix removal of tables from cache when the database they are contained within is dropped and lower_case_table_names is set. (Bug #8355) mysql-test/t/lowercase_table2.test: Add new regression test mysql-test/r/lowercase_table2.result: Add results for regression test sql/mysql_priv.h: Change remove_db_from_cache() to use char* instead of my_string sql/sql_base.cc: Lowercase database name in remove_db_from_cache so that all of the correct entries are removed. --- mysql-test/r/lowercase_table2.result | 18 ++++++++++++++++++ mysql-test/t/lowercase_table2.test | 17 +++++++++++++++++ sql/mysql_priv.h | 2 +- sql/sql_base.cc | 12 +++++++++++- 4 files changed, 47 insertions(+), 2 deletions(-) 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/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/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/sql_base.cc b/sql/sql_base.cc index fe1f268e277..7ff5a02f05a 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2864,8 +2864,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); From ae14393e7487f3c8a97f3dc44cab7a2c19cdd0a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 9 Feb 2005 16:14:13 -0800 Subject: [PATCH 04/32] When escaping a string in a multi-byte character set, escape all bytes of a character that appears to be a multi-byte character based on its first byte, but is not actually a valid multi-byte character. (Bug #8378) tests/mysql_client_test.c: Add test for Bug #8317 mysys/charset.c: Properly escape invalid multibyte characters. --- mysys/charset.c | 20 ++++++++++++++++ tests/mysql_client_test.c | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/mysys/charset.c b/mysys/charset.c index cb2379f8723..934125ead4a 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -581,6 +581,26 @@ 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 all of the bytes of that apparent 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) + { + while (l--) + { + *to++= '\\'; + *to++= *from++; + } + from--; + continue; + } #endif switch (*from) { case 0: /* Must be escaped for 'mysql' */ diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 83f8f6ab143..b7e3e1b3469 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11532,6 +11532,54 @@ static void test_bug6761(void) myquery(rc); } +/* + Test mysql_real_escape_string() with gbk charset + + The important part is that 0x27 (') is the second-byte in a invvalid + two-byte GBK character here. But 0xbf5c is a valid GBK character, so + it needs to be escaped as 0x5cbf5c27 +*/ +#define TEST_BUG8317_IN "\xef\xbb\xbf\x27" +#define TEST_BUG8317_OUT "\xef\xbb\x5c\xbf\x5c\x27" + +static void test_bug8317() +{ + MYSQL *lmysql; + char out[9]; /* strlen(TEST_BUG8317)*2+1 */ + int len; + + myheader("test_bug8317"); + + 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_BUG8317_IN, 4); + + /* No escaping should have actually happened. */ + DIE_UNLESS(memcmp(out, TEST_BUG8317_OUT, len) == 0); + + mysql_close(lmysql); +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -11739,6 +11787,7 @@ static struct my_tests_st my_tests[]= { { "test_conversion", test_conversion }, { "test_rewind", test_rewind }, { "test_bug6761", test_bug6761 }, + { "test_bug8317", test_bug8317 }, { 0, 0 } }; From 84d1199692f6619657df7824b30c58a967605206 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 12 Feb 2005 22:58:54 +0300 Subject: [PATCH 05/32] Fix for BUG#8218: Remove TMP_TABLE_PARAM::copy_funcs_it. TMP_TABLE_PARAM is a member of JOIN which is copied via memcpy, and List_iterator_fast TMP_TABLE_PARAM::copy_funcs_it ends up pointing to the wrong List. mysql-test/r/subselect.result: Testcase for BUG#8218 mysql-test/t/subselect.test: Testcase for BUG#8218 sql/sql_select.cc: Fix for BUG#8218: Create/use own iterator since TMP_TABLE_PARAM::copy_funcs_it is removed. --- mysql-test/r/subselect.result | 107 ++++++++++++++++++++++++++++++++++ mysql-test/t/subselect.test | 102 ++++++++++++++++++++++++++++++++ sql/sql_class.h | 9 ++- sql/sql_select.cc | 3 +- 4 files changed, 216 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 03dcc23c919..1a192602bdc 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -2196,3 +2196,110 @@ ERROR 42S22: Reference 'xx' not supported (forward reference in item list) select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL; ERROR 42S22: Reference 'xx' not supported (forward reference in item list) drop table t1; +drop table if exists t1, t2, t3, t4, t5; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' +Note 1051 Unknown table 't3' +Note 1051 Unknown table 't4' +Note 1051 Unknown table 't5' +CREATE TABLE t1 ( +categoryId int(11) NOT NULL, +courseId int(11) NOT NULL, +startDate datetime NOT NULL, +endDate datetime NOT NULL, +createDate datetime NOT NULL, +modifyDate timestamp NOT NULL, +attributes text NOT NULL +); +INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''), +(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''), +(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''), +(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''), +(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18',''); +CREATE TABLE t2 ( +userId int(11) NOT NULL, +courseId int(11) NOT NULL, +date datetime NOT NULL +); +INSERT INTO t2 VALUES (5141,71,'2003-11-18'), +(5141,72,'2003-11-25'),(5141,41,'2004-08-06'), +(5141,52,'2004-08-06'),(5141,53,'2004-08-06'), +(5141,12,'2004-08-06'),(5141,86,'2004-10-21'), +(5141,87,'2004-10-21'),(5141,88,'2004-10-21'), +(5141,89,'2004-10-22'),(5141,51,'2004-10-26'); +CREATE TABLE t3 ( +groupId int(11) NOT NULL, +parentId int(11) NOT NULL, +startDate datetime NOT NULL, +endDate datetime NOT NULL, +createDate datetime NOT NULL, +modifyDate timestamp NOT NULL, +ordering int(11) +); +INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL); +CREATE TABLE t4 ( +id int(11) NOT NULL, +groupTypeId int(11) NOT NULL, +groupKey varchar(50) NOT NULL, +name text, +ordering int(11), +description text, +createDate datetime NOT NULL, +modifyDate timestamp NOT NULL +); +INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'), +(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29'); +CREATE TABLE t5 ( +userId int(11) NOT NULL, +groupId int(11) NOT NULL, +createDate datetime NOT NULL, +modifyDate timestamp NOT NULL +); +INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06'); +select +count(distinct t2.userid) pass, +groupstuff.*, +count(t2.courseid) crse, +t1.categoryid, +t2.courseid, +date_format(date, '%b%y') as colhead +from t2 +join t1 on t2.courseid=t1.courseid +join +( +select +t5.userid, +parentid, +parentgroup, +childid, +groupname, +grouptypeid +from t5 +join +( +select t4.id as parentid, +t4.name as parentgroup, +t4.id as childid, +t4.name as groupname, +t4.grouptypeid +from t4 +) as gin on t5.groupid=gin.childid +) as groupstuff on t2.userid = groupstuff.userid +group by +groupstuff.groupname, colhead , t2.courseid; +pass userid parentid parentgroup childid groupname grouptypeid crse categoryid courseid colhead +1 5141 12 group2 12 group2 5 1 5 12 Aug04 +1 5141 12 group2 12 group2 5 1 1 41 Aug04 +1 5141 12 group2 12 group2 5 1 2 52 Aug04 +1 5141 12 group2 12 group2 5 1 2 53 Aug04 +1 5141 12 group2 12 group2 5 1 3 51 Oct04 +1 5141 12 group2 12 group2 5 1 1 86 Oct04 +1 5141 12 group2 12 group2 5 1 1 87 Oct04 +1 5141 12 group2 12 group2 5 1 2 88 Oct04 +1 5141 12 group2 12 group2 5 1 2 89 Oct04 +drop table if exists t1, t2, t3, t4, t5; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 55400dae0be..f72f855f477 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1465,3 +1465,105 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx; -- error 1247 select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL; drop table t1; + +# Test for BUG#8218 +drop table if exists t1, t2, t3, t4, t5; + +CREATE TABLE t1 ( + categoryId int(11) NOT NULL, + courseId int(11) NOT NULL, + startDate datetime NOT NULL, + endDate datetime NOT NULL, + createDate datetime NOT NULL, + modifyDate timestamp NOT NULL, + attributes text NOT NULL +); +INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''), +(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''), +(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''), +(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''), +(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''), +(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18',''); + +CREATE TABLE t2 ( + userId int(11) NOT NULL, + courseId int(11) NOT NULL, + date datetime NOT NULL +); +INSERT INTO t2 VALUES (5141,71,'2003-11-18'), +(5141,72,'2003-11-25'),(5141,41,'2004-08-06'), +(5141,52,'2004-08-06'),(5141,53,'2004-08-06'), +(5141,12,'2004-08-06'),(5141,86,'2004-10-21'), +(5141,87,'2004-10-21'),(5141,88,'2004-10-21'), +(5141,89,'2004-10-22'),(5141,51,'2004-10-26'); + + +CREATE TABLE t3 ( + groupId int(11) NOT NULL, + parentId int(11) NOT NULL, + startDate datetime NOT NULL, + endDate datetime NOT NULL, + createDate datetime NOT NULL, + modifyDate timestamp NOT NULL, + ordering int(11) +); +INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL); + +CREATE TABLE t4 ( + id int(11) NOT NULL, + groupTypeId int(11) NOT NULL, + groupKey varchar(50) NOT NULL, + name text, + ordering int(11), + description text, + createDate datetime NOT NULL, + modifyDate timestamp NOT NULL +); +INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'), +(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29'); + +CREATE TABLE t5 ( + userId int(11) NOT NULL, + groupId int(11) NOT NULL, + createDate datetime NOT NULL, + modifyDate timestamp NOT NULL +); +INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06'); + +select + count(distinct t2.userid) pass, + groupstuff.*, + count(t2.courseid) crse, + t1.categoryid, + t2.courseid, + date_format(date, '%b%y') as colhead +from t2 +join t1 on t2.courseid=t1.courseid +join +( + select + t5.userid, + parentid, + parentgroup, + childid, + groupname, + grouptypeid + from t5 + join + ( + select t4.id as parentid, + t4.name as parentgroup, + t4.id as childid, + t4.name as groupname, + t4.grouptypeid + from t4 + ) as gin on t5.groupid=gin.childid +) as groupstuff on t2.userid = groupstuff.userid +group by + groupstuff.groupname, colhead , t2.courseid; + +drop table if exists t1, t2, t3, t4, t5; + diff --git a/sql/sql_class.h b/sql/sql_class.h index 657a92b394c..703bb030ab9 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1295,7 +1295,11 @@ public: #include -/* Param to create temporary tables when doing SELECT:s */ +/* + Param to create temporary tables when doing SELECT:s + NOTE + This structure is copied using memcpy as a part of JOIN. +*/ class TMP_TABLE_PARAM :public Sql_alloc { @@ -1307,7 +1311,6 @@ private: public: List copy_funcs; List save_copy_funcs; - List_iterator_fast copy_funcs_it; Copy_field *copy_field, *copy_field_end; Copy_field *save_copy_field, *save_copy_field_end; byte *group_buff; @@ -1324,7 +1327,7 @@ public: uint convert_blob_length; TMP_TABLE_PARAM() - :copy_funcs_it(copy_funcs), copy_field(0), group_parts(0), + :copy_field(0), group_parts(0), group_length(0), group_null_parts(0), convert_blob_length(0) {} ~TMP_TABLE_PARAM() diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8353ca9333d..d2c5e9f4ee6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8601,8 +8601,7 @@ copy_fields(TMP_TABLE_PARAM *param) for (; ptr != end; ptr++) (*ptr->do_copy)(ptr); - List_iterator_fast &it=param->copy_funcs_it; - it.rewind(); + List_iterator_fast it(param->copy_funcs); Item_copy_string *item; while ((item = (Item_copy_string*) it++)) item->copy(); From 35a4a58481489d85958a4cc7f83c9ed34e6e3eec Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Feb 2005 11:12:39 +0100 Subject: [PATCH 06/32] - fixed the compilation comments - fixed a broken changelog entry --- support-files/mysql.spec.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index b06ba462b26..1829daeab5b 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 +* Mon Feb 14 2005 Tomas Ulin + +* Fixed the compilation comments and moved them into the separate build sections + for Max and Standard + +* Mon Feb 7 2005 Tomas Ulin - enabled the "Ndbcluster" storage engine for the max binary - added extra make install in ndb subdir after Max build to get ndb binaries From de3f93c6ff8e59490db22d1b0781601bf30a4039 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Feb 2005 18:54:12 +0400 Subject: [PATCH 07/32] Bug#8351 Fix for crash when using a double quote in boolean fulltext query. mysql-test/r/fulltext.result: Added a test case for bug #8351. mysql-test/t/fulltext.test: Added a test case for bug #8351. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + myisam/ft_boolean_search.c | 36 ++++++++++++++---------------------- mysql-test/r/fulltext.result | 7 +++++++ mysql-test/t/fulltext.test | 8 ++++++++ 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 59882283d5d..b88eb69544d 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -203,6 +203,7 @@ serg@sergbook.mysql.com sergefp@mysql.com sinisa@rhols221.adsl.netsonic.fi stewart@mysql.com +svoj@mysql.com tfr@beta.frontier86.ee tfr@indrek.tfr.cafe.ee tfr@sarvik.tfr.cafe.ee diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 4253b5ff96f..62c68322595 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -435,32 +435,24 @@ static int _ftb_strstr(const byte *s0, const byte *e0, const byte *s1, const byte *e1, CHARSET_INFO *cs) { - const byte *p0, *p1; - my_bool s_after, e_before; - - s_after=true_word_char(cs, s1[0]); - e_before=true_word_char(cs, e1[-1]); - p0=s0; + const byte *p0= s0; + my_bool s_after= true_word_char(cs, s1[0]); + my_bool e_before= true_word_char(cs, e1[-1]); + uint p0_len; + my_match_t m[2]; while (p0 < e0) { - while (p0 < e0 && cs->to_upper[(uint) (uchar) *p0++] != - cs->to_upper[(uint) (uchar) *s1]) - /* no-op */; - if (p0 >= e0) - return 0; - - if (s_after && p0-1 > s0 && true_word_char(cs, p0[-2])) - continue; - - p1=s1+1; - while (p0 < e0 && p1 < e1 && cs->to_upper[(uint) (uchar) *p0] == - cs->to_upper[(uint) (uchar) *p1]) - p0++, p1++; - if (p1 == e1 && (!e_before || p0 == e0 || !true_word_char(cs, p0[0]))) - return 1; + if (cs->coll->instr(cs, p0, e0 - p0, s1, e1 - s1, m, 2) != 2) + return(0); + if ((!s_after || p0 + m[1].beg == s0 || !true_word_char(cs, p0[m[1].beg-1])) && + (!e_before || p0 + m[1].end == e0 || !true_word_char(cs, p0[m[1].end]))) + return(1); + p0+= m[1].beg; + p0+= (p0_len= my_mbcharlen(cs, *(uchar *)p0)) ? p0_len : 1; } - return 0; + + return(0); } diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index a042248ba34..67644a68598 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -408,3 +408,10 @@ insert t1 values (1, "aaaa"), (2, "bbbb"); insert t2 values (10, "aaaa"), (2, "cccc"); replace t1 select * from t2; drop table t1, t2; +CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t)); +SET NAMES latin1; +INSERT INTO t1 VALUES('Mit freundlichem Grüß aus Osnabrück'); +SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE); +COUNT(*) +1 +DROP TABLE t1; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 62dcecaff68..50d01da080f 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -322,3 +322,11 @@ insert t2 values (10, "aaaa"), (2, "cccc"); replace t1 select * from t2; drop table t1, t2; +# +# bug#8351 +# +CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t)); +SET NAMES latin1; +INSERT INTO t1 VALUES('Mit freundlichem Grüß aus Osnabrück'); +SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE); +DROP TABLE t1; From 4173610bd23f07545843e0671f402cfcb6eadc32 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Feb 2005 23:45:48 +0300 Subject: [PATCH 08/32] Remove redundant DROP TABLE from test case --- mysql-test/r/subselect.result | 7 ------- mysql-test/t/subselect.test | 1 - 2 files changed, 8 deletions(-) diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 1a192602bdc..5d5b11d629d 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -2196,13 +2196,6 @@ ERROR 42S22: Reference 'xx' not supported (forward reference in item list) select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL; ERROR 42S22: Reference 'xx' not supported (forward reference in item list) drop table t1; -drop table if exists t1, t2, t3, t4, t5; -Warnings: -Note 1051 Unknown table 't1' -Note 1051 Unknown table 't2' -Note 1051 Unknown table 't3' -Note 1051 Unknown table 't4' -Note 1051 Unknown table 't5' CREATE TABLE t1 ( categoryId int(11) NOT NULL, courseId int(11) NOT NULL, diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index f72f855f477..2e2c8753daf 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1467,7 +1467,6 @@ select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL; drop table t1; # Test for BUG#8218 -drop table if exists t1, t2, t3, t4, t5; CREATE TABLE t1 ( categoryId int(11) NOT NULL, From 4cead8c8a500f45952e6f9956293320d36ed505c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 14 Feb 2005 23:47:17 +0100 Subject: [PATCH 09/32] 1) undoing my fix for BUG#8055 "Trouble with replication from temporary tables and ignores" and fixing it another way (per Monty; a simpler solution which does not increase the number of binlog events is to always execute DROP TEMPORARY TABLE IF EXISTS on slave). A new test rpl_drop_temp. 2) fixing BUG#8436 "Multiple "stacked" SQL statements cause replication to stop" by setting thd->query_length to the length of the query being executed, not counting the next queries if this is a multi-query. Should also improve display of SHOW PROCESSLIST. A new test rpl_multi_query. mysql-test/r/drop_temp_table.result: back to one single DROP sql/sql_base.cc: undoing the fix I had made some days ago: we are back to one single DROP TEMPORARY TABLE for all temp tables. sql/sql_parse.cc: 1) set thd->query_length to the length of the query being executed, excluding the other next queries if this is a multi-query. The setting happens ASAP, ie. just after we know it's a multi-query, ie. just after yyparse(). Don't include the ';' in thd->query_length, because this is not good for storage in binlog. 2) always execute a DROP TEMPORARY TABLE IF EXISTS on slave, don't skip it even if --replicate-ignore-table --- mysql-test/r/drop_temp_table.result | 4 +- mysql-test/r/rpl_drop_temp.result | 12 +++++ mysql-test/r/rpl_multi_query.result | 32 ++++++++++++++ mysql-test/t/rpl_drop_temp-slave.opt | 2 + mysql-test/t/rpl_drop_temp.test | 13 ++++++ mysql-test/t/rpl_multi_query.test | 26 +++++++++++ sql/sql_base.cc | 66 +++++++++++++++------------- sql/sql_parse.cc | 26 +++++++++-- 8 files changed, 144 insertions(+), 37 deletions(-) create mode 100644 mysql-test/r/rpl_drop_temp.result create mode 100644 mysql-test/r/rpl_multi_query.result create mode 100644 mysql-test/t/rpl_drop_temp-slave.opt create mode 100644 mysql-test/t/rpl_drop_temp.test create mode 100644 mysql-test/t/rpl_multi_query.test diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result index a486964feb2..5f1f142cde5 100644 --- a/mysql-test/r/drop_temp_table.result +++ b/mysql-test/r/drop_temp_table.result @@ -17,8 +17,6 @@ master-bin.000001 # Query 1 # create database `drop-temp+table-test` master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int) master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int) master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int) -master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2` -master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name` -master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn1` +master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1` master-bin.000001 # Query 1 # use `drop-temp+table-test`; DO RELEASE_LOCK("a") drop database `drop-temp+table-test`; diff --git a/mysql-test/r/rpl_drop_temp.result b/mysql-test/r/rpl_drop_temp.result new file mode 100644 index 00000000000..e00309cac8f --- /dev/null +++ b/mysql-test/r/rpl_drop_temp.result @@ -0,0 +1,12 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create database if not exists mysqltest; +create temporary table mysqltest.t1 (n int); +create temporary table mysqltest.t2 (n int); +show status like 'Slave_open_temp_tables'; +Variable_name Value +Slave_open_temp_tables 0 diff --git a/mysql-test/r/rpl_multi_query.result b/mysql-test/r/rpl_multi_query.result new file mode 100644 index 00000000000..2521dbe1ed9 --- /dev/null +++ b/mysql-test/r/rpl_multi_query.result @@ -0,0 +1,32 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +drop database if exists mysqltest; +create database mysqltest; +create table mysqltest.t1 ( n int); +insert into mysqltest.t1 values(1)/ +insert into mysqltest.t1 values(2); +insert into mysqltest.t1 values(3); +insert into mysqltest.t1 values(4); +insert into mysqltest.t1 values(5)/ +select * from mysqltest.t1; +n +1 +2 +3 +4 +5 +show binlog events from 79; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.000001 # Query 1 # drop database if exists mysqltest +master-bin.000001 # Query 1 # create database mysqltest +master-bin.000001 # Query 1 # use `test`; create table mysqltest.t1 ( n int) +master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(1) +master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(2) +master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(3) +master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(4) +master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(5) +drop database mysqltest; diff --git a/mysql-test/t/rpl_drop_temp-slave.opt b/mysql-test/t/rpl_drop_temp-slave.opt new file mode 100644 index 00000000000..2f9244c65ff --- /dev/null +++ b/mysql-test/t/rpl_drop_temp-slave.opt @@ -0,0 +1,2 @@ +--replicate-ignore-table=mysqltest.t2 + diff --git a/mysql-test/t/rpl_drop_temp.test b/mysql-test/t/rpl_drop_temp.test new file mode 100644 index 00000000000..73d691d9d90 --- /dev/null +++ b/mysql-test/t/rpl_drop_temp.test @@ -0,0 +1,13 @@ +source include/master-slave.inc; +--disable_warnings +create database if not exists mysqltest; +--enable_warnings + +create temporary table mysqltest.t1 (n int); +create temporary table mysqltest.t2 (n int); +sync_slave_with_master; +connection master; +disconnect master; +connection slave; +--real_sleep 3; # time for DROP to be written +show status like 'Slave_open_temp_tables'; diff --git a/mysql-test/t/rpl_multi_query.test b/mysql-test/t/rpl_multi_query.test new file mode 100644 index 00000000000..15f5d288759 --- /dev/null +++ b/mysql-test/t/rpl_multi_query.test @@ -0,0 +1,26 @@ +# Test for BUG#8436: verify that a multi-query (i.e. one query +# containing several queries (assuming client has +# CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not +# one binlog event containing all queries) + +source include/master-slave.inc; +--disable_warnings +drop database if exists mysqltest; +--enable_warnings +create database mysqltest; + +delimiter /; +create table mysqltest.t1 ( n int); +insert into mysqltest.t1 values(1)/ +insert into mysqltest.t1 values(2); +insert into mysqltest.t1 values(3); +insert into mysqltest.t1 values(4); +insert into mysqltest.t1 values(5)/ +delimiter ;/ +sync_slave_with_master; +select * from mysqltest.t1; +connection master; +--replace_column 2 # 5 # +show binlog events from 79; +drop database mysqltest; +sync_slave_with_master; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index fe1f268e277..7434897ab90 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -485,58 +485,62 @@ void close_temporary(TABLE *table,bool delete_table) void close_temporary_tables(THD *thd) { TABLE *table,*next; - char *query, *name_in_query, *end; - uint greatest_key_length= 0; + char *query, *end; + uint query_buf_size; + bool found_user_tables = 0; if (!thd->temporary_tables) return; - /* - We write a DROP TEMPORARY TABLE for each temp table left, so that our - replication slave can clean them up. Not one multi-table DROP TABLE binlog - event: this would cause problems if slave uses --replicate-*-table. - */ LINT_INIT(end); + query_buf_size= 50; // Enough for DROP ... TABLE IF EXISTS - /* We'll re-use always same buffer so make it big enough for longest name */ for (table=thd->temporary_tables ; table ; table=table->next) - greatest_key_length= max(greatest_key_length, table->key_length); + /* + We are going to add 4 ` around the db/table names, so 1 does not look + enough; indeed it is enough, because table->key_length is greater (by 8, + because of server_id and thread_id) than db||table. + */ + query_buf_size+= table->key_length+1; - if ((query = alloc_root(thd->mem_root, greatest_key_length+50))) + if ((query = alloc_root(thd->mem_root, query_buf_size))) // Better add "if exists", in case a RESET MASTER has been done - name_in_query= strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `"); + end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS "); for (table=thd->temporary_tables ; table ; table=next) { - /* - In we are OOM for 'query' this is not fatal. We skip temporary tables - not created directly by the user. - */ - if (query && mysql_bin_log.is_open() && (table->real_name[0] != '#')) + if (query) // we might be out of memory, but this is not fatal { + // skip temporary tables not created directly by the user + if (table->real_name[0] != '#') + found_user_tables = 1; /* Here we assume table_cache_key always starts with \0 terminated db name */ - end = strxmov(name_in_query, table->table_cache_key, "`.`", - table->real_name, "`", NullS); - Query_log_event qinfo(thd, query, (ulong)(end-query), 0, FALSE); - /* - Imagine the thread had created a temp table, then was doing a SELECT, and - the SELECT was killed. Then it's not clever to mark the statement above as - "killed", because it's not really a statement updating data, and there - are 99.99% chances it will succeed on slave. And, if thread is - killed now, it's not clever either. - If a real update (one updating a persistent table) was killed on the - master, then this real update will be logged with error_code=killed, - rightfully causing the slave to stop. - */ - qinfo.error_code= 0; - mysql_bin_log.write(&qinfo); + end = strxmov(end,"`",table->table_cache_key,"`.`", + table->real_name,"`,", NullS); } next=table->next; close_temporary(table); } + if (query && found_user_tables && mysql_bin_log.is_open()) + { + /* The -1 is to remove last ',' */ + thd->clear_error(); + Query_log_event qinfo(thd, query, (ulong)(end-query)-1, 0, FALSE); + /* + Imagine the thread had created a temp table, then was doing a SELECT, and + the SELECT was killed. Then it's not clever to mark the statement above as + "killed", because it's not really a statement updating data, and there + are 99.99% chances it will succeed on slave. + If a real update (one updating a persistent table) was killed on the + master, then this real update will be logged with error_code=killed, + rightfully causing the slave to stop. + */ + qinfo.error_code= 0; + mysql_bin_log.write(&qinfo); + } thd->temporary_tables=0; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e66eeb279d2..f25255ac455 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1472,6 +1472,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, { if (alloc_query(thd, packet, packet_length)) break; // fatal error is set + char *packet_end= thd->query + thd->query_length; mysql_log.write(thd,command,"%s",thd->query); DBUG_PRINT("query",("%-.4096s",thd->query)); mysql_parse(thd,thd->query, thd->query_length); @@ -1487,7 +1488,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (thd->lock || thd->open_tables || thd->derived_tables) close_thread_tables(thd); #endif - ulong length= thd->query_length-(ulong)(packet-thd->query); + ulong length= (ulong)(packet_end-packet); /* Remove garbage at start of query */ while (my_isspace(thd->charset(), *packet) && length > 0) @@ -1924,9 +1925,14 @@ mysql_execute_command(THD *thd) } /* Skip if we are in the slave thread, some table rules have been - given and the table list says the query should not be replicated + given and the table list says the query should not be replicated. + Exception is DROP TEMPORARY TABLE IF EXISTS: we always execute it + (otherwise we have stale files on slave caused by exclusion of one tmp + table). */ - if (all_tables_not_ok(thd,tables)) + if (!(lex->sql_command == SQLCOM_DROP_TABLE && + lex->drop_temporary && lex->drop_if_exists) && + all_tables_not_ok(thd,tables)) { /* we warn the slave SQL thread */ my_error(ER_SLAVE_IGNORED_TABLE, MYF(0)); @@ -4118,6 +4124,20 @@ void mysql_parse(THD *thd, char *inBuf, uint length) send_error(thd, 0, NullS); else { + /* + Binlog logs a string starting from thd->query and having length + thd->query_length; so we set thd->query_length correctly (to not + log several statements in one event, when we executed only first). + We set it to not see the ';' (otherwise it would get into binlog + and Query_log_event::print() would give ';;' output). + This also helps display only the current query in SHOW + PROCESSLIST. + Note that we don't need LOCK_thread_count to modify query_length. + */ + if (lex->found_colon && + (thd->query_length= (ulong)(lex->found_colon - thd->query))) + thd->query_length--; + /* Actually execute the query */ mysql_execute_command(thd); query_cache_end_of_result(thd); } From de109e463bb699305bdcf116280c412dc7da2566 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 03:55:44 +0300 Subject: [PATCH 10/32] Fix signatures of placement operator delete in places where placement delete is declared. As we don't use exceptions placement delete is never called and the fix only affects numerous warnings when compiling with MS Visual C++. For more info see http://www.gotw.ca/gotw/010.htm. sql/item.h: Fix the signature of placement operator delete for class Item. sql/sql_class.cc: Add placement delete operator to suppress a warning under Windows. sql/sql_lex.h: Fix the signature of placement operator delete for class LEX sql/sql_list.h: Fix the signature of placement operator delete for class Sql_alloc sql/sql_string.h: Fix the signature of placement operator delete for class Sql_string --- sql/item.h | 2 +- sql/sql_class.cc | 2 ++ sql/sql_lex.h | 2 +- sql/sql_list.h | 4 ++-- sql/sql_string.h | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sql/item.h b/sql/item.h index a8b892292d3..db5010799fa 100644 --- a/sql/item.h +++ b/sql/item.h @@ -119,7 +119,7 @@ public: static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) {} - static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) {} + static void operator delete(void *ptr, MEM_ROOT *mem_root) {} enum Type {FIELD_ITEM, FUNC_ITEM, SUM_FUNC_ITEM, STRING_ITEM, INT_ITEM, REAL_ITEM, NULL_ITEM, VARBIN_ITEM, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e11d8369f57..918e70fbc84 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -707,6 +707,8 @@ struct Item_change_record: public ilink Item *old_value; /* Placement new was hidden by `new' in ilink (TODO: check): */ static void *operator new(size_t size, void *mem) { return mem; } + static void operator delete(void *ptr, size_t size) {} + static void operator delete(void *ptr, void *mem) { /* never called */ } }; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 7cb71607edf..3e2f6a3f2b5 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -241,7 +241,7 @@ public: static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) {} - static void operator delete(void *ptr,size_t size, MEM_ROOT *mem_root) {} + static void operator delete(void *ptr, MEM_ROOT *mem_root) {} st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {} virtual ~st_select_lex_node() {} inline st_select_lex_node* get_master() { return master; } diff --git a/sql/sql_list.h b/sql/sql_list.h index a607b31d60c..be3e29b0c62 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -41,8 +41,8 @@ public: static void *operator new(size_t size, MEM_ROOT *mem_root) { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); } - static void operator delete(void *ptr, size_t size, MEM_ROOT *mem_root) - { TRASH(ptr, size); } + static void operator delete(void *ptr, MEM_ROOT *mem_root) + { /* never called */ } static void operator delete[](void *ptr, size_t size) { TRASH(ptr, size); } #ifdef HAVE_purify bool dummy; diff --git a/sql/sql_string.h b/sql/sql_string.h index 9136dddbbf2..3ad4689cf36 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -73,7 +73,7 @@ public: { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr_arg,size_t size) {} - static void operator delete(void *ptr_arg,size_t size, MEM_ROOT *mem_root) + static void operator delete(void *ptr_arg, MEM_ROOT *mem_root) {} ~String() { free(); } From 658bac84bf8fcc8d57c94e65e2097164af88eb50 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 11:16:17 +0200 Subject: [PATCH 11/32] InnoDB: Create temporary files in the MySQL tmpdir instead of $TMPDIR. (Bug #5822) sql/ha_innodb.cc: innobase_mysql_tmpfile(): pass mysql_tmpdir to create_temp_file(), so that the MySQL startup option tmpdir will be honored instead of the environment variable TMPDIR. (Bug #5822) --- sql/ha_innodb.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 1a870ce3abf..81a803e36b9 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -424,7 +424,7 @@ innobase_mysql_tmpfile(void) { char filename[FN_REFLEN]; int fd2 = -1; - File fd = create_temp_file(filename, NullS, "ib", + File fd = create_temp_file(filename, mysql_tmpdir, "ib", #ifdef __WIN__ O_BINARY | O_TRUNC | O_SEQUENTIAL | O_TEMPORARY | O_SHORT_LIVED | From 1d633f645a7c2c8186a5b605dc1bcaf95787cc7a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 15:01:20 +0400 Subject: [PATCH 12/32] A fix. "(int) var" type cast doesn't work correctly for uint32 var on some 64-bit platforms (e.g. IRIX, non-debug build). --- sql/item_strfunc.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a92c4e94c87..bbbcadbb071 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1645,7 +1645,8 @@ String *Item_func_format::val_str(String *str) { DBUG_ASSERT(fixed == 1); double nr =args[0]->val(); - uint32 diff,length,str_length; + int diff; + uint32 length, str_length; uint dec; if ((null_value=args[0]->null_value)) return 0; /* purecov: inspected */ @@ -1670,9 +1671,12 @@ String *Item_func_format::val_str(String *str) pos[0]= pos[-(int) diff]; while (diff) { - pos[0]=pos[-(int) diff]; pos--; - pos[0]=pos[-(int) diff]; pos--; - pos[0]=pos[-(int) diff]; pos--; + *pos= *(pos - diff); + pos--; + *pos= *(pos - diff); + pos--; + *pos= *(pos - diff); + pos--; pos[0]=','; pos--; diff--; From 358cfd6c4220d3d1d1f596f6313fcba1819ff1a6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 14:42:13 +0200 Subject: [PATCH 13/32] Better bug fix for #5569: "Incorrect "Access Denied" error with SAME login DIFFERENT host" This fixes also the reverse lookup bug introduced by the previous patch mysql-test/t/group_by.test: Remove empty line vio/viosocket.c: Added function comment --- mysql-test/t/group_by.test | 1 - sql/sql_parse.cc | 23 +++++++++++++---------- vio/viosocket.c | 12 ++++++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 5af78b924f8..2e5446c2d92 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -455,4 +455,3 @@ select min(a) is null from t1; select min(a) is null or null from t1; select 1 and min(a) is null from t1; drop table t1; - diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index cd0abafc0c9..613484ebf50 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -504,8 +504,6 @@ check_connections(THD *thd) DBUG_PRINT("info",("New connection received on %s", vio_description(net->vio))); - vio_in_addr(net->vio,&thd->remote.sin_addr); - if (!thd->host) // If TCP/IP connection { char ip[30]; @@ -515,6 +513,7 @@ check_connections(THD *thd) if (!(thd->ip = my_strdup(ip,MYF(0)))) return (ER_OUT_OF_RESOURCES); thd->host_or_ip=thd->ip; + vio_in_addr(net->vio, &thd->remote.sin_addr); #if !defined(HAVE_SYS_UN_H) || defined(HAVE_mit_thread) /* Fast local hostname resolve for Win32 */ if (!strcmp(thd->ip,"127.0.0.1")) @@ -524,17 +523,19 @@ check_connections(THD *thd) } else #endif - if (!(specialflag & SPECIAL_NO_RESOLVE)) { - thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); - /* Cut very long hostnames to avoid possible overflows */ - if (thd->host) + if (!(specialflag & SPECIAL_NO_RESOLVE)) { - thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; - thd->host_or_ip= thd->host; + thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors); + /* Cut very long hostnames to avoid possible overflows */ + if (thd->host) + { + thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0; + thd->host_or_ip= thd->host; + } + if (connect_errors > max_connect_errors) + return(ER_HOST_IS_BLOCKED); } - if (connect_errors > max_connect_errors) - return(ER_HOST_IS_BLOCKED); } DBUG_PRINT("info",("Host: %s ip: %s", thd->host ? thd->host : "unknown host", @@ -547,6 +548,8 @@ check_connections(THD *thd) DBUG_PRINT("info",("Host: %s",thd->host)); thd->host_or_ip= thd->host; thd->ip= 0; + /* Reset sin_addr */ + bzero((char*) &thd->remote, sizeof(thd->remote)); } vio_keepalive(net->vio, TRUE); diff --git a/vio/viosocket.c b/vio/viosocket.c index 1b6f46c57cf..f45c9dd98c4 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -291,6 +291,18 @@ my_bool vio_peer_addr(Vio * vio, char *buf, uint16 *port) } +/* + Get in_addr for a TCP/IP connection + + SYNOPSIS + vio_in_addr() + vio vio handle + in put in_addr here + + NOTES + one must call vio_peer_addr() before calling this one +*/ + void vio_in_addr(Vio *vio, struct in_addr *in) { DBUG_ENTER("vio_in_addr"); From f9982066a37d05976be3ab30feb7c029e2a511b4 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 14:13:18 +0100 Subject: [PATCH 14/32] 1) Tag the 4.1.10 released version: bk tag -r 1.2159.8.1 "mysql-4.1.10" 2) Raise the version number to 4.1.11. configure.in: Raise the version number from 4.1.10 to 4.1.11. --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index 665029accb3..f3e93afb72e 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 4.1.10) +AM_INIT_AUTOMAKE(mysql, 4.1.11) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -16,7 +16,7 @@ SHARED_LIB_VERSION=14:0:0 # ndb version NDB_VERSION_MAJOR=4 NDB_VERSION_MINOR=1 -NDB_VERSION_BUILD=10 +NDB_VERSION_BUILD=11 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? From 9dad64a129a18e8b9d64edcd5947e9eba88f3c41 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 11:31:01 -0800 Subject: [PATCH 15/32] Only escape the first character in a sequence of bytes that appears to be a multibyte character, but was not a valid multibyte character. Refinement of fix for Bug #8378. tests/mysql_client_test.c: Fix test (and fix number) for Bug #8378 mysys/charset.c: Fix to only escape the first character in a sequence that appears to be a multibyte character, but was not a valid one. --- mysys/charset.c | 15 ++++++--------- tests/mysql_client_test.c | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/mysys/charset.c b/mysys/charset.c index 934125ead4a..5587a6d685f 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -583,9 +583,10 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, } /* If the next character appears to begin a multi-byte character, we - escape all of the bytes of that apparent 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.) + 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 @@ -593,12 +594,8 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, */ if (use_mb_flag && (l= my_mbcharlen(charset_info, *from)) > 1) { - while (l--) - { - *to++= '\\'; - *to++= *from++; - } - from--; + *to++= '\\'; + *to++= *from; continue; } #endif diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index b7e3e1b3469..7886e0c1884 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11535,20 +11535,20 @@ static void test_bug6761(void) /* Test mysql_real_escape_string() with gbk charset - The important part is that 0x27 (') is the second-byte in a invvalid + 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 0x5cbf5c27 + it needs to be escaped as 0x5cbf27 */ -#define TEST_BUG8317_IN "\xef\xbb\xbf\x27" -#define TEST_BUG8317_OUT "\xef\xbb\x5c\xbf\x5c\x27" +#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_bug8317() +static void test_bug8378() { MYSQL *lmysql; - char out[9]; /* strlen(TEST_BUG8317)*2+1 */ + char out[9]; /* strlen(TEST_BUG8378)*2+1 */ int len; - myheader("test_bug8317"); + myheader("test_bug8378"); if (!opt_silent) fprintf(stdout, "\n Establishing a test connection ..."); @@ -11572,10 +11572,10 @@ static void test_bug8317() if (!opt_silent) fprintf(stdout, " OK"); - len= mysql_real_escape_string(lmysql, out, TEST_BUG8317_IN, 4); + len= mysql_real_escape_string(lmysql, out, TEST_BUG8378_IN, 4); /* No escaping should have actually happened. */ - DIE_UNLESS(memcmp(out, TEST_BUG8317_OUT, len) == 0); + DIE_UNLESS(memcmp(out, TEST_BUG8378_OUT, len) == 0); mysql_close(lmysql); } @@ -11787,7 +11787,7 @@ static struct my_tests_st my_tests[]= { { "test_conversion", test_conversion }, { "test_rewind", test_rewind }, { "test_bug6761", test_bug6761 }, - { "test_bug8317", test_bug8317 }, + { "test_bug8378", test_bug8378 }, { 0, 0 } }; From 2d2d4df7d28bc1826858b69d93a60cad76fe80d3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 13:36:46 -0800 Subject: [PATCH 16/32] Always lowercase database names from 'host' and 'db' grant tables when they are loaded and lower_case_table_names is set, but issue a warning when it is done. (Bug #7989) sql/sql_acl.cc: Lowercase database names in 'host' and 'db' grant tables when loading, but issue a warning to the log about them. --- mysql-test/r/lowercase_table_grant.result | 23 ++++++++++++ mysql-test/t/lowercase_table_grant-master.opt | 1 + mysql-test/t/lowercase_table_grant.test | 25 +++++++++++++ sql/sql_acl.cc | 37 +++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 mysql-test/r/lowercase_table_grant.result create mode 100644 mysql-test/t/lowercase_table_grant-master.opt create mode 100644 mysql-test/t/lowercase_table_grant.test 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/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/sql/sql_acl.cc b/sql/sql_acl.cc index 7c17a4ef275..92d6f471a1e 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) From 3be01953d123eb200a5c8bb85b7bbb0c50ffda47 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 17:27:23 -0600 Subject: [PATCH 17/32] ft_nlq_search.c: Added bounds check to avoid accessing unallocated FT_DOC array. (BUG #8522) myisam/ft_nlq_search.c: Added bounds check to avoid accessing unallocated FT_DOC array. (BUG #8522) BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + myisam/ft_nlq_search.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 9465991bc17..f8621170f64 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -24,6 +24,7 @@ bk@admin.bk brian@brian-akers-computer.local carsten@tsort.bitbybit.dk davida@isil.mysql.com +dean@mysql.com dellis@goetia.(none) dlenev@brandersnatch.localdomain dlenev@build.mysql.com diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 3ad983f0a37..13cbf24b3f7 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -205,6 +205,10 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, left_root_right)) goto err2; + /* + 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)); @@ -275,7 +279,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; From f1a97c0c49d1193bf37f36b27e968b4185165645 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Feb 2005 18:45:42 -0800 Subject: [PATCH 18/32] delete.result, delete.test: Added a test case for bug #8392. sql_delete.cc: Fixed bug #8392. The bug caused a crash for a delete statement with ORDER BY that explicitly referred to the modified table. sql/sql_delete.cc: Fixed bug #8392. The bug caused a crash for a delete statement with ORDER BY that explicitly referred to the modified table. mysql-test/t/delete.test: Added a test case for bug #8392. mysql-test/r/delete.result: Added a test case for bug #8392. --- mysql-test/r/delete.result | 9 +++++++++ mysql-test/t/delete.test | 11 +++++++++++ sql/sql_delete.cc | 1 + 3 files changed, 21 insertions(+) diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 7353e687ae7..378371f2982 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -61,3 +61,12 @@ select * from t1; a b 1 apple drop table t1; +CREATE TABLE t1 ( a int PRIMARY KEY ); +DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; +INSERT INTO t1 VALUES (0),(1),(2); +DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1; +SELECT * FROM t1; +a +0 +2 +DROP TABLE t1; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 07cb9155b3f..5fcdd6263ed 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -71,3 +71,14 @@ select * from t1; delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a; select * from t1; drop table t1; + +# +# Bug #8392: delete with ORDER BY containing a direct reference to the table +# + +CREATE TABLE t1 ( a int PRIMARY KEY ); +DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; +INSERT INTO t1 VALUES (0),(1),(2); +DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1; +SELECT * FROM t1; +DROP TABLE t1; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 92193e3abf2..475df34dc4f 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -111,6 +111,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, bzero((char*) &tables,sizeof(tables)); tables.table = table; + tables.alias = table_list->alias; table->io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE), MYF(MY_FAE | MY_ZEROFILL)); From 9ffac369d596e5005e5daf534c791cc23a62e308 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 10:01:05 +0100 Subject: [PATCH 19/32] rpl_multi_query.test: disable ps-protocol as PS don't support multi-queries mysql-test/t/rpl_multi_query.test: disable ps-protocol as PS don't support multi-queries --- mysql-test/t/rpl_multi_query.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql-test/t/rpl_multi_query.test b/mysql-test/t/rpl_multi_query.test index 15f5d288759..482a2679e7a 100644 --- a/mysql-test/t/rpl_multi_query.test +++ b/mysql-test/t/rpl_multi_query.test @@ -3,6 +3,9 @@ # CLIENT_MULTI_STATEMENTS) will be binlogged ONE-query-per-event (not # one binlog event containing all queries) +# PS doesn't support multi-statements +--disable_ps_protocol + source include/master-slave.inc; --disable_warnings drop database if exists mysqltest; From cb17889f47b0d128a192709840bb1c403715768f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 03:13:29 -0600 Subject: [PATCH 20/32] fulltext.test, fulltext.result: Test case for bug#8522, to test for out of bounds memory access in ft_nlq_find_relevance(). mysql-test/r/fulltext.result: Test case for bug#8522, to test for out of bounds memory access in ft_nlq_find_relevance(). mysql-test/t/fulltext.test: Test case for bug#8522, to test for out of bounds memory access in ft_nlq_find_relevance(). --- mysql-test/r/fulltext.result | 6 ++++++ mysql-test/t/fulltext.test | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 50f0a1dc120..ce1703fca0e 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -315,3 +315,9 @@ 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; diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index b44854860f9..90020e9468e 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -252,3 +252,11 @@ REPAIR TABLE t1; 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; From dbff1150c5195cd4ae8c76bf9b7c6234af57df7e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 12:45:59 +0100 Subject: [PATCH 21/32] ndb - fix old decimal type mysql vs ndb mysql-test/r/ndb_index_ordered.result: fix old decimal type mysql vs ndb (re-commit 3) mysql-test/t/ndb_index_ordered.test: fix old decimal type mysql vs ndb (re-commit 3) ndb/include/kernel/signaldata/DictTabInfo.hpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/include/ndbapi/NdbDictionary.hpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/include/util/NdbSqlUtil.hpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/src/common/util/NdbSqlUtil.cpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/src/ndbapi/NdbDictionary.cpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/src/ndbapi/NdbDictionaryImpl.cpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/src/ndbapi/NdbRecAttr.cpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/test/include/NdbSchemaOp.hpp: fix old decimal type mysql vs ndb (re-commit 3) ndb/tools/restore/consumer.cpp: fix old decimal type mysql vs ndb (re-commit 3) sql/ha_ndbcluster.cc: fix old decimal type mysql vs ndb (re-commit 3) --- mysql-test/r/ndb_index_ordered.result | 83 +++++++++++++ mysql-test/t/ndb_index_ordered.test | 52 ++++++++ ndb/include/kernel/signaldata/DictTabInfo.hpp | 20 ++- ndb/include/ndbapi/NdbDictionary.hpp | 13 +- ndb/include/util/NdbSqlUtil.hpp | 13 +- ndb/src/common/util/NdbSqlUtil.cpp | 114 ++++++++++++------ ndb/src/ndbapi/NdbDictionary.cpp | 7 +- ndb/src/ndbapi/NdbDictionaryImpl.cpp | 6 +- ndb/src/ndbapi/NdbRecAttr.cpp | 15 ++- ndb/test/include/NdbSchemaOp.hpp | 3 +- ndb/tools/restore/consumer.cpp | 5 +- sql/ha_ndbcluster.cc | 34 ++++-- 12 files changed, 304 insertions(+), 61 deletions(-) diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result index 12438f247c3..f5794d477f3 100644 --- a/mysql-test/r/ndb_index_ordered.result +++ b/mysql-test/r/ndb_index_ordered.result @@ -445,6 +445,89 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59'; count(*)-9 0 drop table t1; +create table t1 ( +a int primary key, +s decimal(12), +t decimal(12, 5), +u decimal(12) unsigned, +v decimal(12, 5) unsigned, +key (s), +key (t), +key (u), +key (v) +) engine=ndb; +insert into t1 values +( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042), +( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003), +( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488), +( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013), +( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002), +( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018), +( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001), +( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374), +( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000), +( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008); +select count(*)- 5 from t1 use index (s) where s < -000000000007; +count(*)- 5 +0 +select count(*)- 7 from t1 use index (s) where s <= -000000000007; +count(*)- 7 +0 +select count(*)- 2 from t1 use index (s) where s = -000000000007; +count(*)- 2 +0 +select count(*)- 5 from t1 use index (s) where s >= -000000000007; +count(*)- 5 +0 +select count(*)- 3 from t1 use index (s) where s > -000000000007; +count(*)- 3 +0 +select count(*)- 4 from t1 use index (t) where t < -0000061.00003; +count(*)- 4 +0 +select count(*)- 5 from t1 use index (t) where t <= -0000061.00003; +count(*)- 5 +0 +select count(*)- 1 from t1 use index (t) where t = -0000061.00003; +count(*)- 1 +0 +select count(*)- 6 from t1 use index (t) where t >= -0000061.00003; +count(*)- 6 +0 +select count(*)- 5 from t1 use index (t) where t > -0000061.00003; +count(*)- 5 +0 +select count(*)- 2 from t1 use index (u) where u < 000000000061; +count(*)- 2 +0 +select count(*)- 4 from t1 use index (u) where u <= 000000000061; +count(*)- 4 +0 +select count(*)- 2 from t1 use index (u) where u = 000000000061; +count(*)- 2 +0 +select count(*)- 8 from t1 use index (u) where u >= 000000000061; +count(*)- 8 +0 +select count(*)- 6 from t1 use index (u) where u > 000000000061; +count(*)- 6 +0 +select count(*)- 5 from t1 use index (v) where v < 0000965.00042; +count(*)- 5 +0 +select count(*)- 6 from t1 use index (v) where v <= 0000965.00042; +count(*)- 6 +0 +select count(*)- 1 from t1 use index (v) where v = 0000965.00042; +count(*)- 1 +0 +select count(*)- 5 from t1 use index (v) where v >= 0000965.00042; +count(*)- 5 +0 +select count(*)- 4 from t1 use index (v) where v > 0000965.00042; +count(*)- 4 +0 +drop table t1; create table t1(a int primary key, b int not null, index(b)); insert into t1 values (1,1), (2,2); set autocommit=0; diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test index 47e6b93eb81..010060a694d 100644 --- a/mysql-test/t/ndb_index_ordered.test +++ b/mysql-test/t/ndb_index_ordered.test @@ -249,6 +249,58 @@ select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59'; drop table t1; +# decimal (not the new 5.0 thing) + +create table t1 ( + a int primary key, + s decimal(12), + t decimal(12, 5), + u decimal(12) unsigned, + v decimal(12, 5) unsigned, + key (s), + key (t), + key (u), + key (v) +) engine=ndb; +# +insert into t1 values + ( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042), + ( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003), + ( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488), + ( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013), + ( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002), + ( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018), + ( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001), + ( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374), + ( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000), + ( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008); +# +select count(*)- 5 from t1 use index (s) where s < -000000000007; +select count(*)- 7 from t1 use index (s) where s <= -000000000007; +select count(*)- 2 from t1 use index (s) where s = -000000000007; +select count(*)- 5 from t1 use index (s) where s >= -000000000007; +select count(*)- 3 from t1 use index (s) where s > -000000000007; +# +select count(*)- 4 from t1 use index (t) where t < -0000061.00003; +select count(*)- 5 from t1 use index (t) where t <= -0000061.00003; +select count(*)- 1 from t1 use index (t) where t = -0000061.00003; +select count(*)- 6 from t1 use index (t) where t >= -0000061.00003; +select count(*)- 5 from t1 use index (t) where t > -0000061.00003; +# +select count(*)- 2 from t1 use index (u) where u < 000000000061; +select count(*)- 4 from t1 use index (u) where u <= 000000000061; +select count(*)- 2 from t1 use index (u) where u = 000000000061; +select count(*)- 8 from t1 use index (u) where u >= 000000000061; +select count(*)- 6 from t1 use index (u) where u > 000000000061; +# +select count(*)- 5 from t1 use index (v) where v < 0000965.00042; +select count(*)- 6 from t1 use index (v) where v <= 0000965.00042; +select count(*)- 1 from t1 use index (v) where v = 0000965.00042; +select count(*)- 5 from t1 use index (v) where v >= 0000965.00042; +select count(*)- 4 from t1 use index (v) where v > 0000965.00042; + +drop table t1; + # bug#7798 create table t1(a int primary key, b int not null, index(b)); insert into t1 values (1,1), (2,2); diff --git a/ndb/include/kernel/signaldata/DictTabInfo.hpp b/ndb/include/kernel/signaldata/DictTabInfo.hpp index ade6c22a5bd..a2f9fcc9799 100644 --- a/ndb/include/kernel/signaldata/DictTabInfo.hpp +++ b/ndb/include/kernel/signaldata/DictTabInfo.hpp @@ -302,7 +302,8 @@ public: ExtBigunsigned = NdbSqlUtil::Type::Bigunsigned, ExtFloat = NdbSqlUtil::Type::Float, ExtDouble = NdbSqlUtil::Type::Double, - ExtDecimal = NdbSqlUtil::Type::Decimal, + ExtOlddecimal = NdbSqlUtil::Type::Olddecimal, + ExtOlddecimalunsigned = NdbSqlUtil::Type::Olddecimalunsigned, ExtChar = NdbSqlUtil::Type::Char, ExtVarchar = NdbSqlUtil::Type::Varchar, ExtBinary = NdbSqlUtil::Type::Binary, @@ -411,9 +412,20 @@ public: AttributeSize = DictTabInfo::a64Bit; AttributeArraySize = AttributeExtLength; return true; - case DictTabInfo::ExtDecimal: - // not yet implemented anywhere - break; + case DictTabInfo::ExtOlddecimal: + AttributeType = DictTabInfo::StringType; + AttributeSize = DictTabInfo::an8Bit; + AttributeArraySize = + (1 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) * + AttributeExtLength; + return true; + case DictTabInfo::ExtOlddecimalunsigned: + AttributeType = DictTabInfo::StringType; + AttributeSize = DictTabInfo::an8Bit; + AttributeArraySize = + (0 + AttributeExtPrecision + (int(AttributeExtScale) > 0)) * + AttributeExtLength; + return true; case DictTabInfo::ExtChar: case DictTabInfo::ExtBinary: AttributeType = DictTabInfo::StringType; diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index 49afbd695c9..6aa675a2319 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -179,7 +179,7 @@ public: Bigunsigned, ///< 64 Bit. 8 byte signed integer, can be used in array Float, ///< 32-bit float. 4 bytes float, can be used in array Double, ///< 64-bit float. 8 byte float, can be used in array - Decimal, ///< Precision, Scale are applicable + Olddecimal, ///< MySQL < 5.0 signed decimal, Precision, Scale Char, ///< Len. A fixed array of 1-byte chars Varchar, ///< Max len Binary, ///< Len @@ -190,7 +190,8 @@ public: Text, ///< Text blob Time = 25, ///< Time without date Year = 26, ///< Year 1901-2155 (1 byte) - Timestamp = 27 ///< Unix time + Timestamp = 27, ///< Unix time + Olddecimalunsigned = 28 }; /** @@ -276,25 +277,25 @@ public: /** * Set precision of column. - * @note Only applicable for builtin type Decimal + * @note Only applicable for decimal types */ void setPrecision(int); /** * Get precision of column. - * @note Only applicable for builtin type Decimal + * @note Only applicable for decimal types */ int getPrecision() const; /** * Set scale of column. - * @note Only applicable for builtin type Decimal + * @note Only applicable for decimal types */ void setScale(int); /** * Get scale of column. - * @note Only applicable for builtin type Decimal + * @note Only applicable for decimal types */ int getScale() const; diff --git a/ndb/include/util/NdbSqlUtil.hpp b/ndb/include/util/NdbSqlUtil.hpp index 3787814052a..5b27bd4e0c4 100644 --- a/ndb/include/util/NdbSqlUtil.hpp +++ b/ndb/include/util/NdbSqlUtil.hpp @@ -75,7 +75,7 @@ public: Bigunsigned, // 64 Bit Float, // 32-bit float Double, // 64-bit float - Decimal, // Precision, Scale + Olddecimal, // Precision, Scale Char, // Len Varchar, // Max len Binary, // Len @@ -86,7 +86,8 @@ public: Text, // Text blob Time = 25, // Time without date Year = 26, // Year (size 1 byte) - Timestamp = 27 // Unix seconds (uint32) + Timestamp = 27, // Unix seconds (uint32) + Olddecimalunsigned = 28 }; Enum m_typeId; Cmp* m_cmp; // comparison method @@ -109,6 +110,11 @@ public: static bool usable_in_hash_index(Uint32 typeId, const void* cs); static bool usable_in_ordered_index(Uint32 typeId, const void* cs); + /** + * Compare decimal numbers. + */ + static int cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n); + private: /** * List of all types. Must match Type::Enum. @@ -129,7 +135,7 @@ private: static Cmp cmpBigunsigned; static Cmp cmpFloat; static Cmp cmpDouble; - static Cmp cmpDecimal; + static Cmp cmpOlddecimal; static Cmp cmpChar; static Cmp cmpVarchar; static Cmp cmpBinary; @@ -141,6 +147,7 @@ private: static Cmp cmpTime; static Cmp cmpYear; static Cmp cmpTimestamp; + static Cmp cmpOlddecimalunsigned; }; #endif diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp index 53fa5d69215..c4114ad5ffa 100644 --- a/ndb/src/common/util/NdbSqlUtil.cpp +++ b/ndb/src/common/util/NdbSqlUtil.cpp @@ -76,117 +76,121 @@ NdbSqlUtil::char_like(const char* s1, unsigned n1, const NdbSqlUtil::Type NdbSqlUtil::m_typeList[] = { - { + { // 0 Type::Undefined, NULL }, - { + { // 1 Type::Tinyint, cmpTinyint }, - { + { // 2 Type::Tinyunsigned, cmpTinyunsigned }, - { + { // 3 Type::Smallint, cmpSmallint }, - { + { // 4 Type::Smallunsigned, cmpSmallunsigned }, - { + { // 5 Type::Mediumint, cmpMediumint }, - { + { // 6 Type::Mediumunsigned, cmpMediumunsigned }, - { + { // 7 Type::Int, cmpInt }, - { + { // 8 Type::Unsigned, cmpUnsigned }, - { + { // 9 Type::Bigint, cmpBigint }, - { + { // 10 Type::Bigunsigned, cmpBigunsigned }, - { + { // 11 Type::Float, cmpFloat }, - { + { // 12 Type::Double, cmpDouble }, - { - Type::Decimal, - NULL // cmpDecimal + { // 13 + Type::Olddecimal, + cmpOlddecimal }, - { + { // 14 Type::Char, cmpChar }, - { + { // 15 Type::Varchar, cmpVarchar }, - { + { // 16 Type::Binary, cmpBinary }, - { + { // 17 Type::Varbinary, cmpVarbinary }, - { + { // 18 Type::Datetime, cmpDatetime }, - { + { // 19 Type::Date, cmpDate }, - { + { // 20 Type::Blob, cmpBlob }, - { + { // 21 Type::Text, cmpText }, - { + { // 22 Type::Undefined, // 5.0 Bit NULL }, - { + { // 23 Type::Undefined, // 5.0 Longvarchar NULL }, - { + { // 24 Type::Undefined, // 5.0 Longvarbinary NULL }, - { + { // 25 Type::Time, cmpTime }, - { + { // 26 Type::Year, cmpYear }, - { + { // 27 Type::Timestamp, cmpTimestamp + }, + { // 28 + Type::Olddecimalunsigned, + cmpOlddecimalunsigned } }; @@ -411,12 +415,54 @@ NdbSqlUtil::cmpDouble(const void* info, const Uint32* p1, const Uint32* p2, Uint } int -NdbSqlUtil::cmpDecimal(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size) +NdbSqlUtil::cmp_olddecimal(const uchar* s1, const uchar* s2, unsigned n) +{ + int sgn = +1; + unsigned i = 0; + while (i < n) { + int c1 = s1[i]; + int c2 = s2[i]; + if (c1 == c2) { + if (c1 == '-') + sgn = -1; + } else if (c1 == '-') { + return -1; + } else if (c2 == '-') { + return +1; + } else if (c1 < c2) { + return -1 * sgn; + } else { + return +1 * sgn; + } + i++; + } + return 0; +} + +int +NdbSqlUtil::cmpOlddecimal(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size) { assert(full >= size && size > 0); - // not used by MySQL or NDB - assert(false); - return 0; + if (full == size) { + union { const Uint32* p; const uchar* v; } u1, u2; + u1.p = p1; + u2.p = p2; + return cmp_olddecimal(u1.v, u2.v, full << 2); + } + return CmpUnknown; +} + +int +NdbSqlUtil::cmpOlddecimalunsigned(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size) +{ + assert(full >= size && size > 0); + if (full == size) { + union { const Uint32* p; const uchar* v; } u1, u2; + u1.p = p1; + u2.p = p2; + return cmp_olddecimal(u1.v, u2.v, full << 2); + } + return CmpUnknown; } int diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp index 58b35c6c306..00db5704949 100644 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ b/ndb/src/ndbapi/NdbDictionary.cpp @@ -918,8 +918,11 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) case NdbDictionary::Column::Double: out << "Double"; break; - case NdbDictionary::Column::Decimal: - out << "Decimal(" << col.getScale() << "," << col.getPrecision() << ")"; + case NdbDictionary::Column::Olddecimal: + out << "Olddecimal(" << col.getPrecision() << "," << col.getScale() << ")"; + break; + case NdbDictionary::Column::Olddecimalunsigned: + out << "Olddecimalunsigned(" << col.getPrecision() << "," << col.getScale() << ")"; break; case NdbDictionary::Column::Char: out << "Char(" << col.getLength() << ";" << csname << ")"; diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 530f15d3a2e..b9ae13a93ec 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -114,7 +114,8 @@ NdbColumnImpl::init(Type t) m_length = 1; m_cs = NULL; break; - case Decimal: + case Olddecimal: + case Olddecimalunsigned: m_precision = 10; m_scale = 0; m_length = 1; @@ -1176,7 +1177,8 @@ columnTypeMapping[] = { { DictTabInfo::ExtBigunsigned, NdbDictionary::Column::Bigunsigned }, { DictTabInfo::ExtFloat, NdbDictionary::Column::Float }, { DictTabInfo::ExtDouble, NdbDictionary::Column::Double }, - { DictTabInfo::ExtDecimal, NdbDictionary::Column::Decimal }, + { DictTabInfo::ExtOlddecimal, NdbDictionary::Column::Olddecimal }, + { DictTabInfo::ExtOlddecimalunsigned, NdbDictionary::Column::Olddecimalunsigned }, { DictTabInfo::ExtChar, NdbDictionary::Column::Char }, { DictTabInfo::ExtVarchar, NdbDictionary::Column::Varchar }, { DictTabInfo::ExtBinary, NdbDictionary::Column::Binary }, diff --git a/ndb/src/ndbapi/NdbRecAttr.cpp b/ndb/src/ndbapi/NdbRecAttr.cpp index 9c9a9cea8da..db83e9c5fcf 100644 --- a/ndb/src/ndbapi/NdbRecAttr.cpp +++ b/ndb/src/ndbapi/NdbRecAttr.cpp @@ -156,7 +156,8 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) return out; } - uint length = r.getColumn()->getLength(); + const NdbDictionary::Column* c = r.getColumn(); + uint length = c->getLength(); if (length > 1) out << "["; @@ -208,6 +209,18 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r) case NdbDictionary::Column::Double: out << r.double_value(); break; + case NdbDictionary::Column::Olddecimal: + { + short len = 1 + c->getPrecision() + (c->getScale() > 0); + out.print("%.*s", len, r.aRef()); + } + break; + case NdbDictionary::Column::Olddecimalunsigned: + { + short len = 0 + c->getPrecision() + (c->getScale() > 0); + out.print("%.*s", len, r.aRef()); + } + break; // for dates cut-and-paste from field.cc case NdbDictionary::Column::Datetime: { diff --git a/ndb/test/include/NdbSchemaOp.hpp b/ndb/test/include/NdbSchemaOp.hpp index 77e704c0e5c..e8ab542b00a 100644 --- a/ndb/test/include/NdbSchemaOp.hpp +++ b/ndb/test/include/NdbSchemaOp.hpp @@ -567,7 +567,8 @@ convertColumnTypeToAttrType(NdbDictionary::Column::Type _type) case NdbDictionary::Column::Unsigned: return UnSigned; case NdbDictionary::Column::Float: - case NdbDictionary::Column::Decimal: + case NdbDictionary::Column::Olddecimal: + case NdbDictionary::Column::Olddecimalunsigned: case NdbDictionary::Column::Double: return Float; case NdbDictionary::Column::Char: diff --git a/ndb/tools/restore/consumer.cpp b/ndb/tools/restore/consumer.cpp index 4d228230423..ecbdbbf8f4e 100644 --- a/ndb/tools/restore/consumer.cpp +++ b/ndb/tools/restore/consumer.cpp @@ -44,9 +44,12 @@ BackupConsumer::create_table_string(const TableS & table, case NdbDictionary::Column::Float: pos += sprintf(buf+pos, "%s", "float"); break; - case NdbDictionary::Column::Decimal: + case NdbDictionary::Column::Olddecimal: pos += sprintf(buf+pos, "%s", "decimal"); break; + case NdbDictionary::Column::Olddecimalunsigned: + pos += sprintf(buf+pos, "%s", "decimal unsigned"); + break; case NdbDictionary::Column::Char: pos += sprintf(buf+pos, "%s", "char"); break; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 9e34baae198..47cca937544 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -2276,10 +2276,14 @@ void ha_ndbcluster::print_results() fprintf(DBUG_FILE, "Double\t%f", value); break; } - case NdbDictionary::Column::Decimal: { + case NdbDictionary::Column::Olddecimal: { char *value= field->ptr; - - fprintf(DBUG_FILE, "Decimal\t'%-*s'", field->pack_length(), value); + fprintf(DBUG_FILE, "Olddecimal\t'%-*s'", field->pack_length(), value); + break; + } + case NdbDictionary::Column::Olddecimalunsigned: { + char *value= field->ptr; + fprintf(DBUG_FILE, "Olddecimalunsigned\t'%-*s'", field->pack_length(), value); break; } case NdbDictionary::Column::Char:{ @@ -3312,10 +3316,6 @@ static int create_ndb_column(NDBCOL &col, const enum enum_field_types mysql_type= field->real_type(); switch (mysql_type) { // Numeric types - case MYSQL_TYPE_DECIMAL: - col.setType(NDBCOL::Char); - col.setLength(field->pack_length()); - break; case MYSQL_TYPE_TINY: if (field->flags & UNSIGNED_FLAG) col.setType(NDBCOL::Tinyunsigned); @@ -3359,6 +3359,26 @@ static int create_ndb_column(NDBCOL &col, col.setType(NDBCOL::Double); col.setLength(1); break; + case MYSQL_TYPE_DECIMAL: + { + Field_decimal *f= (Field_decimal*)field; + uint precision= f->pack_length(); + uint scale= f->decimals(); + if (field->flags & UNSIGNED_FLAG) + { + col.setType(NDBCOL::Olddecimalunsigned); + precision-= (scale > 0); + } + else + { + col.setType(NDBCOL::Olddecimal); + precision-= 1 + (scale > 0); + } + col.setPrecision(precision); + col.setScale(scale); + col.setLength(1); + } + break; // Date types case MYSQL_TYPE_DATETIME: col.setType(NDBCOL::Datetime); From eab44eaaca1f0f7cb1b88cc979591fa21cbed78f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 16:05:18 +0000 Subject: [PATCH 22/32] Bug#4445 Make a more informative platform info for Windows --- include/config-win.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/include/config-win.h b/include/config-win.h index 152e85c8e68..42aa23c3afe 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -23,18 +23,25 @@ #include #include -#if defined(__NT__) -#define SYSTEM_TYPE "NT" -#elif defined(__WIN2000__) -#define SYSTEM_TYPE "WIN2000" +#if defined(_WIN64) || defined(WIN64) +#define SYSTEM_TYPE "Win64" +#elif defined(_WIN32) || defined(WIN32) +#define SYSTEM_TYPE "Win32" #else -#define SYSTEM_TYPE "Win95/Win98" +#define SYSTEM_TYPE "Windows" #endif -#if defined(_WIN64) || defined(WIN64) -#define MACHINE_TYPE "ia64" /* Define to machine type name */ +#if defined(_M_IA64) +#define MACHINE_TYPE "ia64" +#elif defined(_M_IX86) +#define MACHINE_TYPE "ia32" +#elif defined(_M_ALPHA) +#define MACHINE_TYPE "axp" #else -#define MACHINE_TYPE "i32" /* Define to machine type name */ +#define MACHINE_TYPE "unknown" /* Define to machine type name */ +#endif + +#if !(defined(_WIN64) || defined(WIN64)) #ifndef _WIN32 #define _WIN32 /* Compatible with old source */ #endif From 2eb2383ed022ec8ec591f4dde9565b7415f11351 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 20:46:34 +0100 Subject: [PATCH 23/32] reuse nodeid if ndbd is restarted mysql-test/mysql-test-run.pl: start and exit fix for ndbcluster --- mysql-test/mysql-test-run.pl | 6 +++++- ndb/include/mgmapi/mgmapi.h | 1 + ndb/include/mgmcommon/ConfigRetriever.hpp | 2 ++ ndb/src/common/mgmcommon/ConfigRetriever.cpp | 6 ++++++ ndb/src/kernel/vm/Configuration.cpp | 9 +++++++++ ndb/src/mgmapi/mgmapi.cpp | 9 +++++++++ 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index f204fee50ed..ec163529ffb 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -358,6 +358,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"); @@ -1054,7 +1058,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; } 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 @@ -1720,6 +1720,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) From 600e432143664fb90593b934123a538070a8f8a3 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 21:54:35 +0100 Subject: [PATCH 24/32] bug #8556 corrupt ndb_mgm show printout for certain configurations --- ndb/src/mgmclient/CommandInterpreter.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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){ - ndbout_c("Unable to find node with id: %d", node_id); - return; + 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); } - 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; } } } From 7770f8f9614b9d0950e0f9f1da3fb4500fb3f29a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 14:03:16 -0800 Subject: [PATCH 25/32] Make post-commit trigger not send emails when the message would not contain any actual changes. (Often the case in merges where the only change involves renumbering ChangeSet entries.) BitKeeper/triggers/post-commit: Suppress emails when there's no changes actually reported --- BitKeeper/triggers/post-commit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit index a38b1f5a068..d2a4f9153b2 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'` From 3f808996794b5ed83f646fd08946a5499bbb665c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2005 02:59:39 +0100 Subject: [PATCH 26/32] Windows compatibility changes of the 'rpl_delete_all', 'ps_1general' and 'fulltext_cache' test cases. mysql-test/r/fulltext_cache.result: To pass on Windows, round to less digits mysql-test/t/fulltext_cache.test: To pass on Windows, round to less digits mysql-test/t/ps_1general.test: To pass on Windows, change \\ to / in result mysql-test/t/rpl_delete_all.test: To pass on Windows, change \\ to / in result mysql-test/mysql-test-run.pl: Pass mysqld --console to catch output on Windows mysql-test/lib/mtr_process.pl: Check error from exec() to avoid becoming a fork() bomb --- mysql-test/lib/mtr_process.pl | 33 ++++++++++++++++++++++----- mysql-test/mysql-test-run.pl | 2 ++ mysql-test/r/fulltext_cache.result | 36 +++++++++++++++--------------- mysql-test/t/fulltext_cache.test | 4 ++-- mysql-test/t/ps_1general.test | 1 + mysql-test/t/rpl_delete_all.test | 2 +- 6 files changed, 52 insertions(+), 26 deletions(-) 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/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index ed67e316bef..07216f0afe3 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1261,6 +1261,7 @@ sub install_db ($$) { 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); @@ -1604,6 +1605,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); 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/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/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; From 000255ee9d24eeb9f6cc29f0d4e3e92fe0ac8caa Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2005 05:22:14 +0100 Subject: [PATCH 27/32] init_db.sql: Make SQL more readable, substitute hostname at runtime mysql-test-run.pl: Run init scripts with /bin/sh, ignore return code mysql-test/mysql-test-run.pl: Run init scripts with /bin/sh, ignore return code mysql-test/lib/init_db.sql: Make SQL more readable, substitute hostname at runtime --- mysql-test/lib/init_db.sql | 468 +++++++++++++++++++++++++++++++++-- mysql-test/mysql-test-run.pl | 22 +- 2 files changed, 452 insertions(+), 38 deletions(-) diff --git a/mysql-test/lib/init_db.sql b/mysql-test/lib/init_db.sql index 54591e9b9ff..cc44165405f 100644 --- a/mysql-test/lib/init_db.sql +++ b/mysql-test/lib/init_db.sql @@ -1,56 +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 ('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 ('g4%' ,'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); +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 ('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 ('g4%',''); +INSERT INTO user (host,user) VALUES ('@HOSTNAME@%',''); -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 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 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 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 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 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 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_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'; -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); +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 (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'; +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 (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 ( + 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'; + -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); +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_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_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'; -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_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/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 07216f0afe3..d70c207b035 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1251,7 +1251,7 @@ sub install_db ($$) { } else { - print OUT $_; + print OUT "$_ "; } } close OUT; @@ -1520,8 +1520,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..... @@ -1542,18 +1542,18 @@ sub do_before_start_master ($$) { 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 ) + 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; + my $tname= shift; + my $init_script= shift; # Remove stale binary logs and old master.info files # except for too tests which need them @@ -1570,10 +1570,10 @@ sub do_before_start_slave ($$) { } # Run slave initialization shell script if one exists - if ( $slave_init_script and - mtr_run($slave_init_script, [], "", "", "", "") != 0 ) + if ( $init_script ) { - mtr_error("Can't run $slave_init_script"); + # We ignore the return code + mtr_run("/bin/sh", ["-c",$init_script], "", "", "", ""); } `rm -f $glob_mysql_test_dir/var/slave-data/log.*`; From 7f905da3d835307b8bc0ab8df864486e3c2e1c18 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 21:17:20 -0800 Subject: [PATCH 28/32] select.result, select.test: Added a test case for bug #7098. sql_select.cc: Fixed bug #7098. When a string field was substituted for an equal constant the collation of the constant was changed by mistake for the binary collation. sql/sql_select.cc: Fixed bug #7098. When a string field was substituted for an equal constant the collation of the constant was changed by mistake for the binary collation. mysql-test/t/select.test: Added a test case for bug #7098. mysql-test/r/select.result: Added a test case for bug #7098. --- mysql-test/r/select.result | 22 ++++++++++++++++++++++ mysql-test/t/select.test | 19 +++++++++++++++++++ sql/sql_select.cc | 4 ++++ 3 files changed, 45 insertions(+) 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/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/sql/sql_select.cc b/sql/sql_select.cc index 05314097ca3..21e197d432b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4230,6 +4230,8 @@ change_cond_ref_to_const(THD *thd, I_List *save_list, Item *tmp=value->new_item(); if (tmp) { + tmp->collation.set(value->collation.collation, + value->collation.derivation); thd->change_item_tree(args + 1, tmp); func->update_used_tables(); if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC) @@ -4251,6 +4253,8 @@ change_cond_ref_to_const(THD *thd, I_List *save_list, Item *tmp=value->new_item(); if (tmp) { + tmp->collation.set(value->collation.collation, + value->collation.derivation); thd->change_item_tree(args, tmp); value= tmp; func->update_used_tables(); From 41c0945096fe6f6074e7a994e6784432d60211f1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Feb 2005 22:51:32 -0800 Subject: [PATCH 29/32] item.h: Revised the fix for bug #7098. Corrected the method Item_string::new_item. sql_select.cc: Revised the fix for bug #7098. Aborted the previous modifications. sql/sql_select.cc: Revised the fix for bug #7098. Aborted the previous modifications. sql/item.h: Revised the fix for bug #7098. Corrected the method Item_string::new_item. --- sql/item.h | 2 +- sql/sql_select.cc | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) 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/sql_select.cc b/sql/sql_select.cc index 21e197d432b..05314097ca3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -4230,8 +4230,6 @@ change_cond_ref_to_const(THD *thd, I_List *save_list, Item *tmp=value->new_item(); if (tmp) { - tmp->collation.set(value->collation.collation, - value->collation.derivation); thd->change_item_tree(args + 1, tmp); func->update_used_tables(); if ((functype == Item_func::EQ_FUNC || functype == Item_func::EQUAL_FUNC) @@ -4253,8 +4251,6 @@ change_cond_ref_to_const(THD *thd, I_List *save_list, Item *tmp=value->new_item(); if (tmp) { - tmp->collation.set(value->collation.collation, - value->collation.derivation); thd->change_item_tree(args, tmp); value= tmp; func->update_used_tables(); From a20f2382876fdd0e36a24b666025aeaf166412d8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2005 02:57:40 -0600 Subject: [PATCH 30/32] Do-hpux-depot: Perl script to create HP depot packages. --- Build-tools/Do-hpux-depot | 85 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 Build-tools/Do-hpux-depot 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 2005 +# +# This script generates HP Depot packages for MySQL Server. +# It basically repackages a binary tarball as a depot. +# +# Usage: ./Do-hpux-depot +# + +$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 < $fullname.depot.gz\" -x target_type=tape -s ${pwd}/${fullname}.psf"); + From 6889864bbb09c2461013057133691fe2df6a88dc Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2005 11:07:33 +0100 Subject: [PATCH 31/32] - fixed a changelog entry in the RPM spec file (wrong author) support-files/mysql.spec.sh: - fixed a changelog entry (wrong author) --- support-files/mysql.spec.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 1829daeab5b..07c8e6a46fb 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -695,7 +695,7 @@ fi # itself - note that they must be ordered by date (important when # merging BK trees) %changelog -* Mon Feb 14 2005 Tomas Ulin +* Mon Feb 14 2005 Lenz Grimmer * Fixed the compilation comments and moved them into the separate build sections for Max and Standard From 23f786b0ad106282387de0e0d82fec4f30037008 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 17 Feb 2005 15:04:04 +0400 Subject: [PATCH 32/32] bug#6958 Fixed that negative arguments to certain integer options wrap around. mysql-test/r/variables.result: Added a test case for bug#6958. mysql-test/t/variables.test: Added a test case for bug#6958. sql/set_var.cc: sys_var_long_ptr::check function was added. sql/set_var.h: Use sys_var_long_ptr::check function for sys_var_long_ptr class. --- mysql-test/r/variables.result | 5 +++++ mysql-test/t/variables.test | 8 ++++++++ sql/set_var.cc | 6 ++++++ sql/set_var.h | 1 + 4 files changed, 20 insertions(+) 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/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/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; }