diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/innodb_fts/r | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/innodb_fts/r')
39 files changed, 10500 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb_fts/r/basic.result b/mysql-test/suite/innodb_fts/r/basic.result new file mode 100644 index 00000000..a8ab0c04 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/basic.result @@ -0,0 +1,313 @@ +CREATE TEMPORARY TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ANALYZE TABLE articles; +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +2 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +2 +SELECT id, body, MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score +FROM articles; +id body score +1 DBMS stands for DataBase ... 0.22764469683170319 +2 After you went through a ... 0 +3 In this tutorial we will show ... 0 +4 1. Never run mysqld as root. 2. ... 0 +5 In the following database comparison ... 0.22764469683170319 +6 When configured properly, MySQL ... 0 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('t*' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MY*' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('ru*' IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +6 +INSERT INTO articles (title,body) VALUES +('test query expansion','for database ...'); +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('test' WITH QUERY EXPANSION); +id title body +7 test query expansion for database ... +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@3' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@2' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following database"' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +INSERT INTO articles (title,body) VALUES +('test proximity search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO articles (title,body) VALUES +('test my proximity fts new search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO articles (title,body) VALUES +('test more of proximity fts search, test, more proximity and phrase', +'search, with proximity innodb'); +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@1' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"' IN BOOLEAN MODE); +id title body +drop table articles; +# +# Bug #22679185 INVALID INNODB FTS DOC ID DURING INSERT +# +create table t1 (f1 int not null primary key, f2 varchar(100), +FTS_DOC_ID bigint(20) unsigned not null, +unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`), +fulltext key (f2))engine=innodb; +insert into t1 values(1, "This is the first record", 20000); +insert into t1 values(2, "This is the second record", 40000); +select FTS_DOC_ID from t1; +FTS_DOC_ID +20000 +40000 +drop table t1; +create table t1 (f1 int not null primary key, f2 varchar(100), +FTS_DOC_ID bigint(20) unsigned not null auto_increment, +unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`), +fulltext key (f2))engine=innodb; +set auto_increment_increment = 65535; +insert into t1(f1, f2) values(1, "This is the first record"); +insert into t1(f1, f2) values(2, "This is the second record"); +insert into t1(f1, f2) values(3, "This is the third record"); +select FTS_DOC_ID from t1; +FTS_DOC_ID +1 +65536 +131071 +drop table t1; +CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), FULLTEXT(title)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL, NULL), (20030101000000, 20030102000000); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/bug_32831765.result b/mysql-test/suite/innodb_fts/r/bug_32831765.result new file mode 100644 index 00000000..1d6ea187 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/bug_32831765.result @@ -0,0 +1,132 @@ +call mtr.add_suppression("InnoDB: Total InnoDB FTS size .* for the table .* exceeds the innodb_ft_cache_size .*"); +# +# Bug#32831765 SERVER HITS OOM CONDITION WHEN LOADING TWO +# INNODB TABLES WITH FTS INDEXES +# +create table t1 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text, +`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07` +text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text, +`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18` +text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text, +`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29` +text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY +(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY +(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY +(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY +(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY +(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY +(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY +(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY +(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY +(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY +(`col29`), FULLTEXT KEY (`col30`)) engine=innodb; +create table t2 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text, +`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07` +text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text, +`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18` +text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text, +`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29` +text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY +(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY +(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY +(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY +(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY +(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY +(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY +(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY +(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY +(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY +(`col29`), FULLTEXT KEY (`col30`)) engine=innodb; +create table t3 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text, +`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07` +text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text, +`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18` +text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text, +`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29` +text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY +(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY +(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY +(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY +(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY +(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY +(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY +(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY +(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY +(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY +(`col29`), FULLTEXT KEY (`col30`)) engine=innodb; +create table t4 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text, +`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07` +text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text, +`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18` +text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text, +`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29` +text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY +(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY +(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY +(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY +(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY +(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY +(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY +(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY +(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY +(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY +(`col29`), FULLTEXT KEY (`col30`)) engine=innodb; +#create procedure to inset into the table. +CREATE PROCEDURE `proc_insert`(IN tab_name VARCHAR(40)) +BEGIN +DECLARE i INT DEFAULT 1; +SET @insert_tbl =CONCAT('INSERT INTO ', tab_name, '( `col01`, `col02`, + `col03`, `col04`, `col05`, `col06`, `col07`, `col08`, `col09`, `col10`, + `col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`, + `col19`, `col20`, `col21`, `col22`, `col23`, `col24`, `col25`, `col26`, + `col27`, `col28`, `col29`, `col30`) + VALUES ( MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), + MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), + MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), + MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), + MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), + MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), + MD5(RAND()))'); +PREPARE ins_stmt FROM @insert_tbl; +while (i <= 2000) DO +EXECUTE ins_stmt; +SET i = i + 1; +END WHILE; +DEALLOCATE PREPARE ins_stmt; +END | +SET @save_dbug= @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug="+d,fts_optimize_wq_count_check"; +connect con1,localhost,root,,; +call proc_insert('t1'); +connect con2,localhost,root,,; +call proc_insert('t1'); +connect con3,localhost,root,,; +call proc_insert('t2'); +connect con4,localhost,root,,; +call proc_insert('t2'); +connect con5,localhost,root,,; +call proc_insert('t3'); +connect con6,localhost,root,,; +call proc_insert('t3'); +connect con7,localhost,root,,; +call proc_insert('t4'); +connection default; +call proc_insert('t4'); +SET GLOBAL debug_dbug= @save_dbug; +connection con1; +disconnect con1; +connection con2; +disconnect con2; +connection con3; +disconnect con3; +connection con4; +disconnect con4; +connection con5; +disconnect con5; +connection con6; +disconnect con6; +connection con7; +disconnect con7; +connection default; +DROP TABLE t1,t2,t3,t4; +DROP PROCEDURE proc_insert; diff --git a/mysql-test/suite/innodb_fts/r/concurrent_insert.result b/mysql-test/suite/innodb_fts/r/concurrent_insert.result new file mode 100644 index 00000000..bc47511b --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/concurrent_insert.result @@ -0,0 +1,63 @@ +CREATE TABLE t1(a VARCHAR(5),FULLTEXT KEY(a)) ENGINE=InnoDB; +SET DEBUG_SYNC = 'get_next_FTS_DOC_ID SIGNAL prepared WAIT_FOR race'; +REPLACE INTO t1(a) values('aaa'); +connect dml, localhost, root, ,; +SET DEBUG_SYNC = 'now WAIT_FOR prepared'; +REPLACE INTO t1(a) VALUES('aaa'); +SET DEBUG_SYNC = 'now SIGNAL race'; +disconnect dml; +connection default; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +# +# MDEV-19529 InnoDB hang on DROP FULLTEXT INDEX +# +CREATE TABLE t1(f1 CHAR(100), FULLTEXT(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES('test'); +CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB; +INSERT INTO t2 VALUES('mariadb'); +connection default; +SET @saved_dbug = @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang'; +SET DEBUG_SYNC= 'fts_instrument_sync_request + SIGNAL drop_index_start WAIT_FOR sync_op'; +INSERT INTO t1 VALUES('Keyword'); +connect con1,localhost,root,,,; +SET DEBUG_SYNC='now WAIT_FOR drop_index_start'; +SET DEBUG_SYNC= 'norebuild_fts_drop SIGNAL sync_op WAIT_FOR fts_drop_index'; +ALTER TABLE t2 drop index idx1; +connection default; +set DEBUG_SYNC= 'now SIGNAL fts_drop_index'; +connection con1; +drop table t1, t2; +connection default; +SET @@GLOBAL.debug_dbug = @saved_dbug; +disconnect con1; +# +# MDEV-25984 Assertion `max_doc_id > 0' failed in fts_init_doc_id() +# +call mtr.add_suppression("InnoDB: \\(Lock wait timeout\\) while getting next doc id for table `test`.`t1`"); +CREATE TABLE t1(f1 CHAR(100), f2 INT, fulltext(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES("mariadb", 1), ("innodb", 1); +# restart +SET DEBUG_SYNC='innodb_rollback_after_fts_lock SIGNAL insert_dml WAIT_FOR ddl_continue'; +ALTER TABLE t1 ADD UNIQUE INDEX(f2); +connect con1,localhost,root,,,; +SET DEBUG_SYNC='now WAIT_FOR insert_dml'; +SET DEBUG_SYNC='fts_cmp_set_sync_doc_id_retry SIGNAL ddl_continue WAIT_FOR dml_finish'; +INSERT INTO t1 VALUES("index", 2); +connection default; +ERROR 23000: Duplicate entry '1' for key 'f2' +SET DEBUG_SYNC="now SIGNAL dml_finish"; +connection con1; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` char(100) DEFAULT NULL, + `f2` int(11) DEFAULT NULL, + FULLTEXT KEY `f1` (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +connection default; +disconnect con1; +DROP TABLE t1; +set DEBUG_SYNC=RESET; diff --git a/mysql-test/suite/innodb_fts/r/crash_recovery.result b/mysql-test/suite/innodb_fts/r/crash_recovery.result new file mode 100644 index 00000000..c6fc9dfa --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/crash_recovery.result @@ -0,0 +1,171 @@ +FLUSH TABLES; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +DROP INDEX title ON articles; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +BEGIN; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'); +# Make durable the AUTO_INCREMENT in the above incomplete transaction. +connect ddl1, localhost, root,,; +CREATE TABLE t1(a TEXT,b TEXT,FULLTEXT INDEX(a)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FULLTEXT INDEX(b); +connection default; +connect ddl2, localhost, root,,; +CREATE TABLE t2(a TEXT,b TEXT,FULLTEXT INDEX(a)) ENGINE=InnoDB; +ALTER TABLE t2 DROP INDEX a, ADD FULLTEXT INDEX(b), FORCE; +connection default; +connect ddl3, localhost, root,,; +CREATE TABLE t3(a TEXT,b TEXT,FULLTEXT INDEX(a)) ENGINE=InnoDB; +ALTER TABLE t3 DROP INDEX a, ADD FULLTEXT INDEX(b), ALGORITHM=COPY; +connection default; +# restart +disconnect ddl1; +disconnect ddl2; +disconnect ddl3; +InnoDB 0 transactions not purged +CHECK TABLE t1,t2,t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +DROP TABLE t1,t2,t3; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'); +CREATE FULLTEXT INDEX idx ON articles (title,body); +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +8 MySQL Tutorial DBMS stands for DataBase ... +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +connect dml, localhost, root,,; +BEGIN; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'); +connection default; +# Make durable the AUTO_INCREMENT in the above incomplete transaction. +connect flush_redo_log,localhost,root,,; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +SET SQL_MODE = NO_AUTO_VALUE_ON_ZERO; +BEGIN; +UPDATE articles SET id=0 WHERE id=1; +UPDATE articles SET id=1 WHERE id=0; +COMMIT; +disconnect flush_redo_log; +connection default; +# restart +disconnect dml; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'); +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +8 MySQL Tutorial DBMS stands for DataBase ... +9 MySQL Tutorial DBMS stands for DataBase ... +13 MySQL vs. YourSQL In the following database comparison ... +16 MySQL Tutorial DBMS stands for DataBase ... +DROP TABLE articles; +CREATE TABLE articles ( +id int PRIMARY KEY, +FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx1 on articles (title, body); +INSERT INTO articles VALUES +(1, 10, 'MySQL Tutorial','DBMS stands for DataBase ...') , +(2, 1, 'How To Use MySQL Well','After you went through a ...'), +(3, 2, 'Optimizing MySQL','In this tutorial we will show ...'), +(4, 11, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +(5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'), +(7, 4, 'MySQL Security','When configured properly, MySQL ...'); +connect dml, localhost, root,,; +BEGIN; +INSERT INTO articles VALUES +(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...'); +connect dml2, localhost, root,,; +# +# MDEV-19073 FTS row mismatch after crash recovery +# +CREATE TABLE mdev19073(id SERIAL, title VARCHAR(200), body TEXT, +FULLTEXT(title,body)) ENGINE=InnoDB; +INSERT INTO mdev19073 (title, body) VALUES +('MySQL Tutorial', 'DBMS stands for Database...'); +CREATE FULLTEXT INDEX idx ON mdev19073(title, body); +CREATE TABLE mdev19073_2 LIKE mdev19073; +INSERT INTO mdev19073_2 (title, body) VALUES +('MySQL Tutorial', 'DBMS stands for Database...'); +INSERT INTO mdev19073 (title, body) VALUES +('MariaDB Tutorial', 'DB means Database ...'); +INSERT INTO mdev19073_2 (title, body) VALUES +('MariaDB Tutorial', 'DB means Database ...'); +SELECT * FROM mdev19073 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +SELECT * FROM mdev19073_2 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +connection default; +# restart +disconnect dml; +disconnect dml2; +INSERT INTO articles VALUES (8, 12, 'MySQL Tutorial','DBMS stands for DataBase ...'); +SELECT * FROM articles WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id FTS_DOC_ID title body +3 2 Optimizing MySQL In this tutorial we will show ... +1 10 MySQL Tutorial DBMS stands for DataBase ... +8 12 MySQL Tutorial DBMS stands for DataBase ... +DROP TABLE articles; +SELECT * FROM mdev19073 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +SELECT * FROM mdev19073_2 WHERE MATCH (title, body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for Database... +2 MariaDB Tutorial DB means Database ... +DROP TABLE mdev19073, mdev19073_2; +# +# MDEV-28706 Redundant InnoDB table fails during alter +# +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( +col_int INTEGER, col_text TEXT, +col_text_1 TEXT +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +INSERT INTO t1 VALUES ( 1255, "mariadb", "InnoDB"); +# restart +ALTER TABLE t1 ADD FULLTEXT(col_text_1); +DROP TABLE t1; +SELECT * FROM information_schema.innodb_sys_tables WHERE name LIKE 'test/%'; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE diff --git a/mysql-test/suite/innodb_fts/r/create.result b/mysql-test/suite/innodb_fts/r/create.result new file mode 100644 index 00000000..4334344a --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/create.result @@ -0,0 +1,213 @@ +SET NAMES utf8mb4; +# +# MDEV-11233 CREATE FULLTEXT INDEX with a token +# longer than 127 bytes crashes server +# +CREATE TABLE t(t TEXT CHARACTER SET utf8mb3) ENGINE=InnoDB; +INSERT INTO t SET t=REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5); +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); +INSERT INTO t SET t=REPEAT('befor',17); +INSERT INTO t SET t='BeforeTheIndexCreation'; +CREATE FULLTEXT INDEX ft ON t(t); +INSERT INTO t SET t='this was inserted after creating the index'; +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); +INSERT INTO t SET t=REPEAT('after',17); +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); +# The data below is not 3-byte UTF-8, but 4-byte chars. +INSERT IGNORE INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x96\x95\xF0\x9F...' for column `test`.`t`.`t` at row 1 +INSERT IGNORE INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); +Warnings: +Warning 1366 Incorrect string value: '\xF0\x9F\x96\x96\xF0\x9F...' for column `test`.`t`.`t` at row 1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST +(REPEAT(CONCAT(REPEAT(_utf8mb3 0xE0B987, 4), REPEAT(_utf8mb3 0xE0B989, 5)), 5)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); +COUNT(*) +0 +SELECT * FROM t; +t +็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้ +ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ +beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor +BeforeTheIndexCreation +this was inserted after creating the index +111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter +甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文 +???????????????????????????????????????????????????????????????????????????????????? +????????????????????????????????????????????????????????????????????????????????????? +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +len COUNT(*) +252 6 +DROP TABLE t; +CREATE TABLE t(t TEXT CHARACTER SET utf8mb4) ENGINE=InnoDB; +INSERT INTO t SET t=REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15); +INSERT INTO t SET t=REPEAT(_utf8 0xefbc90,84); +INSERT INTO t SET t=REPEAT('befor',17); +INSERT INTO t SET t='BeforeTheIndexCreation'; +CREATE FULLTEXT INDEX ft ON t(t); +INSERT INTO t SET t='this was inserted after creating the index'; +INSERT INTO t SET t=REPEAT(_utf8 0xefbc91,84); +INSERT INTO t SET t=REPEAT('after',17); +INSERT INTO t SET t=REPEAT(concat(repeat(_utf8mb3 0xE0B987, 4), repeat(_utf8mb3 0xE0B989, 5)), 5); +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9695, 84); +# The token below exceeds the 84-character limit. +INSERT INTO t SET t=REPEAT(_utf8mb4 0xf09f9696, 85); +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb3 0xe794b2e9aaa8e69687, 15)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('BeforeTheIndexCreation'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('befor',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST ('after'); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT('after',17)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc90, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 84)); +COUNT(*) +1 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8 0xefbc91, 85)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 83)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9695, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 84)); +COUNT(*) +0 +SELECT COUNT(*) FROM t WHERE MATCH t AGAINST (REPEAT(_utf8mb4 0xf09f9696, 85)); +COUNT(*) +0 +SELECT * FROM t; +t +甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文甲骨文 +ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ +beforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbeforbefor +BeforeTheIndexCreation +this was inserted after creating the index +111111111111111111111111111111111111111111111111111111111111111111111111111111111111 +afterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafterafter +็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้็็็็้้้้้ +🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕🖕 +🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖🖖 +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +len COUNT(*) +336 6 +DROP TABLE t; +CREATE TABLE t(t TEXT CHARACTER SET latin1, FULLTEXT INDEX(t)) +ENGINE=InnoDB; +SELECT len,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS where name='word' GROUP BY len; +len COUNT(*) +84 6 +DROP TABLE t; +# +# MDEV-17923 Assertion memcmp(field, field_ref_zero, 7) failed in +# trx_undo_page_report_modify upon optimizing table +# under innodb_optimize_fulltext_only +# +CREATE TABLE t1 (f1 TEXT, f2 TEXT, FULLTEXT KEY (f2)) ENGINE=InnoDB; +INSERT INTO t1 (f1) VALUES ('foo'),('bar'); +DELETE FROM t1 LIMIT 1; +ALTER TABLE t1 ADD FULLTEXT KEY (f1); +SET @optimize_fulltext.save= @@innodb_optimize_fulltext_only; +SET GLOBAL innodb_optimize_fulltext_only= 1; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +DROP TABLE t1; +SET GLOBAL innodb_optimize_fulltext_only= @optimize_fulltext.save; +# +# MDEV-24403 Segfault on CREATE TABLE with explicit FTS_DOC_ID_INDEX by multiple fields +# +create table t1 ( +f1 int, f2 text, +FTS_DOC_ID bigint unsigned not null, +unique key FTS_DOC_ID_INDEX(FTS_DOC_ID, f1), +fulltext (f2)) +engine=innodb; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +# +# MDEV-26938 Support descending indexes internally in InnoDB +# +CREATE TABLE t1(a INT PRIMARY KEY, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID DESC), FULLTEXT(b)) +ENGINE=InnoDB; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +CREATE TABLE t1(a INT PRIMARY KEY, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +UNIQUE KEY FTS_DOC_ID_INDEX(FTS_DOC_ID DESC)) ENGINE=InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` text DEFAULT NULL, + `FTS_DOC_ID` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`a`), + UNIQUE KEY `FTS_DOC_ID_INDEX` (`FTS_DOC_ID` DESC) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE t1 ADD FULLTEXT INDEX(b), ALGORITHM=INPLACE; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +ALTER TABLE t1 ADD FULLTEXT INDEX(b), ALGORITHM=COPY; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result b/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result new file mode 100644 index 00000000..2dbdd5a0 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/ft_result_cache_limit.result @@ -0,0 +1,39 @@ +# +# Bug 1634932: Assertion failure in thread x in +# file fts0que.cc +# +SET @saved_innodb_ft_result_cache_limit= @@global.innodb_ft_result_cache_limit; +CREATE TABLE `t1` ( +`FTS_DOC_ID` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, +`text_content` MEDIUMTEXT, PRIMARY KEY (`FTS_DOC_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE UNIQUE INDEX FTS_DOC_ID_INDEX ON t1(FTS_DOC_ID); +SET autocommit=0; +CREATE PROCEDURE populate_t1() +BEGIN +DECLARE i INT DEFAULT 1; +WHILE (i <= 250) DO +INSERT INTO t1 (text_content) VALUES ("some_text_1234 aaa"); +SET i = i + 1; +END WHILE; +END// +CALL populate_t1; +SET autocommit=1; +SET SESSION debug="+d,fts_instrument_result_cache_limit"; +Warnings: +Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead +ALTER TABLE t1 ADD FULLTEXT INDEX `text_content_idx` (`text_content`); +SELECT FTS_DOC_ID, text_content +FROM t1 +WHERE MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +UPDATE t1 +SET text_content='some_text_12345' +where MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +DELETE FROM t1 +WHERE MATCH text_content AGAINST ('+some_text_1234' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SET GLOBAL innodb_ft_result_cache_limit = @saved_innodb_ft_result_cache_limit; +DROP TABLE t1; +DROP PROCEDURE populate_t1; diff --git a/mysql-test/suite/innodb_fts/r/fts_kill_query.result b/mysql-test/suite/innodb_fts/r/fts_kill_query.result new file mode 100644 index 00000000..53ad9b3a --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fts_kill_query.result @@ -0,0 +1,9 @@ +CREATE TABLE t1 (a VARCHAR(7), b text, FULLTEXT KEY idx (a,b)) ENGINE=InnoDB; +COMMIT; +SELECT COUNT(*) FROM t1 +WHERE MATCH (a,b) AGAINST ('foo bar' IN BOOLEAN MODE); +connect con1,localhost,root,,; +KILL QUERY @id; +disconnect con1; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result new file mode 100644 index 00000000..32dc87da --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -0,0 +1,786 @@ +CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), +('Full-text indexes', 'are called collections'), +('Only MyISAM tables','support collections'), +('Function MATCH ... AGAINST()','is used to do a search'), +('Full-text search in MySQL', 'implements vector space model'); +ANALYZE TABLE t1; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t1 1 a 1 a NULL NULL NULL NULL YES FULLTEXT NO +t1 1 a 2 b NULL NULL NULL NULL YES FULLTEXT NO +select * from t1 where MATCH(a,b) AGAINST ("collections"); +a b +Full-text indexes are called collections +Only MyISAM tables support collections +explain extended select * from t1 where MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 fulltext a a 0 1 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections')) +select * from t1 where MATCH(a,b) AGAINST ("indexes"); +a b +Full-text indexes are called collections +select * from t1 where MATCH(a,b) AGAINST ("indexes collections"); +a b +Full-text indexes are called collections +Only MyISAM tables support collections +select * from t1 where MATCH(a,b) AGAINST ("only"); +a b +Only MyISAM tables support collections +select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION); +a b +Only MyISAM tables support collections +Full-text indexes are called collections +MySQL has now support for full-text search +Full-text search in MySQL implements vector space model +select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION); +a b +Full-text indexes are called collections +Only MyISAM tables support collections +MySQL has now support for full-text search +Full-text search in MySQL implements vector space model +select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION); +a b +Only MyISAM tables support collections +Full-text indexes are called collections +MySQL has now support for full-text search +Full-text search in MySQL implements vector space model +select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE); +a b +Full-text indexes are called collections +select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION); +a b +Full-text indexes are called collections +Only MyISAM tables support collections +MySQL has now support for full-text search +Full-text search in MySQL implements vector space model +select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WITH QUERY EXPANSION)' at line 1 +explain select * from t1 where MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE); +a b +MySQL has now support for full-text search +explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 fulltext a a 0 1 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('support -collections' in boolean mode)) +select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE); +a b +Only MyISAM tables support collections +MySQL has now support for full-text search +Full-text indexes are called collections +select * from t1 where MATCH(a,b) AGAINST("support +collections" IN BOOLEAN MODE); +a b +Only MyISAM tables support collections +Full-text indexes are called collections +select * from t1 where MATCH(a,b) AGAINST("sear*" IN BOOLEAN MODE); +a b +MySQL has now support for full-text search +Function MATCH ... AGAINST() is used to do a search +Full-text search in MySQL implements vector space model +select * from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +a b +Only MyISAM tables support collections +select * from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +a b +MySQL has now support for full-text search +Function MATCH ... AGAINST() is used to do a search +Full-text search in MySQL implements vector space model +select * from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +a b +Full-text search in MySQL implements vector space model +MySQL has now support for full-text search +select * from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +a b +Function MATCH ... AGAINST() is used to do a search +select *, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1; +a b x +MySQL has now support for full-text search 0.15835624933242798 +Full-text indexes are called collections 0.15835624933242798 +Only MyISAM tables support collections 0.31671249866485596 +Function MATCH ... AGAINST() is used to do a search 0 +Full-text search in MySQL implements vector space model 0 +select *, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1; +a b x +MySQL has now support for full-text search 0.15835624933242798 +Full-text indexes are called collections 0.15835624933242798 +Only MyISAM tables support collections 0.31671249866485596 +Function MATCH ... AGAINST() is used to do a search 0 +Full-text search in MySQL implements vector space model 0 +select * from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE); +a b +Full-text indexes are called collections +select * from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE); +a b +select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE); +a b +MySQL has now support for full-text search +select * from t1 where MATCH a,b AGAINST ('"now support"' IN BOOLEAN MODE); +a b +MySQL has now support for full-text search +select * from t1 where MATCH a,b AGAINST ('"text search" "now support"' IN BOOLEAN MODE); +a b +MySQL has now support for full-text search +Full-text search in MySQL implements vector space model +select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE); +a b +Full-text search in MySQL implements vector space model +select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE); +a b +MySQL has now support for full-text search +select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE); +a b +select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE); +a b +Full-text indexes are called collections +select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE); +a b +select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE); +a b +select * from t1 where MATCH a,b AGAINST ('+collections -supp* -foobar*' IN BOOLEAN MODE); +a b +Full-text indexes are called collections +select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE); +a b +Full-text search in MySQL implements vector space model +delete from t1 where a like "MySQL%"; +update t1 set a='some test foobar' where MATCH a,b AGAINST ('model'); +delete from t1 where MATCH(a,b) AGAINST ("indexes"); +select * from t1; +a b +Only MyISAM tables support collections +Function MATCH ... AGAINST() is used to do a search +some test foobar implements vector space model +drop table t1; +create table t1 (a varchar(200) not null, fulltext (a)) engine = innodb; +insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10"); +select * from t1 where match a against ("+aaa* +bbb*" in boolean mode); +a +aaa10 bbb20 +aaa20 bbb15 +aaa30 bbb10 +select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode); +a +aaa20 bbb15 +aaa30 bbb10 +select * from t1 where match a against ("+aaa* +ccc*" in boolean mode); +a +select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode); +a +aaa10 bbb20 +select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode); +a +aaa20 bbb15 +aaa30 bbb10 +select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode); +a +aaa20 bbb15 +aaa30 bbb10 +drop table t1; +CREATE TABLE t1 ( +id int(11), +ticket int(11), +KEY ti (id), +KEY tit (ticket) +) ENGINE = InnoDB; +INSERT INTO t1 VALUES (2,3),(1,2); +CREATE TABLE t2 ( +ticket int(11), +inhalt text, +KEY tig (ticket), +fulltext index tix (inhalt) +) ENGINE = InnoDB; +INSERT INTO t2 VALUES (1,'foo'),(2,'bar'),(3,'foobar'); +INSERT INTO t1 VALUES (3,3); +ANALYZE TABLE t1; +ANALYZE TABLE t2; +select ticket2.id FROM t2 as ttxt,t2 +INNER JOIN t1 as ticket2 ON ticket2.id = t2.ticket +WHERE ticket2.id = ticket2.ticket and +match(ttxt.inhalt) against ('foobar'); +id +3 +show keys from t2; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored +t2 1 tig 1 ticket A 3 NULL NULL YES BTREE NO +t2 1 tix 1 inhalt NULL NULL NULL NULL YES FULLTEXT NO +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `ticket` int(11) DEFAULT NULL, + `inhalt` text DEFAULT NULL, + KEY `tig` (`ticket`), + FULLTEXT KEY `tix` (`inhalt`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +select * from t2 where MATCH inhalt AGAINST (NULL); +ticket inhalt +select * from t2 where MATCH inhalt AGAINST ('foobar'); +ticket inhalt +3 foobar +select * from t2 having MATCH inhalt AGAINST ('foobar'); +ticket inhalt +3 foobar +CREATE TABLE t3 (t int(11),i text,fulltext tix (t,i)); +ERROR HY000: Column 't' cannot be part of FULLTEXT index +CREATE TABLE t3 (t int(11),i text, +j varchar(200) CHARACTER SET latin2, +fulltext tix (i,j)); +ERROR HY000: Column 'j' cannot be part of FULLTEXT index +CREATE TABLE t3 ( +ticket int(11), +inhalt text, +KEY tig (ticket), +fulltext index tix (inhalt) +) ENGINE = InnoDB; +select * from t2 where MATCH inhalt AGAINST (t2.inhalt); +ERROR HY000: Incorrect arguments to AGAINST +select * from t2 where MATCH ticket AGAINST ('foobar'); +ERROR HY000: Can't find FULLTEXT index matching the column list +select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar'); +ERROR HY000: Incorrect arguments to MATCH +drop table t1,t2,t3; +CREATE TABLE t1 ( +id int(11) auto_increment, +title varchar(100) default '', +PRIMARY KEY (id), +KEY ind5 (title) +) ENGINE = InnoDB; +CREATE FULLTEXT INDEX ft1 ON t1(title); +insert into t1 (title) values ('this is a test'); +select * from t1 where match title against ('test' in boolean mode); +id title +1 this is a test +update t1 set title='this is A test' where id=1; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +update t1 set title='this test once revealed a bug' where id=1; +select * from t1; +id title +1 this test once revealed a bug +update t1 set title=NULL where id=1; +drop table t1; +CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE = InnoDB; +insert into t1 values (1,"I wonder why the fulltext index doesnt work?"); +SELECT * from t1 where MATCH (b) AGAINST ('apples'); +a b +insert into t1 values (2,"fullaaa fullzzz"); +select * from t1 where match b against ('full*' in boolean mode); +a b +1 I wonder why the fulltext index doesnt work? +2 fullaaa fullzzz +drop table t1; +CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial'); +select 8 from t1; +8 +8 +8 +8 +8 +drop table t1; +create table t1 (a text, fulltext key (a)) ENGINE = InnoDB; +insert into t1 values ('aaaa'); +select * from t1 where match (a) against ('aaaa'); +a +aaaa +drop table t1; +create table t1 ( ref_mag text not null, fulltext (ref_mag)) ENGINE = InnoDB; +insert into t1 values ('test'); +select ref_mag from t1 where match ref_mag against ('+test' in boolean mode); +ref_mag +test +alter table t1 change ref_mag ref_mag char (255) not null; +select ref_mag from t1 where match ref_mag against ('+test' in boolean mode); +ref_mag +test +drop table t1; +create table t1 (t1_id int(11) primary key, name varchar(32)) ENGINE = InnoDB; +insert into t1 values (1, 'data1'); +insert into t1 values (2, 'data2'); +create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)) ENGINE = InnoDB; +insert into t2 values (1, 1, 'xxfoo'); +insert into t2 values (2, 1, 'xxbar'); +insert into t2 values (3, 1, 'xxbuz'); +select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); +ERROR HY000: Incorrect arguments to MATCH +select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode); +ERROR HY000: Can't find FULLTEXT index matching the column list +drop table t1,t2; +create table t1 (a text, fulltext key (a)) ENGINE = InnoDB; +insert into t1 select "xxxx yyyy zzzz"; +drop table t1; +SET NAMES latin1; +CREATE TABLE t1 (t text character set utf8 not null, fulltext(t)) ENGINE = InnoDB; +INSERT t1 VALUES ('Mit freundlichem Grüß'), ('aus Osnabrück'); +SET NAMES koi8r; +INSERT t1 VALUES ("üÔÏ ÍÙ - ÏÐÉÌËÉ"),("ïÔÌÅÚØ, ÇÎÉÄÁ!"), +("îÅ ×ÌÅÚÁÊ, ÕÂØÅÔ!"),("É ÂÕÄÅÔ ÐÒÁ×!"); +SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('ïðéìëé'); +t collation(t) +üÔÏ ÍÙ - ÏÐÉÌËÉ utf8mb3_general_ci +DROP TABLE t1; +CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) ENGINE = InnoDB DEFAULT CHARSET=utf8; +insert into t1 (s) values ('pära para para'),('para para para'); +select * from t1 where match(s) against('para' in boolean mode); +s +para para para +pära para para +select * from t1 where match(s) against('par*' in boolean mode); +s +para para para +pära para para +DROP TABLE t1; +CREATE TABLE t1 (h text, FULLTEXT (h)) ENGINE = InnoDB; +INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing'); +select count(*) from t1; +count(*) +1 +drop table t1; +CREATE TABLE t1 ( a TEXT, FULLTEXT (a) ) ENGINE = InnoDB; +INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance'); +SELECT MATCH(a) AGAINST ('nosuchword') FROM t1; +MATCH(a) AGAINST ('nosuchword') +0 +DROP TABLE t1; +create table t1 (a int primary key, b text, fulltext(b)) ENGINE = InnoDB; +create table t2 (a int, b text) ENGINE = InnoDB; +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)) ENGINE = InnoDB; +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; +CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +INSERT INTO t1 VALUES('testword\'\''); +SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE); +a +testword'' +SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE); +a +testword'' +INSERT INTO t1 VALUES('test\'s'); +SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE); +a +test's +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a)) ENGINE = InnoDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10000) DEFAULT NULL, + FULLTEXT KEY `a` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('test'),('test1'),('test'); +ANALYZE TABLE t1; +PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')"; +EXECUTE stmt; +a FORMAT(MATCH(a) AGAINST('test1 test'),6) +test1 0.227645 +test 0.031008 +test 0.031008 +EXECUTE stmt; +a FORMAT(MATCH(a) AGAINST('test1 test'),6) +test1 0.227645 +test 0.031008 +test 0.031008 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(255), FULLTEXT(a)) ENGINE = InnoDB; +SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test'); +a +SELECT * FROM t1 WHERE MATCH(a) AGAINST('test'); +a +DROP TABLE t1; +CREATE TABLE t1(a TEXT, fulltext(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES(' aaaaa aaaa'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE); +a + aaaaa aaaa +DROP TABLE t1; +CREATE TABLE t1(a VARCHAR(20), FULLTEXT(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('Offside'),('City Of God'); +SELECT a FROM t1 WHERE MATCH a AGAINST ('+city of*' IN BOOLEAN MODE); +a +City Of God +SELECT a FROM t1 WHERE MATCH a AGAINST ('+city (of*)' IN BOOLEAN MODE); +a +Offside +City Of God +SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE); +a +City Of God +DROP TABLE t1; +create table t1(a text,b date,fulltext index(a)) ENGINE = InnoDB; +insert into t1 set a='water',b='2008-08-04'; +select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01'; +1 +1 +drop table t1; +show warnings; +Level Code Message +CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1), +('test', 1),('test', 2),('test', 3),('test', 4); +ANALYZE TABLE t1; +EXPLAIN SELECT * FROM t1 +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext b,a a 0 1 Using where +EXPLAIN SELECT * FROM t1 USE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +EXPLAIN SELECT * FROM t1 FORCE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +ERROR HY000: Can't find FULLTEXT index matching the column list +EXPLAIN SELECT * FROM t1 USE INDEX(b) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +ERROR HY000: Can't find FULLTEXT index matching the column list +EXPLAIN SELECT * FROM t1 FORCE INDEX(b) +WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE t1; +CREATE TABLE t1(a CHAR(10), fulltext(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('aaa15'); +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1; +MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) +0.000000001885928302414186 +SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1; +MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) +0.000000003771856604828372 +DROP TABLE t1; +CREATE TABLE t1(a TEXT) ENGINE = InnoDB; +SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE); +ERROR HY000: Incorrect arguments to MATCH +DROP TABLE t1; +CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE); +a +awrd bwrd cwrd +awrd bwrd cwrd +awrd bwrd cwrd +DROP TABLE t1; +CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col)) ENGINE = InnoDB; +PREPARE s FROM +"SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')" + ; +EXECUTE s; +MATCH (col) AGAINST('findme') +DEALLOCATE PREPARE s; +DROP TABLE t1; +# +# Bug #49250 : spatial btree index corruption and crash +# Part two : fulltext syntax check +# +CREATE TABLE t1(col1 TEXT, +FULLTEXT INDEX USING BTREE (col1)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1))' at line 2 +CREATE TABLE t2(col1 TEXT) ENGINE = InnoDB; +CREATE FULLTEXT INDEX USING BTREE ON t2(col); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1 +ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1)' at line 1 +DROP TABLE t2; +End of 5.0 tests +# +# Bug #47930: MATCH IN BOOLEAN MODE returns too many results +# inside subquery +# +CREATE TABLE t1 (a int) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1), (2); +CREATE TABLE t2 (a int, b2 char(10), FULLTEXT KEY b2 (b2)) ENGINE = InnoDB; +INSERT INTO t2 VALUES (1,'Scargill'); +CREATE TABLE t3 (a int, b int) ENGINE = InnoDB; +INSERT INTO t3 VALUES (1,1), (2,1); +# t2 should use full text index +EXPLAIN +SELECT count(*) FROM t1 WHERE +not exists( +SELECT 1 FROM t2, t3 +WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 MATERIALIZED t2 fulltext b2 b2 0 1 Using where +2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 Using where +# should return 0 +SELECT count(*) FROM t1 WHERE +not exists( +SELECT 1 FROM t2, t3 +WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) +); +count(*) +0 +SELECT count(*) FROM t1 WHERE +not exists( +SELECT 1 FROM t2 IGNORE INDEX (b2), t3 +WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE) +); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE t1,t2,t3; +CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'), +('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'), +('awrd'); +SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE); +COUNT(*) +0 +DROP TABLE t1; +# +# Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with +# fulltext search and row op +# +CREATE TABLE t1(a CHAR(1),FULLTEXT(a)) ENGINE = InnoDB; +SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1); +1 +DROP TABLE t1; +# +# BUG#51866 - crash with repair by sort and fulltext keys +# +CREATE TABLE t1(a CHAR(4), FULLTEXT(a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES('aaaa'); +DROP TABLE t1; +# +# Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine +# +CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1)) ENGINE = InnoDB; +INSERT INTO t1 VALUES ('test'); +SELECT 1 FROM t1 WHERE 1 > +ALL((SELECT 1 FROM t1 JOIN t1 a +ON (MATCH(t1.f1) against ("")) +WHERE t1.f1 GROUP BY t1.f1)) xor f1; +1 +1 +PREPARE stmt FROM +'SELECT 1 FROM t1 WHERE 1 > + ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a + ON (MATCH(t1.f1) against ("")) + WHERE t1.f1 GROUP BY t1.f1)) xor f1'; +EXECUTE stmt; +1 +1 +EXECUTE stmt; +1 +1 +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM +'SELECT 1 FROM t1 WHERE 1 > + ALL((SELECT 1 FROM t1 JOIN t1 a + ON (MATCH(t1.f1) against ("")) + WHERE t1.f1 GROUP BY t1.f1))'; +EXECUTE stmt; +1 +1 +EXECUTE stmt; +1 +1 +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +End of 5.1 tests +CREATE TABLE z(a INTEGER) engine=innodb; +CREATE TABLE q(b TEXT CHARSET latin1, fulltext(b)) engine=innodb; +EXPLAIN SELECT 1 FROM q WHERE (SELECT MATCH(b) AGAINST ('*') FROM z); +ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' +SELECT 1 FROM q WHERE (SELECT MATCH(b) AGAINST ('*') FROM z); +ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' +EXPLAIN SELECT MATCH(b) AGAINST ('*') FROM z; +ERROR 42S22: Unknown column 'b' in 'field list' +SELECT MATCH(b) AGAINST ('*') FROM z; +ERROR 42S22: Unknown column 'b' in 'field list' +EXPLAIN SELECT MATCH(a) AGAINST ('*') FROM z; +ERROR HY000: Can't find FULLTEXT index matching the column list +SELECT MATCH(a) AGAINST ('*') FROM z; +ERROR HY000: Can't find FULLTEXT index matching the column list +EXPLAIN SELECT MATCH(b) AGAINST ('*') FROM q; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE q ALL NULL NULL NULL NULL 1 +SELECT MATCH(b) AGAINST ('*') FROM q; +ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' +DROP TABLE z, q; +create table t ( +FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY, t TEXT, FULLTEXT KEY (t) +) ENGINE=InnoDB; +INSERT INTO t values (1, 'foo bar'), (2, 'foo bar'), (3, 'foo'); +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 0; +FTS_DOC_ID t +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 1; +FTS_DOC_ID t +1 foo bar +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 2; +FTS_DOC_ID t +1 foo bar +2 foo bar +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 3; +FTS_DOC_ID t +1 foo bar +2 foo bar +3 foo +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 4; +FTS_DOC_ID t +1 foo bar +2 foo bar +3 foo +SELECT * FROM t WHERE MATCH(t) AGAINST ('foo bar' IN BOOLEAN MODE) +LIMIT 5; +FTS_DOC_ID t +1 foo bar +2 foo bar +3 foo +DROP TABLE t; +# +# MDEV-25295 Aborted FTS_DOC_ID_INDEX considered as +# existing FTS_DOC_ID_INDEX during DDL +# +SET sql_mode=''; +CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL,title CHAR(1),body TEXT)engine=innodb; +INSERT INTO t1 (FTS_DOC_ID,title,body)VALUES(1,0,0), (1,0,0); +CREATE FULLTEXT INDEX idx1 ON t1 (title,body); +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +CREATE FULLTEXT INDEX idx1 ON t1 (title,body); +ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +DROP TABLE t1; +SET sql_mode = DEFAULT; +# +# MDEV-25070 SIGSEGV in fts_create_in_mem_aux_table +# +CREATE TABLE t1 (a CHAR, FULLTEXT KEY(a)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t1 ADD FULLTEXT INDEX (a); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(1) DEFAULT NULL, + FULLTEXT KEY `a` (`a`), + FULLTEXT KEY `a_2` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT +# +SET @save = @@global.innodb_file_per_table; +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( +col_int INTEGER, col_text TEXT, +col_int_g INTEGER GENERATED ALWAYS AS (col_int) +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +ALTER TABLE t1 DROP KEY `ftidx` ; +INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); +DROP TABLE t1; +SET @@global.innodb_file_per_table = @save; +# +# MDEV-20797 FULLTEXT search with apostrophe, +# and mandatory words +# +CREATE TABLE t1(f1 TINYTEXT NOT NULL, FULLTEXT(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES('O''Brien'), ('O Brien'), ('Ö''Brien'); +INSERT INTO t1 VALUES('Brien'), ('O ''Brien'), ('O'' Brien'); +INSERT INTO t1 VALUES('Doh''nuts'); +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+O'Brien" IN BOOLEAN MODE); +f1 +O'Brien +O Brien +Ö'Brien +Brien +O 'Brien +O' Brien +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+Doh'nuts" IN BOOLEAN MODE); +f1 +Doh'nuts +SELECT * FROM t1 WHERE MATCH (f1) AGAINST ("+Ö''Brien" IN BOOLEAN MODE); +f1 +O'Brien +O Brien +Ö'Brien +Brien +O 'Brien +O' Brien +DROP TABLE t1; +# +# MDEV-29058 Assertion `index->type == 32' failed +# in dict_index_build_internal_fts +# +call mtr.add_suppression("InnoDB: Index `f` of table `test`.`t2` is corrupted"); +call mtr.add_suppression("InnoDB: Skip adjustment of root pages for index `f`."); +CREATE TABLE t1 (f CHAR(8), FULLTEXT KEY (f)) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +ALTER TABLE t2 DISCARD TABLESPACE; +FLUSH TABLES t1 FOR EXPORT; +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t2 IMPORT TABLESPACE; +DROP TABLE t2, t1; +# +# MDEV-29778 Having Unique index interference with MATCH +# from a FULLTEXT +# +CREATE TABLE t1(f1 VARCHAR(100), FULLTEXT(f1), +UNIQUE INDEX(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES("test"); +SELECT f1, MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) FROM t1; +f1 MATCH(f1) AGAINST ("test" IN BOOLEAN MODE) +test 0.000000001885928302414186 +DROP TABLE t1; +# End of 10.3 tests diff --git a/mysql-test/suite/innodb_fts/r/fulltext2.result b/mysql-test/suite/innodb_fts/r/fulltext2.result new file mode 100644 index 00000000..10fee848 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext2.result @@ -0,0 +1,298 @@ +CREATE TABLE t1 ( +i int(10) unsigned not null auto_increment primary key, +a varchar(255) not null, +FULLTEXT KEY (a) +) ENGINE = INNODB; +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select count(*) from t1 where match a against ('aaaxxx'); +count(*) +260 +select count(*) from t1 where match a against ('aaayyy'); +count(*) +250 +select count(*) from t1 where match a against ('aaazzz'); +count(*) +255 +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +260 +select count(*) from t1 where match a against ('aaayyy' in boolean mode); +count(*) +250 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +255 +select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz'); +count(*) +765 +select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode); +count(*) +765 +select count(*) from t1 where match a against ('aaax*' in boolean mode); +count(*) +260 +select count(*) from t1 where match a against ('aaay*' in boolean mode); +count(*) +250 +select count(*) from t1 where match a against ('aaa*' in boolean mode); +count(*) +765 +insert t1 (a) values ('aaaxxx'),('aaayyy'); +insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'); +select count(*) from t1 where match a against ('aaaxxx'); +count(*) +261 +select count(*) from t1 where match a against ('aaayyy'); +count(*) +251 +select count(*) from t1 where match a against ('aaazzz'); +count(*) +260 +insert t1 (a) values ('aaaxxx 000000'); +select count(*) from t1 where match a against ('000000'); +count(*) +1 +delete from t1 where match a against ('000000'); +select count(*) from t1 where match a against ('000000'); +count(*) +0 +select count(*) from t1 where match a against ('aaaxxx'); +count(*) +261 +delete from t1 where match a against ('aaazzz'); +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +261 +select count(*) from t1 where match a against ('aaayyy' in boolean mode); +count(*) +251 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +0 +select count(*) from t1 where a = 'aaaxxx'; +count(*) +261 +select count(*) from t1 where a = 'aaayyy'; +count(*) +251 +select count(*) from t1 where a = 'aaazzz'; +count(*) +0 +insert t1 (a) values ('aaaxxx 000000'); +select count(*) from t1 where match a against ('000000'); +count(*) +1 +update t1 set a='aaazzz' where match a against ('000000'); +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +261 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +1 +update t1 set a='aaazzz' where a = 'aaaxxx'; +update t1 set a='aaaxxx' where a = 'aaayyy'; +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +251 +select count(*) from t1 where match a against ('aaayyy' in boolean mode); +count(*) +0 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +262 +drop table t1; +CREATE TABLE t1 ( +i int(10) unsigned not null auto_increment primary key, +a varchar(255) not null, +FULLTEXT KEY (a) +) ENGINE = INNODB; +select count(*) from t1 where match a against ('aaaxxx'); +count(*) +260 +select count(*) from t1 where match a against ('aaayyy'); +count(*) +250 +select count(*) from t1 where match a against ('aaazzz'); +count(*) +255 +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +260 +select count(*) from t1 where match a against ('aaayyy' in boolean mode); +count(*) +250 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +255 +select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz'); +count(*) +765 +select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode); +count(*) +765 +select count(*) from t1 where match a against ('aaax*' in boolean mode); +count(*) +260 +select count(*) from t1 where match a against ('aaay*' in boolean mode); +count(*) +250 +select count(*) from t1 where match a against ('aaa*' in boolean mode); +count(*) +765 +insert t1 (a) values ('aaaxxx'),('aaayyy'); +insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'); +select count(*) from t1 where match a against ('aaaxxx'); +count(*) +261 +select count(*) from t1 where match a against ('aaayyy'); +count(*) +251 +select count(*) from t1 where match a against ('aaazzz'); +count(*) +260 +insert t1 (a) values ('aaaxxx 000000'); +select count(*) from t1 where match a against ('000000'); +count(*) +1 +delete from t1 where match a against ('000000'); +select count(*) from t1 where match a against ('000000'); +count(*) +0 +select count(*) from t1 where match a against ('aaaxxx'); +count(*) +261 +delete from t1 where match a against ('aaazzz'); +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +261 +select count(*) from t1 where match a against ('aaayyy' in boolean mode); +count(*) +251 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +0 +select count(*) from t1 where a = 'aaaxxx'; +count(*) +261 +select count(*) from t1 where a = 'aaayyy'; +count(*) +251 +select count(*) from t1 where a = 'aaazzz'; +count(*) +0 +insert t1 (a) values ('aaaxxx 000000'); +select count(*) from t1 where match a against ('000000'); +count(*) +1 +update t1 set a='aaazzz' where match a against ('000000'); +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +261 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +1 +update t1 set a='aaazzz' where a = 'aaaxxx'; +update t1 set a='aaaxxx' where a = 'aaayyy'; +select count(*) from t1 where match a against ('aaaxxx' in boolean mode); +count(*) +251 +select count(*) from t1 where match a against ('aaayyy' in boolean mode); +count(*) +0 +select count(*) from t1 where match a against ('aaazzz' in boolean mode); +count(*) +262 +drop table t1; +set names utf8; +create table t1(a text,fulltext(a)) ENGINE = INNODB collate=utf8_swedish_ci; +insert into t1 values('test test '),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), +('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'); +delete from t1 limit 1; +truncate table t1; +insert into t1 values('ab c d'); +update t1 set a='ab c d'; +select * from t1 where match a against('ab c' in boolean mode); +a +select * from t1 where match a against('ab c' in boolean mode); +a +drop table t1; +set names latin1; +SET NAMES utf8; +CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE = INNODB DEFAULT CHARSET=utf8; +INSERT INTO t1 VALUES('„MySQL“'); +SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE); +a +„MySQL“ +DROP TABLE t1; +SET NAMES latin1; +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +id int(10) not null , +first_name varchar(50) NOT NULL, +last_name varchar(50) NOT NULL, +PRIMARY KEY (FTS_DOC_ID), +UNIQUE KEY idx_1 (first_name, last_name), +FULLTEXT KEY `idx_2` (first_name) +) ENGINE=InnoDB; +INSERT INTO t1 (id, first_name, last_name) VALUES +(10, 'Bart', 'Simpson'), +(11, 'Homer', 'Simpson'), +(12, 'Marge', 'Simpson'), +(13, 'Lisa', 'Simpson'), +(14, 'Maggie', 'Simpson'), +(15, 'Ned', 'Flanders'), +(16, 'Nelson', 'Muntz'); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SELECT fts_doc_id, first_name, last_name, MATCH(first_name) AGAINST('Homer' IN BOOLEAN MODE) AS score FROM t1; +fts_doc_id first_name last_name score +1 Bart Simpson 0 +2 Homer Simpson 0.7141907215118408 +4 Lisa Simpson 0 +5 Maggie Simpson 0 +3 Marge Simpson 0 +6 Ned Flanders 0 +7 Nelson Muntz 0 +DROP TABLE t1; +CREATE TABLE t1(a INT, b TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +KEY FTS_DOC_ID_INDEX(FTS_DOC_ID))ENGINE=InnoDB; +ALTER TABLE t1 ADD COLUMN c INT as (a) VIRTUAL; +ALTER TABLE t1 ADD d INT NULL; +ALTER TABLE t1 ADD FULLTEXT(b); +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE t1; +# +# MDEV-29169 Using MATCH returns NULL for Virtual Column +# +CREATE TABLE t (a TEXT DEFAULT NULL, +b TEXT AS (a), +c TEXT AS (concat(a, '1')), +d int AS (111) VIRTUAL, +FULLTEXT KEY `a` (`a`) +) ENGINE=InnoDB; +INSERT INTO t (a) VALUES ('test'); +SELECT * FROM t; +a b c d +test test test1 111 +SELECT * FROM t WHERE MATCH(a) AGAINST('test'); +a b c d +test test test1 111 +DROP TABLE t; diff --git a/mysql-test/suite/innodb_fts/r/fulltext3.result b/mysql-test/suite/innodb_fts/r/fulltext3.result new file mode 100644 index 00000000..8d89cb74 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext3.result @@ -0,0 +1,18 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(a VARCHAR(255) CHARACTER SET gbk, FULLTEXT(a)) ENGINE = InnoDB; +SET NAMES utf8; +DELETE FROM t1 LIMIT 1; +SET NAMES latin1; +DROP TABLE t1; +CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci, +FULLTEXT(a)) ENGINE=<default_engine>; +DROP TABLE t1; +CREATE TABLE t1 (a SERIAL, t TEXT, FULLTEXT f1(t), FULLTEXT f2(t)) ENGINE=InnoDB; +Warnings: +Note 1831 Duplicate index `f2`. This is deprecated and will be disallowed in a future release +INSERT INTO t1 (a,t) VALUES (1,'1'),(2,'1'); +ALTER TABLE t1 ADD COLUMN g TEXT GENERATED ALWAYS AS (t) VIRTUAL; +DELETE FROM t1 WHERE a = 1; +ALTER TABLE t1 DROP INDEX f1; +INSERT INTO t1 (a,t) VALUES (1,'1'); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_cache.result b/mysql-test/suite/innodb_fts/r/fulltext_cache.result new file mode 100644 index 00000000..6e00d993 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_cache.result @@ -0,0 +1,70 @@ +drop table if exists t1, t2; +CREATE TABLE t1 ( +id int(10) unsigned NOT NULL auto_increment, +q varchar(255) default NULL, +PRIMARY KEY (id) +) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,'aaaaaaaaa dsaass de'); +INSERT INTO t1 VALUES (2,'ssde df s fsda sad er'); +CREATE TABLE t2 ( +id int(10) unsigned NOT NULL auto_increment, +id2 int(10) unsigned default NULL, +item varchar(255) default NULL, +PRIMARY KEY (id), +FULLTEXT KEY item(item) +) ENGINE = InnoDB; +INSERT INTO t2 VALUES (1,1,'sushi'); +INSERT INTO t2 VALUES (2,1,'Bolo de Chocolate'); +INSERT INTO t2 VALUES (3,1,'Feijoada'); +INSERT INTO t2 VALUES (4,1,'Mousse de Chocolate'); +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'); +ANALYZE TABLE t1; +ANALYZE TABLE t2; +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 0.815572 +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 +aaaaaaaaa dsaass de sushi 1 0.8155715465545654 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0 +aaaaaaaaa dsaass de Feijoada 3 0 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0 +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'),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 0.815572 +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 +aaaaaaaaa dsaass de sushi 1 0.8155715465545654 +aaaaaaaaa dsaass de Bolo de Chocolate 2 0 +aaaaaaaaa dsaass de Feijoada 3 0 +aaaaaaaaa dsaass de Mousse de Chocolate 4 0 +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 +drop table t1, t2; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_distinct.result b/mysql-test/suite/innodb_fts/r/fulltext_distinct.result new file mode 100644 index 00000000..e660b55c --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_distinct.result @@ -0,0 +1,43 @@ +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 ( +id mediumint unsigned NOT NULL auto_increment, +tag char(6) NOT NULL default '', +value text NOT NULL default '', +PRIMARY KEY (id), +KEY kt(tag), +KEY kv(value(15)), +FULLTEXT KEY kvf(value) +) ENGINE = InnoDB; +CREATE TABLE t2 ( +id_t2 mediumint unsigned NOT NULL default '0', +id_t1 mediumint unsigned NOT NULL default '0', +field_number tinyint unsigned NOT NULL default '0', +PRIMARY KEY (id_t2,id_t1,field_number), +KEY id_t1(id_t1) +) ENGINE = InnoDB; +INSERT INTO t1 (tag,value) VALUES ('foo123','bar111'); +INSERT INTO t1 (tag,value) VALUES ('foo123','bar222'); +INSERT INTO t1 (tag,value) VALUES ('bar345','baz333 ar'); +INSERT INTO t2 VALUES (2231626,64280,0); +INSERT INTO t2 VALUES (2231626,64281,0); +INSERT INTO t2 VALUES (12346, 3, 1); +SELECT * FROM t1; +id tag value +1 foo123 bar111 +2 foo123 bar222 +3 bar345 baz333 ar +SELECT * FROM t2; +id_t2 id_t1 field_number +12346 3 1 +2231626 64280 0 +2231626 64281 0 +SELECT DISTINCT t2.id_t2 FROM t2, t1 +WHERE MATCH (t1.value) AGAINST ('baz333') AND t1.id = t2.id_t1; +id_t2 +12346 +SELECT DISTINCT t2.id_t2 FROM t2, t1 +WHERE MATCH (t1.value) AGAINST ('baz333' IN BOOLEAN MODE) +AND t1.id = t2.id_t1; +id_t2 +12346 +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_left_join.result b/mysql-test/suite/innodb_fts/r/fulltext_left_join.result new file mode 100644 index 00000000..fc8d29bb --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_left_join.result @@ -0,0 +1,102 @@ +drop table if exists t1, t2; +CREATE TABLE t1 ( +id VARCHAR(255) NOT NULL PRIMARY KEY, +sujet VARCHAR(255), +motsclefs TEXT, +texte MEDIUMTEXT, +FULLTEXT(sujet, motsclefs, texte) +) ENGINE = InnoDB; +INSERT INTO t1 VALUES('123','toto','essai','test'); +INSERT INTO t1 VALUES('456','droit','penal','lawyer'); +INSERT INTO t1 VALUES('789','aaaaa','bbbbb','cccccc'); +CREATE TABLE t2 ( +id VARCHAR(255) NOT NULL, +author VARCHAR(255) NOT NULL +) ENGINE = InnoDB; +INSERT INTO t2 VALUES('123', 'moi'); +INSERT INTO t2 VALUES('123', 'lui'); +INSERT INTO t2 VALUES('456', 'lui'); +ANALYZE TABLE t1; +ANALYZE TABLE t2; +select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) +from t1 left join t2 on t2.id=t1.id; +round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5) +0.00000 +0.00000 +0.22764 +0.00000 +select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) +from t1 left join t2 on t2.id=t1.id; +match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE) +0 +0 +0.22764469683170319 +0 +drop table t1, t2; +create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) ENGINE = InnoDB; +insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00'); +create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) engine= innodb; +insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3); +ANALYZE TABLE t1; +ANALYZE TABLE t2; +select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00'; +venue_id venue_text dt name entity_id +1 a1 2003-05-23 19:30:00 aberdeen town hall 1 +select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00'; +venue_id venue_text dt name entity_id +1 a1 2003-05-23 19:30:00 aberdeen town hall 1 +select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00'; +venue_id venue_text dt name entity_id +1 a1 2003-05-23 19:30:00 aberdeen town hall 1 +NULL a2 2003-05-23 19:30:00 NULL NULL +select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00'; +venue_id venue_text dt name entity_id +1 a1 2003-05-23 19:30:00 aberdeen town hall 1 +NULL a2 2003-05-23 19:30:00 NULL NULL +drop table t1,t2; +create table t1 (id int not null primary key, d char(200) not null, e char(200), fulltext (d, e)) ENGINE = InnoDB; +insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null); +ANALYZE TABLE t1; +select * from t1 where match(d, e) against ('+aword +bword' in boolean mode); +id d e +2 aword bword +4 bword aword +5 aword and bword NULL +create table t2 (m_id int not null, f char(200), key (m_id), fulltext (f)) engine = InnoDB; +insert into t2 values (1, 'bword'), (3, 'aword'), (5, ''); +ANALYZE TABLE t2; +select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode); +ERROR HY000: Incorrect arguments to MATCH +drop table t1,t2; +CREATE TABLE t1 ( +id int(10) NOT NULL auto_increment, +link int(10) default NULL, +name mediumtext default NULL, +PRIMARY KEY (id), +FULLTEXT (name) +) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1, 1, 'string'); +INSERT INTO t1 VALUES (2, 0, 'string'); +CREATE TABLE t2 ( +id int(10) NOT NULL auto_increment, +name mediumtext default NULL, +PRIMARY KEY (id), +FULLTEXT (name) +) ENGINE = InnoDB; +INSERT INTO t2 VALUES (1, 'string'); +ANALYZE TABLE t1; +ANALYZE TABLE t2; +SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance +FROM t1 LEFT JOIN t2 ON t1.link = t2.id +WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE); +ERROR HY000: Incorrect arguments to MATCH +DROP TABLE t1,t2; +CREATE TABLE t1 (a INT) ENGINE = InnoDB; +CREATE TABLE t2 (b INT, c TEXT, KEY(b), FULLTEXT(c)) ENGINE = InnoDB; +INSERT INTO t1 VALUES(1); +INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle'); +ANALYZE TABLE t1; +ANALYZE TABLE t2; +SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE); +a b c +DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_misc.result b/mysql-test/suite/innodb_fts/r/fulltext_misc.result new file mode 100644 index 00000000..69812ff8 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_misc.result @@ -0,0 +1,196 @@ +drop table if exists t1; +# +# Bug#56814 Explain + subselect + fulltext crashes server +# +CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,FULLTEXT KEY(f1),UNIQUE(f1)) ENGINE = InnoDB; +INSERT INTO t1 VALUES ('test'); +EXPLAIN SELECT 1 FROM t1 +WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST ("")) +WHERE t1.f1 GROUP BY t1.f1)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL f1_2 8 NULL 1 Using index +2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +2 SUBQUERY a index NULL f1_2 8 NULL 1 Using index +PREPARE stmt FROM +'EXPLAIN SELECT 1 FROM t1 + WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a + ON (MATCH(t1.f1) AGAINST ("")) + WHERE t1.f1 GROUP BY t1.f1))'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL f1_2 8 NULL 1 Using index +2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +2 SUBQUERY a index NULL f1_2 8 NULL 1 Using index +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL f1_2 8 NULL 1 Using index +2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +2 SUBQUERY a index NULL f1_2 8 NULL 1 Using index +DEALLOCATE PREPARE stmt; +PREPARE stmt FROM +'EXPLAIN SELECT 1 FROM t1 + WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a + ON (MATCH(t1.f1) AGAINST ("")) + WHERE t1.f1 GROUP BY t1.f1))'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL f1_2 8 NULL 1 Using index +2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +2 SUBQUERY a index NULL f1_2 8 NULL 1 Using index +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL f1_2 8 NULL 1 Using index +2 SUBQUERY t1 fulltext f1_2,f1 f1 0 1 Using where +2 SUBQUERY a index NULL f1_2 8 NULL 1 Using index +DEALLOCATE PREPARE stmt; +DROP TABLE t1; +drop table if exists t1; +CREATE TABLE t1 ( +kodoboru varchar(10) default NULL, +obor tinytext, +aobor tinytext, +UNIQUE INDEX kodoboru (kodoboru), +FULLTEXT KEY obor (obor), +FULLTEXT KEY aobor (aobor) +) ENGINE = InnoDB; +drop table t1; +CREATE TABLE t1 ( +kodoboru varchar(10) default NULL, +obor tinytext, +aobor tinytext, +UNIQUE INDEX kodoboru (kodoboru), +FULLTEXT KEY obor (obor) +) ENGINE = InnoDB; +INSERT INTO t1 VALUES ('0101000000','aaa','AAA'); +INSERT INTO t1 VALUES ('0102000000','bbb','BBB'); +INSERT INTO t1 VALUES ('0103000000','ccc','CCC'); +INSERT INTO t1 VALUES ('0104000000','xxx','XXX'); +select * from t1; +kodoboru obor aobor +0101000000 aaa AAA +0102000000 bbb BBB +0103000000 ccc CCC +0104000000 xxx XXX +drop table t1; +create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int, +c7 int, c8 int, c9 int, fulltext key (`c1`)) ENGINE = InnoDB; +select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8 +from t1 where c9=1 order by c2, c2; +match (`c1`) against ('z') c2 c3 c4 c5 c6 c7 c8 +drop table t1; +CREATE TABLE t1 (c1 int not null auto_increment primary key, c2 varchar(20), fulltext(c2)) ENGINE = InnoDB; +insert into t1 (c2) VALUES ('real Beer'),('Water'),('Kossu'),('Coca-Cola'),('Vodka'),('Wine'),('almost real Beer'); +select * from t1 WHERE match (c2) against ('Beer'); +c1 c2 +1 real Beer +7 almost real Beer +CREATE VIEW v1 AS SELECT * from t1 WHERE match (c2) against ('Beer'); +select * from v1; +c1 c2 +1 real Beer +7 almost real Beer +drop view v1; +drop table t1; +create table t1 (mytext text, FULLTEXT (mytext)) ENGINE = InnoDB; +insert t1 values ('aaabbb'); +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; +create table t1 (a varchar(10), fulltext key(a)) ENGINE = InnoDB; +insert into t1 values ('a'); +select hex(concat(match (a) against ('a'))) from t1; +hex(concat(match (a) against ('a'))) +30 +create table t2 ENGINE = InnoDB as select concat(match (a) against ('a')) as a from t1; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` varchar(23) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +drop table t1, t2; +CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci) ENGINE = InnoDB; +INSERT INTO t1 VALUES('abcd'); +SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE t1; +create table t1 (a varchar(10), key(a), fulltext (a)) ENGINE = InnoDB; +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +select * from t1 where a like "abc%"; +a +abc +abcd +select * from t1 where a like "test%"; +a +test +select * from t1 where a like "te_t"; +a +test +select * from t1 where match a against ("te*" in boolean mode); +a +test +drop table t1; +# +# Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY +# <any non-const-function> +# +CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a)) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE = InnoDB; +INSERT INTO t2 VALUES (1),(2); +# Should not crash +EXPLAIN EXTENDED +SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by `a` + 12 +# Should not crash +SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12; +a +1 +2 +# Should not crash +EXPLAIN EXTENDED +SELECT * FROM t1 UNION SELECT * FROM t1 +ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +Warnings: +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by (match `a` against ('+abc' in boolean mode)) +# Should not crash +SELECT * FROM t1 UNION SELECT * FROM t1 +ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE); +a +1 +2 +# Should not crash +EXPLAIN EXTENDED +SELECT * FROM t1 UNION SELECT * FROM t1 +ORDER BY (SELECT a FROM t2 WHERE b = 12); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 +2 UNION t1 ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL NULL Using filesort +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #-1 +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` union /* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` order by <expr_cache><`a`>((/* select#3 */ select `a` from `test`.`t2` where `test`.`t2`.`b` = 12)) +# Should not crash +SELECT * FROM t1 UNION SELECT * FROM t1 +ORDER BY (SELECT a FROM t2 WHERE b = 12); +# Should not crash +SELECT * FROM t2 UNION SELECT * FROM t2 +ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE)); +b +1 +2 +DROP TABLE t1,t2; +End of 5.1 tests diff --git a/mysql-test/suite/innodb_fts/r/fulltext_multi.result b/mysql-test/suite/innodb_fts/r/fulltext_multi.result new file mode 100644 index 00000000..4a3c2fb5 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_multi.result @@ -0,0 +1,38 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +a int(11) NOT NULL auto_increment, +b text, +c varchar(254) default NULL, +PRIMARY KEY (a), +FULLTEXT KEY bb(b), +FULLTEXT KEY cc(c), +FULLTEXT KEY a(b,c) +) ENGINE = InnoDB; +drop table t1; +CREATE TABLE t1 ( +a int(11) NOT NULL auto_increment, +b text, +c varchar(254) default NULL, +PRIMARY KEY (a), +FULLTEXT KEY a(b,c) +) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp'); +INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj'); +INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb'); +ANALYZE TABLE t1; +SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1; +a round(MATCH b,c AGAINST ('lala lkjh'),5) +1 0.22764 +2 0.22764 +3 0.00000 +SELECT a, round(MATCH c,c AGAINST ('lala lkjh'),5) FROM t1; +a round(MATCH c,c AGAINST ('lala lkjh'),5) +1 0.22764 +2 0.22764 +3 0.00000 +SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1; +a round(MATCH b,c AGAINST ('lala lkjh'),5) +1 0.22764 +2 0.22764 +3 0.00000 +drop table t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_order_by.result b/mysql-test/suite/innodb_fts/r/fulltext_order_by.result new file mode 100644 index 00000000..0d3a4a85 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_order_by.result @@ -0,0 +1,179 @@ +DROP TABLE IF EXISTS t1,t2,t3; +CREATE TABLE t1 ( +a INT AUTO_INCREMENT PRIMARY KEY, +message CHAR(20), +FULLTEXT(message) +) ENGINE = InnoDB comment = 'original testcase by sroussey@network54.com'; +INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"), +("steve"),("is"),("cool"),("steve is cool"); +ANALYZE TABLE t1; +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve'); +a FORMAT(MATCH (message) AGAINST ('steve'),6) +4 0.296010 +7 0.296010 +SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve'); +a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) +4 0.2960100471973419 +7 0.2960100471973419 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); +a FORMAT(MATCH (message) AGAINST ('steve'),6) +4 0.296010 +7 0.296010 +SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE); +a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) +4 0.2960100471973419 +7 0.2960100471973419 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a; +a FORMAT(MATCH (message) AGAINST ('steve'),6) +4 0.296010 +7 0.296010 +SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a; +a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) +4 0.2960100471973419 +7 0.2960100471973419 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC; +a FORMAT(MATCH (message) AGAINST ('steve'),6) +7 0.296010 +4 0.296010 +SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC; +a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) +7 0.2960100471973419 +4 0.2960100471973419 +SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1; +a FORMAT(MATCH (message) AGAINST ('steve'),6) +7 0.296010 +SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1; +a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) +7 0.2960100471973419 +SELECT if(a in (4,7),2,1), FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel; +if(a in (4,7),2,1) rel +1 0.000000 +1 0.000000 +1 0.000000 +1 0.000000 +1 0.000000 +2 0.296010 +2 0.296010 +SELECT if(a in (4,7),2,1), MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel; +if(a in (4,7),2,1) rel +1 0 +1 0 +1 0 +1 0 +1 0 +2 0.2960100471973419 +2 0.2960100471973419 +alter table t1 add key m (message); +ANALYZE TABLE t1; +explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext message message 0 1 Using where; Using filesort +SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message desc; +message +steve is cool +steve +drop table t1; +CREATE TABLE t1 ( +a INT AUTO_INCREMENT PRIMARY KEY, +message CHAR(20), +FULLTEXT(message) +) ENGINE = InnoDB; +INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar"); +ANALYZE TABLE t1; +SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1; +a rel +1 0.000000001885928302414186 +2 0.0906190574169159 +SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a; +a rel +1 0.000000001885928302414186 +2 0.0906190574169159 +drop table t1; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +thread int(11) NOT NULL default '0', +beitrag longtext NOT NULL, +PRIMARY KEY (id), +KEY thread (thread), +FULLTEXT KEY beitrag (beitrag) +) ENGINE =InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7923 ; +CREATE TABLE t2 ( +id int(11) NOT NULL auto_increment, +text varchar(100) NOT NULL default '', +PRIMARY KEY (id), +KEY text (text) +) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=63 ; +CREATE TABLE t3 ( +id int(11) NOT NULL auto_increment, +forum int(11) NOT NULL default '0', +betreff varchar(70) NOT NULL default '', +PRIMARY KEY (id), +KEY forum (forum), +FULLTEXT KEY betreff (betreff) +) ENGINE = InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=996 ; +select a.text, b.id, b.betreff +from +t2 a inner join t3 b on a.id = b.forum inner join +t1 c on b.id = c.thread +where +match(b.betreff) against ('+abc' in boolean mode) +group by a.text, b.id, b.betreff +union +select a.text, b.id, b.betreff +from +t2 a inner join t3 b on a.id = b.forum inner join +t1 c on b.id = c.thread +where +match(c.beitrag) against ('+abc' in boolean mode) +group by +a.text, b.id, b.betreff +order by +match(b.betreff) against ('+abc' in boolean mode) desc; +ERROR 42000: Table 'b' from one of the SELECTs cannot be used in ORDER clause +select a.text, b.id, b.betreff +from +t2 a inner join t3 b on a.id = b.forum inner join +t1 c on b.id = c.thread +where +match(b.betreff) against ('+abc' in boolean mode) +union +select a.text, b.id, b.betreff +from +t2 a inner join t3 b on a.id = b.forum inner join +t1 c on b.id = c.thread +where +match(c.beitrag) against ('+abc' in boolean mode) +order by +match(b.betreff) against ('+abc' in boolean mode) desc; +ERROR 42000: Table 'b' from one of the SELECTs cannot be used in ORDER clause +select a.text, b.id, b.betreff +from +t2 a inner join t3 b on a.id = b.forum inner join +t1 c on b.id = c.thread +where +match(b.betreff) against ('+abc' in boolean mode) +union +select a.text, b.id, b.betreff +from +t2 a inner join t3 b on a.id = b.forum inner join +t1 c on b.id = c.thread +where +match(c.beitrag) against ('+abc' in boolean mode) +order by +match(betreff) against ('+abc' in boolean mode) desc; +text id betreff +(select b.id, b.betreff from t3 b) union +(select b.id, b.betreff from t3 b) +order by match(betreff) against ('+abc' in boolean mode) desc; +id betreff +(select b.id, b.betreff from t3 b) union +(select b.id, b.betreff from t3 b) +order by match(betreff) against ('+abc') desc; +ERROR HY000: Can't find FULLTEXT index matching the column list +select distinct b.id, b.betreff from t3 b +order by match(betreff) against ('+abc' in boolean mode) desc; +id betreff +select b.id, b.betreff from t3 b group by b.id+1 +order by match(betreff) against ('+abc' in boolean mode) desc; +id betreff +drop table t1,t2,t3; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_update.result b/mysql-test/suite/innodb_fts/r/fulltext_update.result new file mode 100644 index 00000000..00d07773 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_update.result @@ -0,0 +1,22 @@ +drop table if exists test; +CREATE TABLE test ( +gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +url VARCHAR(80) DEFAULT '' NOT NULL, +shortdesc VARCHAR(200) DEFAULT '' NOT NULL, +longdesc text DEFAULT '' NOT NULL, +description VARCHAR(80) DEFAULT '' NOT NULL, +name VARCHAR(80) DEFAULT '' NOT NULL, +FULLTEXT(url,description,shortdesc,longdesc), +PRIMARY KEY(gnr) +) ENGINE = InnoDB; +insert into test (url,shortdesc,longdesc,description,name) VALUES +("http:/test.at", "kurz", "lang","desc", "name"); +insert into test (url,shortdesc,longdesc,description,name) VALUES +("http:/test.at", "kurz", "","desc", "name"); +update test set url='test', description='ddd', name='nam' where gnr=2; +update test set url='test', shortdesc='ggg', longdesc='mmm', +description='ddd', name='nam' where gnr=2; +check table test; +Table Op Msg_type Msg_text +test.test check status OK +drop table test; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_var.result b/mysql-test/suite/innodb_fts/r/fulltext_var.result new file mode 100644 index 00000000..ee4ba98d --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/fulltext_var.result @@ -0,0 +1,34 @@ +show variables like "ft\_%"; +Variable_name Value +ft_boolean_syntax + -><()~*:""&| +ft_max_word_len 84 +ft_min_word_len 4 +ft_query_expansion_limit 20 +ft_stopword_file (built-in) +create table t1 (b text not null, fulltext(b)) engine = innodb; +insert t1 values ('aaaaaa bbbbbb cccccc'); +insert t1 values ('bbbbbb cccccc'); +insert t1 values ('aaaaaa cccccc'); +select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode); +b +aaaaaa bbbbbb cccccc +aaaaaa cccccc +set ft_boolean_syntax=' +-><()~*:""&|'; +ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL +set global ft_boolean_syntax=' +-><()~*:""&|'; +select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode); +b +aaaaaa bbbbbb cccccc +aaaaaa cccccc +set global ft_boolean_syntax='@ -><()~*:""&|'; +select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode); +b +aaaaaa bbbbbb cccccc +aaaaaa cccccc +select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode); +ERROR 42000: syntax error, unexpected '@', expecting $end +set global ft_boolean_syntax='@ -><()~*:""@|'; +ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '@ -><()~*:""@|' +set global ft_boolean_syntax='+ -><()~*:""@!|'; +ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of '+ -><()~*:""@!|' +drop table t1; diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result new file mode 100644 index 00000000..15f5b295 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl.result @@ -0,0 +1,333 @@ +CREATE TABLE fts_test ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +INSERT INTO fts_test (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=INPLACE; +SELECT * FROM fts_test WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +DROP INDEX idx ON fts_test; +INSERT INTO fts_test (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +SELECT * FROM fts_test WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +7 MySQL Tutorial DBMS stands for DataBase ... +9 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM fts_test WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +12 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +7 MySQL Tutorial DBMS stands for DataBase ... +8 How To Use MySQL Well After you went through a ... +9 Optimizing MySQL In this tutorial we will show ... +10 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +TRUNCATE TABLE fts_test; +DROP INDEX idx ON fts_test; +INSERT INTO fts_test (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +CREATE FULLTEXT INDEX idx on fts_test (title, body); +SELECT * FROM fts_test WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +DROP TABLE fts_test; +CREATE TABLE fts_test ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +INSERT INTO fts_test (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE; +ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +ALTER TABLE fts_test ROW_FORMAT=REDUNDANT; +SELECT * FROM fts_test WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +drop index idx on fts_test; +CREATE FULLTEXT INDEX idx on fts_test (title, body); +SELECT * FROM fts_test WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +drop index idx on fts_test; +CREATE FULLTEXT INDEX idx on fts_test (title, body); +SELECT * FROM fts_test WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +drop table fts_test; +CREATE TABLE fts_test ( +FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, +title varchar(255) NOT NULL DEFAULT '', +text mediumtext NOT NULL, +PRIMARY KEY (FTS_DOC_ID), +UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID), +FULLTEXT KEY idx (title,text) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; +set @@auto_increment_increment=10; +INSERT INTO fts_test (title, text) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'), +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ANALYZE TABLE fts_test; +set @@auto_increment_increment=1; +select *, match(title, text) AGAINST ('database') as score +from fts_test order by score desc; +FTS_DOC_ID title text score +11 MySQL Tutorial DBMS stands for DataBase ... 0.22764469683170319 +51 MySQL vs. YourSQL In the following database comparison ... 0.22764469683170319 +21 How To Use MySQL Well After you went through a ... 0 +31 Optimizing MySQL In this tutorial we will show ... 0 +41 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0 +61 MySQL Security When configured properly, MySQL ... 0 +drop index idx on fts_test; +drop table fts_test; +CREATE TABLE fts_test ( +FTS_DOC_ID int(20) unsigned NOT NULL AUTO_INCREMENT, +title varchar(255) NOT NULL DEFAULT '', +text mediumtext NOT NULL, +PRIMARY KEY (FTS_DOC_ID), +UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID), +FULLTEXT KEY idx (title,text) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +CREATE TABLE fts_test ( +FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, +title varchar(255) NOT NULL DEFAULT '', +text mediumtext NOT NULL, +PRIMARY KEY (FTS_DOC_ID), +KEY FTS_DOC_ID_INDEX (FTS_DOC_ID), +FULLTEXT KEY idx (title,text) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +CREATE TABLE articles ( +FTS_DOC_ID BIGINT UNSIGNED NOT NULL , +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +INSERT INTO articles (FTS_DOC_ID, title, body) VALUES +(9, 'MySQL Tutorial','DBMS stands for DataBase ...'), +(10, 'How To Use MySQL Well','After you went through a ...'), +(12, 'Optimizing MySQL','In this tutorial we will show ...'), +(14,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +(19, 'MySQL vs. YourSQL','In the following database comparison ...'), +(20, 'MySQL Security','When configured properly, MySQL ...'); +ALTER TABLE articles ADD FULLTEXT INDEX idx (title), +ADD FULLTEXT INDEX idx3 (title), ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY +ALTER TABLE articles ADD FULLTEXT INDEX idx (title), +ADD FULLTEXT INDEX idx3 (title); +affected rows: 6 +info: Records: 6 Duplicates: 0 Warnings: 1 +Warnings: +Note 1831 Duplicate index `idx3`. This is deprecated and will be disallowed in a future release +ALTER TABLE articles ADD INDEX t20 (title(20)), LOCK=NONE; +ALTER TABLE articles DROP INDEX t20; +INSERT INTO articles (FTS_DOC_ID, title, body) VALUES +(29, 'MySQL Tutorial','DBMS stands for DataBase ...'), +(30, 'How To Use MySQL Well','After you went through a ...'), +(32, 'Optimizing MySQL','In this tutorial we will show ...'), +(34,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +(39, 'MySQL vs. YourSQL','In the following database comparison ...'), +(40, 'MySQL Security','When configured properly, MySQL ...'); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +9 MySQL Tutorial DBMS stands for DataBase ... +29 MySQL Tutorial DBMS stands for DataBase ... +DROP INDEX idx ON articles; +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +9 MySQL Tutorial DBMS stands for DataBase ... +29 MySQL Tutorial DBMS stands for DataBase ... +CREATE FULLTEXT INDEX idx on articles (title, body); +SELECT * FROM articles WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +9 MySQL Tutorial DBMS stands for DataBase ... +12 Optimizing MySQL In this tutorial we will show ... +29 MySQL Tutorial DBMS stands for DataBase ... +32 Optimizing MySQL In this tutorial we will show ... +DROP TABLE articles; +create table articles(`FTS_DOC_ID` serial, +`col32` timestamp not null,`col115` text) engine=innodb; +create fulltext index `idx5` on articles(`col115`) ; +alter ignore table articles add primary key (`col32`) ; +drop table articles; +CREATE TABLE articles ( +id INT UNSIGNED NOT NULL, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +INSERT INTO articles VALUES +(1, 'MySQL Tutorial','DBMS stands for DataBase ...') , +(2, 'How To Use MySQL Well','After you went through a ...'), +(3, 'Optimizing MySQL','In this tutorial we will show ...'), +(4, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +(5, 'MySQL vs. YourSQL','In the following database comparison ...'), +(6, 'MySQL Security','When configured properly, MySQL ...'); +CREATE FULLTEXT INDEX idx on articles (title, body); +DROP INDEX idx ON articles; +CREATE UNIQUE INDEX idx2 ON articles(id); +CREATE FULLTEXT INDEX idx on articles (title, body); +SELECT * FROM articles WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +DROP TABLE articles; +# +# MDEV-22811 DDL fails to drop and re-create FTS index +# +CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY, +f1 VARCHAR(200),FULLTEXT fidx(f1))engine=innodb; +ALTER TABLE t1 DROP index fidx, ADD FULLTEXT INDEX(f1); +DROP TABLE t1; +# +# MDEV-21478 Inplace alter fails to report error when +# FTS_DOC_ID is added +SET NAMES utf8; +CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; +ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; +ALTER TABLE t1 DROP COLUMN FTS_DOC_ıD; +ALTER TABLE t1 ADD FTS_DOC_ıD BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +DROP TABLE t1; +CREATE TABLE t1 (f1 INT NOT NULL)ENGINE=InnoDB; +ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_Ä°D' +ALTER TABLE t1 ADD FTS_DOC_Ä°D BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'FTS_DOC_Ä°D' +ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD fts_doc_id INT, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD fts_doc_id BIGINT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'fts_doc_id' +ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=COPY; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +ALTER TABLE t1 ADD FTS_DOC_ID INT UNSIGNED NOT NULL, ALGORITHM=INPLACE; +ERROR 42000: Incorrect column name 'FTS_DOC_ID' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +# +# MDEV-25271 Double free of table when inplace alter +# FTS add index fails +# +call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation."); +call mtr.add_suppression("InnoDB: Error number .* means"); +call mtr.add_suppression("InnoDB: Cannot create file"); +call mtr.add_suppression("InnoDB: Failed to create"); +CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; +ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b); +DROP TABLE t1; +# +# MDEV-18152 Assertion 'num_fts_index <= 1' failed +# in prepare_inplace_alter_table_dict +# +CREATE TABLE t1 +(a VARCHAR(128), b VARCHAR(128), FULLTEXT INDEX(a), FULLTEXT INDEX(b)) +ENGINE=InnoDB; +ALTER TABLE t1 ADD c SERIAL; +DROP TABLE t1; +# End of 10.3 tests +# +# MDEV-27582 Fulltext DDL decrements the FTS_DOC_ID value +# +CREATE TABLE t1 ( +f1 INT NOT NULL PRIMARY KEY, +f2 VARCHAR(64), FULLTEXT ft(f2)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); +connect con1,localhost,root,,,; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +DELETE FROM t1 WHERE f1 = 2; +ALTER TABLE t1 DROP INDEX ft; +ALTER TABLE t1 ADD FULLTEXT INDEX ft (f2); +INSERT INTO t1 VALUES (3, 'innodb fts search'); +SET GLOBAL innodb_optimize_fulltext_only=ON; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SET GLOBAL innodb_ft_aux_table = 'test/t1'; +SELECT max(DOC_ID) FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +max(DOC_ID) +3 +SELECT * FROM t1 WHERE MATCH(f2) AGAINST("+innodb +search" IN BOOLEAN MODE); +f1 f2 +3 innodb fts search +DROP TABLE t1; +disconnect con1; +SET GLOBAL innodb_optimize_fulltext_only=OFF; +SET GLOBAL innodb_ft_aux_table = default; +# +# MDEV-32017 Auto-increment no longer works for +# explicit FTS_DOC_ID +# +CREATE TABLE t ( +FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +f1 char(255), f2 char(255), f3 char(255), fulltext key (f3) +) ENGINE=InnoDB; +INSERT INTO t (f1,f2,f3) VALUES ('foo','bar','baz'); +ALTER TABLE t ADD FULLTEXT INDEX ft1(f1); +ALTER TABLE t ADD FULLTEXT INDEX ft2(f2); +INSERT INTO t (f1,f2,f3) VALUES ('bar','baz','qux'); +DROP TABLE t; diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result b/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result new file mode 100644 index 00000000..f998881f --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result @@ -0,0 +1,190 @@ +call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns."); +call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`"); +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +CREATE FULLTEXT INDEX idx on articles (title, body); +SELECT * FROM articles WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title, body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +2 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title, body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +2 +ANALYZE TABLE articles; +Table Op Msg_type Msg_text +test.articles analyze status Engine-independent statistics collected +test.articles analyze Warning Engine-independent statistics are not collected for column 'body' +test.articles analyze status OK +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +DROP INDEX idx ON articles; +CREATE FULLTEXT INDEX idx on articles (title, body); +CREATE FULLTEXT INDEX idx1 on articles (title); +SELECT * FROM articles WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +DROP INDEX idx ON articles; +DROP INDEX idx1 ON articles; +CREATE FULLTEXT INDEX idx1 on articles (title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +drop table articles; +CREATE TABLE articles ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +create unique index FTS_DOC_ID_INDEX on articles(FTS_DOC_ID); +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +CREATE FULLTEXT INDEX idx on articles (title, body); +SELECT * FROM articles WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +drop table articles; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +CREATE FULLTEXT INDEX idx on articles (title); +CREATE FULLTEXT INDEX idx2 on articles (body); +SELECT * FROM articles WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +3 Optimizing MySQL In this tutorial we will show ... +drop index idx2 on articles; +SELECT * FROM articles WHERE MATCH (body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +CREATE FULLTEXT INDEX idx2 on articles (body); +SELECT * FROM articles WHERE MATCH (body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +3 Optimizing MySQL In this tutorial we will show ... +UPDATE articles set title = 'aaaa' +WHERE MATCH(title) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('aaaa' IN NATURAL LANGUAGE MODE); +id title body +1 aaaa DBMS stands for DataBase ... +drop table articles; +CREATE TABLE articles ( +FTS_DOC_ID BIGINT UNSIGNED NOT NULL , +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx on articles (title); +INSERT INTO articles VALUES (9, 'MySQL Tutorial','DBMS stands for DataBase ...'); +UPDATE articles set title = 'bbbb' WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +ERROR HY000: Invalid InnoDB FTS Doc ID +UPDATE articles set title = 'bbbb', FTS_DOC_ID=8 WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +ERROR HY000: Invalid InnoDB FTS Doc ID +UPDATE articles set title = 'bbbb', FTS_DOC_ID=10 WHERE MATCH(title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +SELECT * FROM articles WHERE MATCH (title) AGAINST ('bbbb' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +10 bbbb DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title) AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +CREATE FULLTEXT INDEX idx2 ON articles (body); +SELECT * FROM articles WHERE MATCH (body) AGAINST ('database' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID title body +10 bbbb DBMS stands for DataBase ... +UPDATE articles set body = 'bbbb', FTS_DOC_ID=11 WHERE MATCH(body) AGAINST ('database' IN NATURAL LANGUAGE MODE); +drop table articles; +create table `articles`(`a` varchar(2) not null)engine=innodb; +create fulltext index `FTS_DOC_ID_INDEX` on `articles`(`a`); +ERROR HY000: Index 'FTS_DOC_ID_INDEX' is of wrong type for an InnoDB FULLTEXT index +create unique index `a` on `articles`(`a`); +drop table articles; +CREATE TABLE wp( +FTS_DOC_ID bigint PRIMARY KEY, +title VARCHAR(255) NOT NULL DEFAULT '', +text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB; +INSERT INTO wp (FTS_DOC_ID, title, text) VALUES +(1, 'MySQL Tutorial','DBMS stands for DataBase ...'), +(2, 'How To Use MySQL Well','After you went through a ...'); +CREATE FULLTEXT INDEX idx ON wp(title, text); +ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index +DROP TABLE wp; +CREATE TABLE wp( +FTS_DOC_ID bigint unsigned PRIMARY KEY, +title VARCHAR(255) NOT NULL DEFAULT '', +text MEDIUMTEXT NOT NULL ) ENGINE=InnoDB; +INSERT INTO wp (FTS_DOC_ID, title, text) VALUES +(1, 'MySQL Tutorial','DBMS stands for DataBase ...'), +(2, 'How To Use MySQL Well','After you went through a ...'); +CREATE FULLTEXT INDEX idx ON wp(title, text); +SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database') +FROM wp; +FTS_DOC_ID MATCH(title, text) AGAINST ('database') +1 0.0906190574169159 +2 0 +DROP TABLE wp; diff --git a/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result b/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result new file mode 100644 index 00000000..a1ffb0a5 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result @@ -0,0 +1,121 @@ +CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB; +insert into t1 VALUES('First record'),('Second record'),('Third record'); +SET @save_ft_aux_table = @@GLOBAL.innodb_ft_aux_table; +connect con1,localhost,root,,; +SET GLOBAL innodb_ft_aux_table = 'test/t0'; +ERROR 42000: Variable 'innodb_ft_aux_table' can't be set to the value of 'test/t0' +connection default; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; +value +a +about +an +are +as +at +be +by +com +de +en +for +from +how +i +in +is +it +la +of +on +or +that +the +this +to +was +what +when +where +who +will +with +und +the +www +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; +KEY VALUE +connection con1; +SET GLOBAL innodb_ft_aux_table = 'test/t1'; +disconnect con1; +connection default; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +first 1 1 1 1 0 +record 1 3 3 1 6 +record 1 3 3 2 7 +record 1 3 3 3 6 +second 2 2 1 2 0 +third 3 3 1 3 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; +KEY VALUE +optimize_checkpoint_limit 180 +synced_doc_id 0 +stopword_table_name +use_stopword 1 +SELECT @@GLOBAL.innodb_ft_aux_table; +@@GLOBAL.innodb_ft_aux_table +test/t1 +RENAME TABLE t1 TO t2; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +first 1 1 1 1 0 +record 1 3 3 1 6 +record 1 3 3 2 7 +record 1 3 3 3 6 +second 2 2 1 2 0 +third 3 3 1 3 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; +KEY VALUE +optimize_checkpoint_limit 180 +synced_doc_id 0 +stopword_table_name +use_stopword 1 +SELECT @@GLOBAL.innodb_ft_aux_table; +@@GLOBAL.innodb_ft_aux_table +test/t1 +DROP TABLE t2; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; +KEY VALUE +SELECT @@GLOBAL.innodb_ft_aux_table; +@@GLOBAL.innodb_ft_aux_table +test/t1 +SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_large_records.result b/mysql-test/suite/innodb_fts/r/innodb_fts_large_records.result new file mode 100644 index 00000000..294bfcb0 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_large_records.result @@ -0,0 +1,305 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a TEXT, +b TEXT +) ENGINE = InnoDB; +CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID); +"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data1.txt" +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT COUNT(*) FROM t1; +COUNT(*) +49 +SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b) +AGAINST ('row35col2word49' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID +35 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row5col2word49" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row35col2word49 +(row35col1word49 row35col2word40)" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row35col2word49 -(row45col2word49)" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("row5col2word49 row5col2word40" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH a,b AGAINST ("+row5col2word* +row5col1word49*" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH a,b AGAINST ('"row35col2word49"' IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH a,b AGAINST ('"ROW35col2WORD49"' IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST ("row5col2word49" WITH QUERY EXPANSION); +COUNT(*) +1 +SELECT FTS_DOC_ID FROM t1 +WHERE MATCH (a,b) +AGAINST ('"row5col2word48 row5col2word49"@2' IN BOOLEAN MODE); +FTS_DOC_ID +5 +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"row5col2word48 row5col2word49"@1' IN BOOLEAN MODE); +FTS_DOC_ID a b +UPDATE t1 SET a = "using update" , b = "changing fulltext index record", FTS_DOC_ID = FTS_DOC_ID + 10000 +WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE); +SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE); +a b +SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE); +a b +using update changing fulltext index record +SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +a b +using update changing fulltext index record +DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +a b +DROP TABLE t1; +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a TEXT, +b TEXT +) ENGINE = InnoDB; +CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID); +"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data2.txt" +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT COUNT(*) FROM t1; +COUNT(*) +100 +SELECT FTS_DOC_ID from t1 WHERE b like '%row300col2word30%'; +FTS_DOC_ID +SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b) +AGAINST ('row35col2word49' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID +35 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row5col2word49" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row35col2word49 +(row35col1word49 row35col2word40)" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+row35col2word49 -(row45col2word49)" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("row5col2word49 row5col2word40" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH a,b AGAINST ("+row5col2word* +row5col1word49*" IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH a,b AGAINST ('"row35col2word49"' IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 +WHERE MATCH a,b AGAINST ('"ROW35col2WORD49"' IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST ("row5col2word49" WITH QUERY EXPANSION); +COUNT(*) +1 +SELECT FTS_DOC_ID FROM t1 +WHERE MATCH (a,b) +AGAINST ('"row5col2word48 row5col2word49"@2' IN BOOLEAN MODE); +FTS_DOC_ID +5 +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"row5col2word48 row5col2word49"@1' IN BOOLEAN MODE); +FTS_DOC_ID a b +UPDATE t1 SET a = "using update" , b = "changing fulltext index record", FTS_DOC_ID = FTS_DOC_ID + 10000 +WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE); +SELECT a,b FROM t1 +WHERE MATCH(a,b) AGAINST("+row5col2word49 +row5col1word49" IN BOOLEAN MODE); +a b +SELECT a,b FROM t1 +WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE); +a b +using update changing fulltext index record +SELECT a,b FROM t1 +WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +a b +using update changing fulltext index record +DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +SELECT a,b FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +a b +ALTER TABLE t1 DROP INDEX idx; +CREATE FULLTEXT INDEX idx on t1 (a,b); +UPDATE t1 SET a = NULL , b = NULL, FTS_DOC_ID= 6000 + FTS_DOC_ID; +SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL; +COUNT(*) +99 +ALTER TABLE t1 DROP INDEX idx; +SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL; +COUNT(*) +99 +DROP TABLE t1; +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a TEXT, +b TEXT +) ENGINE = InnoDB; +CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID); +"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data3.txt" +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT COUNT(*) FROM t1; +COUNT(*) +100 +SELECT COUNT(*) from t1 WHERE b like '%samerowword%'; +COUNT(*) +100 +SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) +AGAINST ('samerowword' IN NATURAL LANGUAGE MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+samerowword -(row45col2word49)" IN BOOLEAN MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 +WHERE MATCH a,b AGAINST ("+sameroww" IN BOOLEAN MODE); +COUNT(*) +0 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST ("samerowword" WITH QUERY EXPANSION); +COUNT(*) +100 +UPDATE t1 SET a = "using update" , b = "changing fulltext index record", +FTS_DOC_ID = FTS_DOC_ID + 10000 +WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE); +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+samerowword +samerowword" IN BOOLEAN MODE); +COUNT(*) +0 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE); +COUNT(*) +0 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +COUNT(*) +100 +DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +COUNT(*) +0 +ALTER TABLE t1 DROP INDEX idx; +CREATE FULLTEXT INDEX idx on t1 (a,b); +UPDATE t1 SET a = NULL , b = NULL ; +SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL; +COUNT(*) +0 +ALTER TABLE t1 DROP INDEX idx; +SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL; +COUNT(*) +0 +DROP TABLE t1; +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a TEXT, +b TEXT +) ENGINE = InnoDB; +CREATE UNIQUE INDEX FTS_DOC_ID_INDEX on t1(FTS_DOC_ID); +"Loading data using LOAD DATA Command , File <MYSQLTEST_VARDIR>/tmp/fts_input_data4.txt" +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT COUNT(*) FROM t1; +COUNT(*) +100 +SELECT COUNT(*) from t1 WHERE a like '%samerowword%'; +COUNT(*) +100 +SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) +AGAINST ('samerowword' IN NATURAL LANGUAGE MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST("+samerowword -(1050)" IN BOOLEAN MODE); +COUNT(*) +0 +SELECT COUNT(*) from t1 WHERE MATCH a,b AGAINST ("+2001" IN BOOLEAN MODE); +COUNT(*) +0 +SELECT COUNT(*) from t1 WHERE MATCH(a,b) AGAINST ("samerowword" WITH QUERY EXPANSION); +COUNT(*) +100 +UPDATE t1 SET a = "using update" , b = "changing fulltext index record", +FTS_DOC_ID = FTS_DOC_ID + 10000 +WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE); +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+samerowword +1050" IN BOOLEAN MODE); +COUNT(*) +0 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+samerowword" IN BOOLEAN MODE); +COUNT(*) +0 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("changing fulltext" IN BOOLEAN MODE); +COUNT(*) +100 +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +COUNT(*) +100 +DELETE FROM t1 +WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +SELECT COUNT(*) from t1 +WHERE MATCH(a,b) AGAINST("+chang* +fulltext" IN BOOLEAN MODE); +COUNT(*) +0 +ALTER TABLE t1 DROP INDEX idx; +CREATE FULLTEXT INDEX idx on t1 (a,b); +UPDATE t1 SET a = NULL , b = NULL ; +SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL; +COUNT(*) +0 +ALTER TABLE t1 DROP INDEX idx; +SELECT COUNT(*) FROM t1 WHERE a IS NULL AND b IS NULL; +COUNT(*) +0 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result new file mode 100644 index 00000000..2cc992be --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result @@ -0,0 +1,1395 @@ +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `a` varchar(200) DEFAULT NULL, + `b` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`a`,`b`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id +1 +3 +select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +id +select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1; +id x +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1; +id x +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE); +id +select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE); +id +select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION); +id +select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION); +id +select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION); +id +ALTER TABLE t1 DROP INDEX idx; +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id +1 +3 +select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +id +select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1; +id x +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1; +id x +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE); +id +select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE); +id +select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION); +id +select id from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION); +id +select id from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION); +id +INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...'); +INSERT INTO t1 (a,b) VALUES +('test proximity search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test proximity fts search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test more proximity fts search, test, more proximity and phrase', +'search, with proximity innodb'); +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id +8 +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"proximity search"@1' IN BOOLEAN MODE); +id +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id +8 +9 +10 +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id +8 +9 +10 +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id +10 +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"more test proximity"@2' IN BOOLEAN MODE); +id +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE); +id +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id +1 +3 +SELECT id FROM t1 WHERE id = (SELECT MAX(id) FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)); +id +3 +SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)); +id +1 +SELECT id FROM t1 WHERE id = (SELECT MIN(id) FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ; +id +1 +3 +SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN ( +SELECT CONCAT(a,b) FROM t1 AS t2 WHERE +MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +) OR t1.id = 3 ; +id +1 +3 +SELECT id FROM t1 WHERE CONCAT(t1.a,t1.b) IN ( +SELECT CONCAT(a,b) FROM t1 AS t2 +WHERE MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +AND t2.id != 3) ; +id +1 +SELECT id FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE +MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ; +id +1 +3 +SELECT id FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1 +WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ; +id +2 +3 +4 +5 +6 +SELECT id FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE +MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +AND t1.id = t2.id) ; +id +1 +3 +SELECT id FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE +MATCH (t2.a,t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +AND t1.id = t2.id) ; +id +2 +4 +5 +6 +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT , +FULLTEXT (a,b) +) ENGINE = InnoDB; +INSERT INTO t1(a,b) VALUES('MySQL has now support', 'for full-text search'), +('Full-text indexes', 'are called collections'), +('Only MyISAM tables','support collections'), +('Function MATCH ... AGAINST()','is used to do a search'), +('Full-text search in MySQL', 'implements vector space model'); +SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE +MATCH(t2.a,t2.b) AGAINST("+support +collections" IN BOOLEAN MODE)); +id +3 +SELECT id FROM t1 WHERE t1.id != (SELECT MIN(t2.id) FROM t1 AS t2 WHERE +MATCH(t2.a,t2.b) AGAINST("+search" IN BOOLEAN MODE)); +id +2 +3 +4 +5 +SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE +MATCH (t2.a,t2.b) AGAINST ("+call* +coll*" IN BOOLEAN MODE)); +id +2 +SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE +MATCH t2.a,t2.b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE) AND t2.id=t1.id); +id +1 +INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...'); +INSERT INTO t1 (a,b) VALUES +('test proximity search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test proximity fts search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test more proximity fts search, test, more proximity and phrase', +'search, with proximity innodb'); +SELECT id FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE +MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE)); +id +7 +SELECT id FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE +MATCH(t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE)); +id +8 +9 +SELECT id FROM t1 WHERE t1.id IN (SELECT t2.id FROM t1 AS t2 WHERE +MATCH (t2.a,t2.b) AGAINST ('"proximity search"@2' IN BOOLEAN MODE)); +id +7 +SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE +MATCH t2.a,t2.b AGAINST ('"proximity search"@2' IN BOOLEAN MODE) +AND t2.id=t1.id); +id +7 +SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE +MATCH t2.a,t2.b AGAINST ('"more test proximity"@3' IN BOOLEAN MODE) +AND t2.id=t1.id); +id +9 +SELECT id FROM t1 WHERE EXISTS (SELECT id FROM t1 AS t2 WHERE +MATCH t2.a,t2.b AGAINST ('"more test proximity"@2' IN BOOLEAN MODE) +AND t2.id=t1.id); +id +CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE +MATCH a,b AGAINST ('support') ; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(10) unsigned NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT id FROM t2; +id +1 +3 +DROP TABLE t2; +CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE +MATCH a,b AGAINST("+support +collections" IN BOOLEAN MODE); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(10) unsigned NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT id FROM t2; +id +3 +DROP TABLE t2; +CREATE TABLE t2 ENGINE = InnoDB AS SELECT id FROM t1 WHERE +MATCH a,b AGAINST ('"proximity search"@10' IN BOOLEAN MODE); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(10) unsigned NOT NULL DEFAULT 0 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +SELECT id FROM t2; +id +7 +8 +9 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...'); +INSERT INTO t1 (a,b) VALUES +('when To Use MySQL Well','After that you went through a ...'); +INSERT INTO t1 (a,b) VALUES +('where will Optimizing MySQL','what In this tutorial we will show ...'); +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL null...'); +SELECT COUNT(*) FROM t1; +COUNT(*) +106 +SELECT COUNT(*) FROM t1 WHERE a IS NULL; +COUNT(*) +100 +SELECT COUNT(*) FROM t1 WHERE b IS NOT NULL; +COUNT(*) +6 +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id +1 +103 +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST (NULL IN NATURAL LANGUAGE MODE); +id +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST (NULL WITH QUERY EXPANSION); +id +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('null' IN NATURAL LANGUAGE MODE); +id +106 +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id +106 +1 +52 +103 +104 +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NOT NULL OR b IS NOT NULL); +id +106 +1 +52 +103 +104 +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE) AND (a IS NULL AND b IS NOT NULL); +id +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id +1 +106 +SELECT COUNT(*) FROM t1 +WHERE MATCH (a,b) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +6 +SELECT id FROM t1 +WHERE MATCH (a,b) +AGAINST ('"following database"@10' IN BOOLEAN MODE); +id +105 +DROP TABLE t1; +set names utf8; +"----------Test1---------" +create table t50 (s1 varchar(60) character set utf8 collate utf8_bin) engine = innodb; +create fulltext index i on t50 (s1); +insert into t50 values ('ABCDE'),('FGHIJ'),('KLMNO'),('VÃÆ·WÄ°'); +select * from t50 where match(s1) against ('VÃÆ·WÄ°'); +s1 +VÃÆ·WÄ° +drop table t50; +"----------Test2---------" +create table t50 (s1 int unsigned primary key auto_increment, s2 +varchar(60) character set utf8) engine = innodb; +create fulltext index i on t50 (s2); +insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÃÆ·WÄ°'),('ABCDE'); +select * from t50 order by s2; +s1 s2 +4 ABCDE +1 FGHIJ +2 KLMNO +3 VÃÆ·WÄ° +drop table t50; +"----------Test3---------" +create table t50 (id int unsigned primary key auto_increment, s2 +varchar(60) character set utf8) engine = innodb; +create fulltext index i on t50 (s2); +insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÃÆ·WÄ°'),('ABCDE'); +set @@autocommit=0; +update t50 set s2 = lower(s2); +update t50 set s2 = upper(s2); +commit; +select * from t50 where match(s2) against ('VÃÆ·WÄ° FGHIJ KLMNO ABCDE' in boolean mode); +id s2 +1 FGHIJ +2 KLMNO +3 VÃÆ·WI +4 ABCDE +select * from t50; +id s2 +1 FGHIJ +2 KLMNO +3 VÃÆ·WI +4 ABCDE +drop table t50; +set @@autocommit=1; +"----------Test4---------" +create table t50 (id int unsigned primary key auto_increment, s2 +varchar(60) character set utf8) engine = innodb; +create fulltext index i on t50 (s2); +insert into t50 (s2) values ('FGHIJ'),('KLMNO'),('VÃÆ·WÄ°'),('ABCD*'); +select * from t50 where match(s2) against ('abcd*' in natural language +mode); +id s2 +4 ABCD* +select * from t50 where match(s2) against ('abcd*' in boolean mode); +id s2 +4 ABCD* +drop table t50; +"----------Test5---------" +create table t50 (s1 int, s2 varchar(200), fulltext key(s2)) engine = innodb; +set @@autocommit=0; +insert into t50 values (1,'Sunshine'),(2,'Lollipops'); +select * from t50 where match(s2) against('Rainbows'); +s1 s2 +rollback; +select * from t50; +s1 s2 +drop table t50; +set @@autocommit=1; +"----------Test6---------" +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 (a,b) VALUES +('aab` MySQL Tutorial','DBMS stands for DataBase ...') , +('aas How To Use MySQL Well','After you went through a ...'), +('aac Optimizing MySQL','In this tutorial we will show ...'); +INSERT INTO t1 (a,b) VALUES +('aac 1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('aab MySQL vs. YourSQL','In the following database comparison ...'), +('aaa MySQL Security','When configured properly, MySQL ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aac') DESC; +id a b +3 aac Optimizing MySQL In this tutorial we will show ... +4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +1 aab` MySQL Tutorial DBMS stands for DataBase ... +2 aas How To Use MySQL Well After you went through a ... +5 aab MySQL vs. YourSQL In the following database comparison ... +6 aaa MySQL Security When configured properly, MySQL ... +SELECT * FROM t1 ORDER BY MATCH(a,b) AGAINST ('aab') DESC; +id a b +1 aab` MySQL Tutorial DBMS stands for DataBase ... +5 aab MySQL vs. YourSQL In the following database comparison ... +2 aas How To Use MySQL Well After you went through a ... +3 aac Optimizing MySQL In this tutorial we will show ... +4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +6 aaa MySQL Security When configured properly, MySQL ... +"----------Test7---------" +select * from t1 where match(a,b) against ('aaa') +union select * from t1 where match(a,b) against ('aab') +union select * from t1 where match(a,b) against ('aac'); +id a b +6 aaa MySQL Security When configured properly, MySQL ... +1 aab` MySQL Tutorial DBMS stands for DataBase ... +5 aab MySQL vs. YourSQL In the following database comparison ... +3 aac Optimizing MySQL In this tutorial we will show ... +4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +select * from t1 where match(a,b) against ('aaa') +or match(a,b) against ('aab') +or match(a,b) against ('aac'); +id a b +1 aab` MySQL Tutorial DBMS stands for DataBase ... +3 aac Optimizing MySQL In this tutorial we will show ... +4 aac 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 aab MySQL vs. YourSQL In the following database comparison ... +6 aaa MySQL Security When configured properly, MySQL ... +DROP TABLE t1; +"----------Test8---------" +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','DBMS stands for DataBase ... abcd') , +('How To Use MySQL Well','After you went through a q ...abdd'), +('Optimizing MySQL','In this tutorial we will show ...abed'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `a` varchar(200) DEFAULT NULL, + `b` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`a`,`b`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. q ...'), +('MySQL vs. YourSQL use','In the following database comparison ...'), +('MySQL Security','When run configured properly, MySQL ...'); +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run'); +id a b +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. q ... +6 MySQL Security When run configured properly, MySQL ... +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use'); +id a b +2 How To Use MySQL Well After you went through a q ...abdd +5 MySQL vs. YourSQL use In the following database comparison ... +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went'); +id a b +2 How To Use MySQL Well After you went through a q ...abdd +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run') AND NOT MATCH(a,b) AGAINST ('q'); +id a b +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. q ... +6 MySQL Security When run configured properly, MySQL ... +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('use') AND NOT MATCH(a,b) AGAINST ('q'); +id a b +2 How To Use MySQL Well After you went through a q ...abdd +5 MySQL vs. YourSQL use In the following database comparison ... +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('went') AND NOT MATCH(a,b) AGAINST ('q'); +id a b +2 How To Use MySQL Well After you went through a q ...abdd +"----------Test9---------" +CREATE TABLE t2 AS SELECT * FROM t1; +ALTER TABLE t2 ENGINE=MYISAM; +CREATE FULLTEXT INDEX i ON t2 (a,b); +SET @x = (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run')); +SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('use')); +SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('went')); +SET @x = @x + (SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('run')); +SET @x2 = (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run')); +SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('use')); +SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('went')); +SET @x2 = @x2 + (SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('run')); +SELECT @x, @x2; +@x @x2 +7 0 +DROP TABLE t2; +"----------Test10---------" +CREATE TABLE t2 AS SELECT * FROM t1; +ALTER TABLE t2 ENGINE=MYISAM; +CREATE FULLTEXT INDEX i ON t2 (a,b); +SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE); +COUNT(*) +1 +SELECT COUNT(*) FROM t1 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE); +COUNT(*) +1 +DROP TABLE t2; +"----------Test11---------" +CREATE TABLE t2 AS SELECT * FROM t1; +ALTER TABLE t2 ENGINE = MYISAM; +CREATE FULLTEXT INDEX i ON t2 (a,b); +ALTER TABLE t2 ENGINE=InnoDB; +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ('run'); +id a b +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. q ... +6 MySQL Security When run configured properly, MySQL ... +SELECT COUNT(*) FROM t2 WHERE MATCH(a,b) AGAINST ('abc*' IN BOOLEAN MODE); +COUNT(*) +1 +DROP TABLE t2,t1; +"----------Test13---------" +set names utf8; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200) CHARACTER SET UTF8 COLLATE UTF8_SPANISH_CI) ENGINE = InnoDB; +CREATE FULLTEXT INDEX i ON t1 (s2); +INSERT INTO t1 VALUES (1,'aaCen'),(2,'aaCha'),(3,'aaCio'),(4,'aaçen'),(5,'aaçha'),(6,'aaçio'); +SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aach*' IN BOOLEAN MODE); +s1 s2 +2 aaCha +5 aaçha +SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('aaC*' IN BOOLEAN MODE); +s1 s2 +1 aaCen +2 aaCha +3 aaCio +4 aaçen +5 aaçha +6 aaçio +DROP TABLE t1; +"----------Test14---------" +CREATE TABLE t1(s1 INT , s2 VARCHAR(100) CHARACTER SET sjis) ENGINE = InnoDB; +CREATE FULLTEXT INDEX i ON t1 (s2); +INSERT INTO t1 VALUES (1,'ペペペ'),(2,'テテテ'),(3,'ルルル'),(4,'ã‚°ã‚°ã‚°'); +DROP TABLE t1; +"----------Test15---------" +CREATE TABLE t1 (s1 VARCHAR (60) CHARACTER SET UTF8 COLLATE UTF8_UNICODE_520_CI) ENGINE = MyISAM; +CREATE FULLTEXT INDEX i ON t1 (s1); +INSERT INTO t1 VALUES +('a'),('b'),('c'),('d'),('ÅÅÅÅ'),('LLLL'),(NULL),('ÅÅÅÅ ÅÅÅÅ'),('LLLLLLLL'); +SELECT * FROM t1 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI); +s1 +ÅÅÅÅ +LLLL +ÅÅÅÅ ÅÅÅÅ +CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB; +CREATE FULLTEXT INDEX i ON t2 ( s1); +INSERT INTO t2 VALUES +('a'),('b'),('c'),('d'),('ÅÅÅÅ'),('LLLL'),(NULL),('ÅÅÅÅ ÅÅÅÅ'),('LLLLLLLL'); +SELECT * FROM t2 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI); +s1 +LLLL +DROP TABLE t1,t2; +"----------Test16---------" +CREATE TABLE t1 (s1 INT, s2 VARCHAR(50) CHARACTER SET UTF8) ENGINE = InnoDB; +CREATE FULLTEXT INDEX i ON t1(s2); +INSERT INTO t1 VALUES (2, 'ÄŸÄ— DaÅ›i p '); +SELECT * FROM t1 WHERE MATCH(s2) AGAINST ('+p +"ÄŸÄ— DaÅ›i*"' IN BOOLEAN MODE); +s1 s2 +DROP TABLE t1; +"----------Test19---------" +CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,'Ä°Ã³Ã«É '); +CREATE FULLTEXT INDEX i ON t1 (char_column); +SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('"Ä°Ã³Ã«É "' IN BOOLEAN MODE); +id char_column +1 Ä°Ã³Ã«É +DROP TABLE t1; +"----------Test20---------" +CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF32, char_column2 VARCHAR(60) character set utf8) ENGINE = InnoDB; +INSERT INTO t1 (char_column) VALUES ('abcde'),('fghij'),('klmno'),('qrstu'); +UPDATE t1 SET char_column2 = char_column; +CREATE FULLTEXT INDEX i ON t1 (char_column2); +SELECT * FROM t1 WHERE MATCH(char_column) AGAINST ('abc*' IN BOOLEAN MODE); +ERROR HY000: Can't find FULLTEXT index matching the column list +DROP TABLE t1; +"----------Test22---------" +CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1,'aaa'),(2,'bbb'),(3,'ccc'); +CREATE FULLTEXT INDEX i ON t1 (char_column); +HANDLER t1 OPEN; +HANDLER t1 READ i = ('aaa'); +ERROR HY000: FULLTEXT index `i` does not support this operation +DROP TABLE t1; +"----------Test25---------" +CREATE TABLE t1 ( id INT , char_column VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_CROATIAN_CI) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'LJin'),(2,'ljin'),(3,'lmin'),(4,'LJLJLJLJLJ'); +CREATE FULLTEXT INDEX i ON t1 (char_column); +SELECT count(*) FROM t1 WHERE MATCH (char_column) AGAINST ('lj*' IN BOOLEAN MODE); +count(*) +3 +DROP TABLE t1; +"----------Test27---------" +CREATE TABLE t1 (id INT,char_column VARCHAR(60)); +CREATE TABLE t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, a TEXT)ENGINE=InnoDB; +ALTER TABLE t2 DROP a; +CREATE FULLTEXT INDEX i ON t1 (char_column); +INSERT INTO t1 values (1,'aaa'); +CREATE TABLE mdev20987_1(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB; +CREATE TABLE mdev20987_2(f1 INT NOT NULL, f2 CHAR(100), +FULLTEXT(f2), +FOREIGN KEY(f1) REFERENCES mdev20987_1(f1))ENGINE=InnoDB; +INSERT INTO mdev20987_1 VALUES(1); +INSERT INTO mdev20987_2 VALUES(1, 'mariadb'); +CREATE TABLE mdev22358 (a INT, b TEXT, FULLTEXT KEY ftidx (b)) ENGINE=InnoDB; +ALTER TABLE mdev22358 DROP KEY ftidx; +INSERT INTO mdev22358 (a) VALUES (2),(2); +ALTER TABLE mdev22358 ADD UNIQUE KEY uidx (a), ADD FULLTEXT KEY ftidx (b); +ERROR 23000: Duplicate entry '2' for key 'uidx' +# restart +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `FTS_DOC_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`FTS_DOC_ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb'); +DROP TABLE t1, t2, mdev20987_2, mdev20987_1, mdev22358; +"----------Test28---------" +create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb; +set session autocommit=0; +insert into `fts_test` values (''); +savepoint `b`; +savepoint `b`; +set session autocommit=1; +DROP TABLE fts_test; +"----------Test29---------" +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'); +start transaction; +INSERT INTO articles (title,body) VALUES +('How To Use MySQL Well','After you went through a ...'); +savepoint `a1`; +INSERT INTO articles (title,body) VALUES +('Optimizing MySQL','In this tutorial we will show ...'); +savepoint `a2`; +INSERT INTO articles (title,body) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'); +savepoint `a3`; +INSERT INTO articles (title,body) VALUES +('MySQL vs. YourSQL','In the following database comparison ...'); +savepoint `a4`; +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +rollback to savepoint a3; +select title, body from articles; +title body +MySQL Tutorial DBMS stands for DataBase ... +How To Use MySQL Well After you went through a ... +Optimizing MySQL In this tutorial we will show ... +1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +INSERT INTO articles (title,body) VALUES +('MySQL Security','When configured properly, MySQL ...'); +savepoint `a5`; +select title, body from articles; +title body +MySQL Tutorial DBMS stands for DataBase ... +How To Use MySQL Well After you went through a ... +Optimizing MySQL In this tutorial we will show ... +1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +MySQL Security When configured properly, MySQL ... +rollback to savepoint a2; +select title, body from articles; +title body +MySQL Tutorial DBMS stands for DataBase ... +How To Use MySQL Well After you went through a ... +Optimizing MySQL In this tutorial we will show ... +commit; +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +DROP TABLE articles; +"----------Test30---------" +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...'); +start transaction; +INSERT INTO articles (title,body) VALUES +('How To Use MySQL Well','After you went through a ...'); +savepoint `a1`; +INSERT INTO articles (title,body) VALUES +('Optimizing MySQL','In this tutorial we will show ...'); +savepoint `a2`; +INSERT INTO articles (title,body) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'); +savepoint `a3`; +INSERT INTO articles (title,body) VALUES +('MySQL vs. YourSQL','In the following database comparison ...'); +savepoint `a4`; +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +rollback to savepoint a3; +select title, body from articles; +title body +MySQL Tutorial DBMS stands for DataBase ... +How To Use MySQL Well After you went through a ... +Optimizing MySQL In this tutorial we will show ... +1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +INSERT INTO articles (title,body) VALUES +('MySQL Security','When configured properly, MySQL ...'); +savepoint `a5`; +select title, body from articles; +title body +MySQL Tutorial DBMS stands for DataBase ... +How To Use MySQL Well After you went through a ... +Optimizing MySQL In this tutorial we will show ... +1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +MySQL Security When configured properly, MySQL ... +rollback to savepoint a2; +select title, body from articles; +title body +MySQL Tutorial DBMS stands for DataBase ... +How To Use MySQL Well After you went through a ... +Optimizing MySQL In this tutorial we will show ... +rollback; +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +DROP TABLE articles; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ANALYZE TABLE articles; +SELECT *, MATCH(title, body) AGAINST ('-database +MySQL' IN BOOLEAN MODE) AS score from articles; +id title body score +1 MySQL Tutorial DBMS stands for DataBase ... 0 +2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186 +3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186 +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186 +5 MySQL vs. YourSQL In the following database comparison ... 0 +6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372 +SELECT *, MATCH(title, body) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score FROM articles; +id title body score +1 MySQL Tutorial DBMS stands for DataBase ... 0 +2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186 +3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186 +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186 +5 MySQL vs. YourSQL In the following database comparison ... 0 +6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372 +SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (database - tutorial)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles where MATCH(title, body) AGAINST ('MySQL - (- tutorial database) -Tricks' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles where MATCH(title, body) AGAINST ('-Tricks MySQL - (- tutorial database)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +DROP TABLE articles; +create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key, +title varchar(200),body text,fulltext(title,body)) engine=innodb; +insert into t1 set body='test'; +select * from t1 where match(title,body) against('%test'); +FTS_DOC_ID title body +1 NULL test +select * from t1 where match(title,body) against('%'); +FTS_DOC_ID title body +select * from t1 where match(title,body) against('%%%%'); +FTS_DOC_ID title body +drop table t1; +CREATE DATABASE `benu database`; +USE `benu database`; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `a` varchar(200) DEFAULT NULL, + `b` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`a`,`b`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id +1 +3 +select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +id +select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1; +id x +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1; +id x +1 0 +2 0 +3 0 +4 0 +5 0 +6 0 +select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE); +id +select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE); +id +select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE); +id +DROP DATABASE `benu database`; +USE test; +CREATE TABLE `t21` (`a` text, `b` int not null, +fulltext key (`a`), fulltext key (`a`) +) ENGINE=INNODB DEFAULT CHARSET=LATIN1; +Warnings: +Note 1831 Duplicate index `a_2`. This is deprecated and will be disallowed in a future release +ALTER TABLE `t21` ADD UNIQUE INDEX (`b`), ALGORITHM=INPLACE; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY +ALTER TABLE `t21` ADD UNIQUE INDEX (`b`); +DROP TABLE t21; +CREATE TABLE `t21` (`a` text, `b` int not null, +fulltext key (`a`)) ENGINE=INNODB DEFAULT CHARSET=LATIN1; +ALTER TABLE `t21` ADD UNIQUE INDEX (`b`); +DROP TABLE t21; +CREATE TABLE t1 ( +id INT NOT NULL, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 VALUES +(1, 'MySQL Tutorial','DBMS stands for DataBase ...') , +(2, 'How To Use MySQL Well','After you went through a ...'), +(3, 'Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +ALTER TABLE t1 ADD UNIQUE INDEX (`id`); +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id +1 +3 +select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +id +select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1; +id x +1 0 +2 0 +3 0 +DROP TABLE t1; +CREATE TABLE t1 ( +id INT NOT NULL, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 VALUES +(1, 'MySQL Tutorial','DBMS stands for DataBase ...') , +(2, 'How To Use MySQL Well','After you went through a ...'), +(3, 'Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD UNIQUE INDEX (`id`), ADD FULLTEXT INDEX idx (a,b); +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id +1 +3 +select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +id +select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +id +DROP TABLE t1; +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 VALUES +(1, 'MySQL Tutorial','DBMS stands for DataBase ...') , +(2, 'How To Use MySQL Well','After you went through a ...'), +(3, 'Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +ALTER TABLE t1 ADD UNIQUE INDEX (`FTS_DOC_ID`); +SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID +1 +3 +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1; +FTS_DOC_ID x +1 0 +2 0 +3 0 +DROP TABLE t1; +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED NOT NULL, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 VALUES +(1, 'MySQL Tutorial','DBMS stands for DataBase ...') , +(2, 'How To Use MySQL Well','After you went through a ...'), +(3, 'Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b), ADD UNIQUE INDEX FTS_DOC_ID_INDEX (FTS_DOC_ID); +SELECT FTS_DOC_ID FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +FTS_DOC_ID +1 +3 +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE); +FTS_DOC_ID +select FTS_DOC_ID, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1; +FTS_DOC_ID x +1 0 +2 0 +3 0 +DROP TABLE t1; +CREATE TABLE t2 (`b` char(2),fulltext(`b`)) ENGINE=INNODB +DEFAULT CHARSET=LATIN1; +CREATE TABLE t3 LIKE t2; +INSERT INTO `t2` VALUES(); +COMMIT WORK AND CHAIN; +INSERT INTO `t3` VALUES (); +UPDATE `t2` SET `b` = 'a'; +SAVEPOINT BATCH1; +DROP TABLE t2; +DROP TABLE t3; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +COMMIT WORK AND CHAIN; +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SAVEPOINT BATCH1; +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id +1 +2 +3 +INSERT INTO t1 (a,b) VALUES +('1002 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ROLLBACK TO SAVEPOINT BATCH1; +COMMIT; +SELECT id FROM t1 WHERE MATCH (a,b) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id +6 +1 +2 +3 +4 +5 +DROP TABLE t1; +CREATE TABLE `t` (`a` char(20) character set utf8 default null, +fulltext key (`a`)) ENGINE=INNODB; +INSERT INTO `t` VALUES ('a'); +INSERT INTO `t` VALUES ('aaa'); +SELECT MATCH(`a`) AGAINST (0x22dd22) FROM `t`; +MATCH(`a`) AGAINST (0x22dd22) +0 +0 +SELECT MATCH(`a`) AGAINST (0x2222) FROM `t`; +MATCH(`a`) AGAINST (0x2222) +0 +0 +SELECT MATCH(`a`) AGAINST (0x22) FROM `t`; +MATCH(`a`) AGAINST (0x22) +0 +0 +SELECT MATCH(`a`) AGAINST (0x2261616122) FROM `t`; +MATCH(`a`) AGAINST (0x2261616122) +0 +0.0906190574169159 +SELECT MATCH(`a`) AGAINST (0x2261dd6122) FROM `t`; +MATCH(`a`) AGAINST (0x2261dd6122) +0 +0 +SELECT MATCH(`a`) AGAINST (0x2261dd612222226122) FROM `t`; +MATCH(`a`) AGAINST (0x2261dd612222226122) +0 +0 +DROP TABLE t; +CREATE TABLE t(a CHAR(1),FULLTEXT KEY(a)) ENGINE=INNODB; +HANDLER t OPEN; +HANDLER t READ a NEXT; +a +HANDLER t READ a PREV; +a +DROP TABLE t; +CREATE TABLE `%`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB; +CREATE TABLE `A B`(a TEXT, FULLTEXT INDEX(a)) ENGINE=INNODB; +DROP TABLE `%`; +DROP TABLE `A B`; +CREATE TABLE `t-26`(a VARCHAR(10),FULLTEXT KEY(a)) ENGINE=INNODB; +INSERT INTO `t-26` VALUES('117'); +DROP TABLE `t-26`; +CREATE TABLE `t1` ( +`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, +`content` TEXT NOT NULL, +PRIMARY KEY (`id`), +FULLTEXT INDEX `IDX_CONTEXT_FULLTEXT`(`content`) +) +ENGINE = InnoDB; +insert into t1 (content) +values +('This is a story which has has a complicated phrase structure here in the +middle'), +('This is a story which doesn''t have that text'), +('This is a story that has complicated the phrase structure'); +select * from t1 +where match(content) against('"complicated phrase structure"' in boolean +mode); +id content +1 This is a story which has has a complicated phrase structure here in the +middle +select * from t1 +where match(content) against('+"complicated phrase structure"' in boolean +mode); +id content +1 This is a story which has has a complicated phrase structure here in the +middle +select * from t1 +where match(content) against('"complicated the phrase structure"' in boolean +mode); +id content +3 This is a story that has complicated the phrase structure +select * from t1 where match(content) against('+"this is a story which" +"complicated the phrase structure"' in boolean mode); +id content +select * from t1 where match(content) against('"the complicated the phrase structure"' in boolean mode); +id content +3 This is a story that has complicated the phrase structure +select * from t1 where match(content) against('"complicated a phrase structure"' in boolean mode); +id content +DROP TABLE t1; +CREATE TABLE my (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, +c VARCHAR(32), FULLTEXT(c)) ENGINE = INNODB; +INSERT INTO my (c) VALUES ('green-iguana'); +SELECT * FROM my WHERE MATCH(c) AGAINST ('green-iguana'); +id c +1 green-iguana +DROP TABLE my; +CREATE TABLE ift ( +`a` int(11) NOT NULL, +`b` text, +PRIMARY KEY (`a`), +FULLTEXT KEY `b` (`b`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +INSERT INTO ift values (1, "skip"); +INSERT INTO ift values (2, "skip and networking"); +INSERT INTO ift values (3, "--skip-networking"); +INSERT INTO ift values (4, "-donot--skip-networking"); +SELECT * FROM ift WHERE MATCH (b) AGAINST ('--skip-networking'); +a b +2 skip and networking +3 --skip-networking +4 -donot--skip-networking +1 skip +SELECT * FROM ift WHERE MATCH (b) AGAINST ('skip-networking'); +a b +2 skip and networking +3 --skip-networking +4 -donot--skip-networking +1 skip +SELECT * FROM ift WHERE MATCH (b) AGAINST ('----'); +a b +SELECT * FROM ift WHERE MATCH (b) AGAINST ('-donot--skip-networking'); +a b +4 -donot--skip-networking +2 skip and networking +3 --skip-networking +1 skip +DROP TABLE ift; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('( that''s me )','When configured properly, MySQL ...'); +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('( yours''s* )' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('s*' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('stands\'] | * | show[@database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +5 MySQL vs. YourSQL In the following database comparison ... +DROP TABLE articles; +CREATE TABLE t1(a TEXT CHARACTER SET LATIN1, FULLTEXT INDEX(a)) ENGINE=INNODB; +SELECT * FROM t1 WHERE MATCH(a) AGAINST("*"); +ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +FULLTEXT (a) +) ENGINE= InnoDB; +INSERT INTO t1 (a) VALUES +('Do you know MySQL is a good database'), +('How to build a good database'), +('Do you know'), +('Do you know MySQL'), +('How to use MySQL'), +('Do you feel good'), +('MySQL is good'), +('MySQL is good to know'), +('What is database'); +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know mysql"' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +4 Do you know MySQL +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql")' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +4 Do you know MySQL +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('("know mysql" good)' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +4 Do you know MySQL +2 How to build a good database +6 Do you feel good +7 MySQL is good +8 MySQL is good to know +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql" good)' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +4 Do you know MySQL +2 How to build a good database +6 Do you feel good +7 MySQL is good +8 MySQL is good to know +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('(good "know mysql")' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +4 Do you know MySQL +2 How to build a good database +6 Do you feel good +7 MySQL is good +8 MySQL is good to know +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+(good "know mysql")' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +4 Do you know MySQL +2 How to build a good database +6 Do you feel good +7 MySQL is good +8 MySQL is good to know +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+("know mysql" "good database")' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +2 How to build a good database +4 Do you know MySQL +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know mysql" +"good database"' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know database"@4' IN BOOLEAN MODE); +id a +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"know database"@8' IN BOOLEAN MODE); +id a +1 Do you know MySQL is a good database +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +FULLTEXT (a) +) ENGINE= InnoDB; +INSERT INTO t1 (a) VALUES +('know mysql good database'); +SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"good database"' IN BOOLEAN MODE); +id a +1 know mysql good database +DROP TABLE t1; +CREATE TABLE t1(f1 TEXT, FULLTEXT KEY(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES(repeat("this is the test case", 500)); +ALTER TABLE t1 KEY_BLOCK_SIZE=4; +ALTER TABLE t1 KEY_BLOCK_SIZE=0; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result new file mode 100644 index 00000000..52cbede7 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result @@ -0,0 +1,995 @@ +set names utf8; +call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns."); +call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`t1`"); +CREATE TABLE t1 ( +id1 INT , +a1 VARCHAR(200) , +b1 TEXT , +FULLTEXT KEY (a1,b1), PRIMARY KEY (a1, id1) +) CHARACTER SET = utf8 , ENGINE = InnoDB; +CREATE TABLE t2 ( +id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a2 VARCHAR(200), +b2 TEXT , +FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE, +FULLTEXT KEY (b2,a2) +) CHARACTER SET = utf8 ,ENGINE = InnoDB; +INSERT INTO t1 (id1,a1,b1) VALUES +(1,'MySQL Tutorial','DBMS stands for DataBase VÃÆ·WÄ°...') , +(2,'How To Use MySQL Well','After you went through a ...'), +(3,'Optimizing MySQL','In this tutorial we will show ...'); +INSERT INTO t1 (id1,a1,b1) VALUES +(4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +(5,'MySQL vs. YourSQL','In the following database comparison ...'), +(6,'MySQL Security','When configured properly, MySQL ...'); +INSERT INTO t2 (a2,b2) VALUES +('MySQL Tutorial','DBMS stands for DataBase VÃÆ·WÄ°...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +INSERT INTO t2 (a2,b2) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +INSERT INTO t2 (a2,b2) VALUES +('MySQL Tricks','1. Never run mysqld as root. 2. ...'); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE) +DELETE FROM t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE) +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'b1' +test.t1 analyze status OK +ANALYZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze Warning Engine-independent statistics are not collected for column 'b2' +test.t2 analyze status OK +SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1; +id1 +1 +3 +SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2; +id2 +1 +3 +SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ORDER BY id1; +id1 +1 +2 +3 +4 +5 +6 +SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ORDER BY id2; +id2 +1 +2 +3 +4 +5 +6 +SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1; +id1 +1 +2 +3 +4 +5 +6 +SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2; +id2 +1 +2 +3 +4 +5 +6 +SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ; +id1 +1 +SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ; +id2 +1 +set global innodb_optimize_fulltext_only=1; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +set global innodb_optimize_fulltext_only=0; +UPDATE t1 SET a1 = "changing column - on update cascade" , b1 = "to check foreign constraint" WHERE +MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +id1 +SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +id2 +3 +6 +SELECT id1 FROM t1 WHERE MATCH (a1,b1) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id1; +id1 +1 +2 +3 +4 +5 +6 +SELECT id2 FROM t2 WHERE MATCH (a2,b2) AGAINST ('+update +cascade' IN BOOLEAN MODE) ORDER BY id2; +id2 +1 +2 +3 +4 +5 +6 +SELECT id2 FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2; +id2 +1 +2 +3 +4 +5 +6 +DROP TABLE t2 , t1; +create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB; +create table t2 (s1 int, s2 varchar(200), +fulltext key(s2), +foreign key (s1,s2) references t1 (s1,s2) on update cascade) ENGINE = InnoDB; +insert into t1 values (1,'Sunshine'),(2,'Lollipops'); +insert into t2 values (1,'Sunshine'),(2,'Lollipops'); +update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine'; +commit; +select * from t2 where match(s2) against ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB; +create table t2 (s1 int, s2 varchar(200), +fulltext key(s2), +foreign key (s1,s2) references t1 (s1,s2) on delete cascade) ENGINE = InnoDB; +insert into t1 values (1,'Sunshine'),(2,'Lollipops'); +insert into t2 values (1,'Sunshine'),(2,'Lollipops'); +delete from t1 where s2 <> 'Sunshine'; +select * from t2 where match(s2) against ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB; +create table t2 (s1 int, s2 varchar(200), +fulltext key(s2), +foreign key (s1,s2) references t1 (s1,s2) on delete set null) ENGINE = InnoDB; +insert into t1 values (1,'Sunshine'),(2,'Lollipops'); +insert into t2 values (1,'Sunshine'),(2,'Lollipops'); +delete from t1 where s2 <> 'Sunshine'; +select * from t2 where match(s2) against ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +create table t1 (s1 int, s2 varchar(200), primary key (s1,s2)) ENGINE = InnoDB; +create table t2 (s1 int, s2 varchar(200), +fulltext key(s2), +foreign key (s1,s2) references t1 (s1,s2) on update set null) ENGINE = InnoDB; +insert into t1 values (1,'Sunshine'),(2,'Lollipops'); +insert into t2 values (1,'Sunshine'),(2,'Lollipops'); +update t1 set s2 = 'Rainbows' where s2 <> 'Sunshine'; +commit; +select * from t2 where match(s2) against ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +create table t1 (s1 bigint unsigned not null, s2 varchar(200), +primary key (s1,s2)) ENGINE = InnoDB; +create table t2 (FTS_DOC_ID BIGINT UNSIGNED NOT NULL, s2 varchar(200), +foreign key (FTS_DOC_ID) references t1 (s1) +on update cascade) ENGINE = InnoDB; +create fulltext index idx on t2(s2); +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `FTS_DOC_ID` bigint(20) unsigned NOT NULL, + `s2` varchar(200) DEFAULT NULL, + KEY `FTS_DOC_ID` (`FTS_DOC_ID`), + FULLTEXT KEY `idx` (`s2`), + CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`FTS_DOC_ID`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +insert into t1 values (1,'Sunshine'),(2,'Lollipops'); +insert into t2 values (1,'Sunshine'),(2,'Lollipops'); +update t1 set s1 = 3 where s1=1; +select * from t2 where match(s2) against ('sunshine'); +FTS_DOC_ID s2 +3 Sunshine +update t1 set s1 = 1 where s1=3; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`FTS_DOC_ID`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) +DROP TABLE t2 , t1; +CREATE TABLE t1 ( +id1 INT , +a1 VARCHAR(200) PRIMARY KEY, +b1 TEXT character set utf8 , +FULLTEXT KEY (a1,b1) +) CHARACTER SET = utf8 ,ENGINE = InnoDB; +CREATE TABLE t2 ( +id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a2 VARCHAR(200), +b2 TEXT character set utf8 , +FOREIGN KEY (a2) REFERENCES t1(a1) ON DELETE CASCADE, +FULLTEXT KEY (b2,a2) +) CHARACTER SET = utf8 ,ENGINE = InnoDB; +INSERT INTO t1 (id1,a1,b1) VALUES +(1,'MySQL Tutorial','DBMS stands for DataBase VÃÆ·WÄ°...') , +(2,'How To Use MySQL Well','After you went through a ...'), +(3,'Optimizing MySQL','In this tutorial we will show ...'), +(4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +(5,'MySQL vs. YourSQL','In the following database comparison ...'), +(6,'MySQL Security','When configured properly, MySQL ...'); +INSERT INTO t2 (a2,b2) VALUES +('MySQL Tutorial','DBMS stands for DataBase VÃÆ·WÄ°...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +DELETE FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +id1 a1 b1 +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +id2 a2 b2 +SELECT * FROM t1 WHERE a1 LIKE '%tutorial%'; +id1 a1 b1 +SELECT * FROM t2 WHERE a2 LIKE '%tutorial%'; +id2 a2 b2 +DROP TABLE t2 , t1; +call mtr.add_suppression("\\[ERROR\\] InnoDB: FTS Doc ID must be larger than 3 for table `test`.`t2`"); +CREATE TABLE t1 ( +id1 INT , +a1 VARCHAR(200) , +b1 TEXT , +FULLTEXT KEY (a1,b1), PRIMARY KEY(a1, id1) +) CHARACTER SET = utf8 , ENGINE = InnoDB; +CREATE TABLE t2 ( +id2 INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a2 VARCHAR(200), +b2 TEXT , +FOREIGN KEY (a2) REFERENCES t1(a1) ON UPDATE CASCADE, +FULLTEXT KEY (b2,a2) +) CHARACTER SET = utf8 ,ENGINE = InnoDB; +INSERT INTO t1 (id1,a1,b1) VALUES +(1,'MySQL Tutorial','DBMS stands for DataBase VÃÆ·WÄ°...') , +(2,'How To Use MySQL Well','After you went through a ...'), +(3,'Optimizing MySQL','In this tutorial we will show ...'); +INSERT INTO t2 (a2,b2) VALUES +('MySQL Tutorial','DBMS stands for DataBase VÃÆ·WÄ°...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +START TRANSACTION; +INSERT INTO t1 (id1,a1,b1) VALUES +(4,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +(5,'MySQL vs. YourSQL','In the following database comparison ...'), +(6,'MySQL Security','When configured properly, MySQL ...'); +INSERT INTO t2 (a2,b2) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +INSERT INTO t2 (a2,b2) VALUES +('MySQL Tricks','1. Never run mysqld as root. 2. ...'); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE) +DELETE FROM t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a2`) REFERENCES `t1` (`a1`) ON UPDATE CASCADE) +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial') ORDER BY id1; +id1 a1 b1 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial') ORDER BY id2; +id2 a2 b2 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ORDER BY id1; +id1 a1 b1 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ORDER BY id2; +id2 a2 b2 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id1; +id1 a1 b1 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY id2; +id2 a2 b2 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ; +id1 a1 b1 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"dbms database"@4' IN BOOLEAN MODE) ; +id2 a2 b2 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root') ; +id1 a1 b1 +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root') ; +id2 a2 b2 +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('mysqld (+root)' IN BOOLEAN MODE) ; +id1 a1 b1 +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('mysqld (-root)' IN BOOLEAN MODE) ; +id2 a2 b2 +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('root' WITH QUERY EXPANSION) ; +id1 a1 b1 +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('root' WITH QUERY EXPANSION) ; +id2 a2 b2 +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ; +id1 a1 b1 +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('"database comparison"@02' IN BOOLEAN MODE) ; +id2 a2 b2 +SELECT * FROM t1 ORDER BY id1; +id1 a1 b1 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM t2 ORDER BY id2; +id2 a2 b2 +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +COMMIT; +START TRANSACTION; +UPDATE t1 SET a1 = "changing column - on UPDATE cascade" , b1 = "to check foreign constraint" WHERE +MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +COMMIT; +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +id1 a1 b1 +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('tutorial (+mysql -VÃÆ·WÄ°)' IN BOOLEAN MODE) ; +id2 a2 b2 +3 changing column - on UPDATE cascade In this tutorial we will show ... +6 changing column - on UPDATE cascade When configured properly, MySQL ... +SELECT * FROM t1 WHERE MATCH (a1,b1) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id1; +id1 a1 b1 +1 changing column - on UPDATE cascade to check foreign constraint +2 changing column - on UPDATE cascade to check foreign constraint +3 changing column - on UPDATE cascade to check foreign constraint +4 changing column - on UPDATE cascade to check foreign constraint +5 changing column - on UPDATE cascade to check foreign constraint +6 changing column - on UPDATE cascade to check foreign constraint +SELECT * FROM t2 WHERE MATCH (a2,b2) AGAINST ('+UPDATE +cascade' IN BOOLEAN MODE) ORDER BY id2; +id2 a2 b2 +1 changing column - on UPDATE cascade DBMS stands for DataBase VÃÆ·WÄ°... +2 changing column - on UPDATE cascade After you went through a ... +3 changing column - on UPDATE cascade In this tutorial we will show ... +4 changing column - on UPDATE cascade 1. Never run mysqld as root. 2. ... +5 changing column - on UPDATE cascade In the following database comparison ... +6 changing column - on UPDATE cascade When configured properly, MySQL ... +SELECT * FROM t2 WHERE a2 LIKE '%UPDATE CASCADE%' ORDER BY id2; +id2 a2 b2 +1 changing column - on UPDATE cascade DBMS stands for DataBase VÃÆ·WÄ°... +2 changing column - on UPDATE cascade After you went through a ... +3 changing column - on UPDATE cascade In this tutorial we will show ... +4 changing column - on UPDATE cascade 1. Never run mysqld as root. 2. ... +5 changing column - on UPDATE cascade In the following database comparison ... +6 changing column - on UPDATE cascade When configured properly, MySQL ... +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine'; +COMMIT; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +DELETE FROM t1 WHERE s2 <> 'Sunshine'; +COMMIT; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +DELETE FROM t1 WHERE s2 <> 'Sunshine'; +COMMIT; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine'; +COMMIT; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE cascade) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine'; +ROLLBACK; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE cascade) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +DELETE FROM t1 WHERE s2 <> 'Sunshine'; +ROLLBACK; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on DELETE SET NULL) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +DELETE FROM t1 WHERE s2 <> 'Sunshine'; +ROLLBACK; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +CREATE TABLE t1 (s1 INT, s2 VARCHAR(200), PRIMARY KEY (s1,s2)) ENGINE = InnoDB; +CREATE TABLE t2 (s1 INT, s2 VARCHAR(200), +FULLTEXT KEY(s2), +FOREIGN KEY (s1,s2) REFERENCES t1 (s1,s2) on UPDATE SET NULL) ENGINE = InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'Sunshine'),(2,'Lollipops'); +INSERT INTO t2 VALUES (1,'Sunshine'),(2,'Lollipops'); +UPDATE t1 set s2 = 'Rainbows' WHERE s2 <> 'Sunshine'; +ROLLBACK; +SELECT * FROM t2 WHERE MATCH(s2) AGAINST ('Lollipops'); +s1 s2 +DROP TABLE t2 , t1; +set global innodb_file_per_table=1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = utf8, ROW_FORMAT=COMPRESSED, ENGINE = InnoDB; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','DBMS stands for DataBase VÃÆ·WÄ°...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `a` varchar(200) DEFAULT NULL, + `b` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`a`,`b`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci ROW_FORMAT=COMPRESSED +SELECT count(*) FROM information_schema.innodb_sys_tables WHERE name LIKE "%FTS_%" AND space !=0; +count(*) +11 +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ANALYZE TABLE t1; +SELECT * FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id; +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +3 Optimizing MySQL In this tutorial we will show ... +select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÃÆ·WÄ°" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +select * from t1 where MATCH(a,b) AGAINST("+-VÃÆ·WÄ°" IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected '-' +select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE); +id a b +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id; +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +select *, MATCH(a,b) AGAINST("mysql stands" IN BOOLEAN MODE) as x from t1 ORDER BY id; +id a b x +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... 0.6055193543434143 +2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186 +3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186 +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186 +5 MySQL vs. YourSQL In the following database comparison ... 0.000000001885928302414186 +6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372 +select * from t1 where MATCH a,b AGAINST ("+database* +VÃÆ·W*" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE); +id a b +select * from t1 where MATCH(a,b) AGAINST ("VÃÆ·WÄ°" WITH QUERY EXPANSION) ORDER BY id; +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +ALTER TABLE t1 DROP INDEX idx; +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT * FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id; +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +3 Optimizing MySQL In this tutorial we will show ... +select * from t1 where MATCH(a,b) AGAINST("+tutorial +VÃÆ·WÄ°" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +select * from t1 where MATCH(a,b) AGAINST("+dbms" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +select * from t1 where MATCH(a,b) AGAINST("+Mysql +(tricks never)" IN BOOLEAN MODE); +id a b +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +select * from t1 where MATCH(a,b) AGAINST("+mysql -(tricks never)" IN BOOLEAN MODE) ORDER BY id; +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +select *, MATCH(a,b) AGAINST("mysql VÃÆ·WÄ°" IN BOOLEAN MODE) as x from t1 ORDER BY id; +id a b x +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... 0.6055193543434143 +2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186 +3 Optimizing MySQL In this tutorial we will show ... 0.000000001885928302414186 +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... 0.000000001885928302414186 +5 MySQL vs. YourSQL In the following database comparison ... 0.000000001885928302414186 +6 MySQL Security When configured properly, MySQL ... 0.000000003771856604828372 +select * from t1 where MATCH a,b AGAINST ('"security mysql"' IN BOOLEAN MODE); +id a b +select * from t1 where MATCH(a,b) AGAINST ("VÃÆ·WÄ°" WITH QUERY EXPANSION) ORDER BY id; +id a b +1 MySQL Tutorial DBMS stands for DataBase VÃÆ·WÄ°... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...'); +INSERT INTO t1 (a,b) VALUES +('test proximity search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test proximity fts search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test more proximity fts search, test, more proximity and phrase', +'search, with proximity innodb'); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id a b +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"proximity search"@1' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE) ORDER BY id; +id a b +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE) ORDER BY id; +id a b +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"more test proximity"@2' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id a b +10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"more fts proximity"@03' IN BOOLEAN MODE); +id a b +10 test more proximity fts search, test, more proximity and phrase search, with proximity innodb +UPDATE t1 SET a = UPPER(a) , b = UPPER(b) ; +UPDATE t1 SET a = UPPER(a) , b = LOWER(b) ; +select * from t1 where MATCH(a,b) AGAINST("+tutorial +dbms" IN BOOLEAN MODE); +id a b +1 MYSQL TUTORIAL dbms stands for database vðʒwi... +select * from t1 where MATCH(a,b) AGAINST("+VÃÆ·WÄ°" IN BOOLEAN MODE); +id a b +1 MYSQL TUTORIAL dbms stands for database vðʒwi... +SELECT * FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) ORDER BY id; +id a b +1 MYSQL TUTORIAL dbms stands for database vðʒwi... +3 OPTIMIZING MYSQL in this tutorial we will show ... +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"proximity search"@14' IN BOOLEAN MODE); +SELECT * FROM t1 WHERE MATCH (a,b) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id a b +SELECT * FROM t1 ORDER BY id; +id a b +2 HOW TO USE MYSQL WELL after you went through a ... +4 1001 MYSQL TRICKS 1. never run mysqld as root. 2. ... +5 MYSQL VS. YOURSQL in the following database comparison ... +6 MYSQL SECURITY when configured properly, mysql ... +7 TEST QUERY EXPANSION for database ... +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = utf8, ENGINE=InnoDB; +INSERT INTO t1 (a,b) VALUES +('Я могу еÑÑ‚ÑŒ Ñтекло', 'оно мне не вредит'), +('Мога да Ñм Ñтъкло', 'то не ми вреди'), +('ΜποÏῶ νὰ φάω σπασμÎνα' ,'γυαλιὰ χωÏὶς νὰ πάθω τίποτα'), +('PÅ™ÃliÅ¡ žluÅ¥ouÄký kůň', 'úpÄ›l Äábelské kódy'), +('Sævör grét', 'áðan þvà úlpan var ónýt'), +('ã†ã‚ã®ãŠãã‚„ã¾','ã‘ãµã“ãˆã¦'), +('ã„ã‚ã¯ã«ã»ã¸ã©ã€€ã¡ã‚Šã¬ã‚‹','ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš'); +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','request docteam@oraclehelp.com ...') , +('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...') , +('when To Use MySQL Well','for free faq mail@xyz.com ...'); +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("вредит χωÏὶς") ORDER BY id; +id a b +1 Я могу еÑÑ‚ÑŒ Ñтекло оно мне не вредит +3 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("оно" WITH QUERY EXPANSION); +id a b +1 Я могу еÑÑ‚ÑŒ Ñтекло оно мне не вредит +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE) ORDER BY id; +id a b +1 Я могу еÑÑ‚ÑŒ Ñтекло оно мне не вредит +2 Мога да Ñм Ñтъкло то не ми вреди +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+γυαλιὰ +tutorial" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+tutorial +(Мога τίποτα)" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš"); +id a b +7 ã„ã‚ã¯ã«ã»ã¸ã©ã€€ã¡ã‚Šã¬ã‚‹ ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("ã¡ã‚Šã¬ã‚‹" WITH QUERY EXPANSION); +id a b +7 ã„ã‚ã¯ã«ã»ã¸ã©ã€€ã¡ã‚Šã¬ã‚‹ ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("+ã‚ã•ãゆã‚ã¿ã˜ã€€+ã‚‘ã²ã‚‚ã›ãš" IN BOOLEAN MODE); +id a b +7 ã„ã‚ã¯ã«ã»ã¸ã©ã€€ã¡ã‚Šã¬ã‚‹ ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("ã†ã‚ã®ãŠã*" IN BOOLEAN MODE); +id a b +6 ã†ã‚ã®ãŠãã‚„ã¾ ã‘ãµã“ãˆã¦ +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE); +id a b +5 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"γυαλιὰ χωÏὶς"@2' IN BOOLEAN MODE); +id a b +3 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"query performace"@02' IN BOOLEAN MODE); +id a b +9 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"πάθω τίποτα"@2' IN BOOLEAN MODE); +id a b +3 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"ã‚ã•ãゆã‚ã¿ã˜ ã‚‘ã²ã‚‚ã›ãš"@1' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"ã‚ã•ãゆã‚ã¿ã˜ ã‚‘ã²ã‚‚ã›ãš"@2' IN BOOLEAN MODE); +id a b +7 ã„ã‚ã¯ã«ã»ã¸ã©ã€€ã¡ã‚Šã¬ã‚‹ ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš +ALTER TABLE t1 DROP INDEX idx; +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("ã‚ã•ãゆã‚ã¿ã˜ ã‚‘ã²ã‚‚ã›ãš"); +id a b +7 ã„ã‚ã¯ã«ã»ã¸ã©ã€€ã¡ã‚Šã¬ã‚‹ ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš +UPDATE t1 SET a = "Pchnąć w tÄ™ łódź jeża" , b = "lub osiem skrzyÅ„ fig" WHERE MATCH(a,b) AGAINST ("ã‚ã•ãゆã‚ã¿ã˜ ã‚‘ã²ã‚‚ã›ãš"); +UPDATE t1 SET a = "Ð’ чащах юга жил-был цитруÑ? Да", b = "но фальшивый ÑкземплÑÑ€! Ñ‘ÑŠ" WHERE MATCH(a,b) AGAINST ("вред*" IN BOOLEAN MODE); +DELETE FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE); +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("ã‚ã•ãゆã‚ã¿ã˜ã€€ã‚‘ã²ã‚‚ã›ãš"); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("łódź osiem"); +id a b +7 Pchnąć w tÄ™ łódź jeża lub osiem skrzyÅ„ fig +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("вред*" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("фальшив*" IN BOOLEAN MODE) ORDER BY id; +id a b +1 Ð’ чащах юга жил-был цитруÑ? Да но фальшивый ÑкземплÑÑ€! Ñ‘ÑŠ +2 Ð’ чащах юга жил-был цитруÑ? Да но фальшивый ÑкземплÑÑ€! Ñ‘ÑŠ +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+Sævör +úlpan" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"łódź jeża"@2' IN BOOLEAN MODE); +id a b +7 Pchnąć w tÄ™ łódź jeża lub osiem skrzyÅ„ fig +SELECT * FROM t1 ORDER BY id; +id a b +1 Ð’ чащах юга жил-был цитруÑ? Да но фальшивый ÑкземплÑÑ€! Ñ‘ÑŠ +2 Ð’ чащах юга жил-был цитруÑ? Да но фальшивый ÑкземплÑÑ€! Ñ‘ÑŠ +3 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +4 PÅ™ÃliÅ¡ žluÅ¥ouÄký kůň úpÄ›l Äábelské kódy +6 ã†ã‚ã®ãŠãã‚„ã¾ ã‘ãµã“ãˆã¦ +7 Pchnąć w tÄ™ łódź jeża lub osiem skrzyÅ„ fig +8 MySQL Tutorial request docteam@oraclehelp.com ... +9 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +10 when To Use MySQL Well for free faq mail@xyz.com ... +DROP TABLE t1; +CREATE TABLE t1(ID INT PRIMARY KEY, +no_fts_field VARCHAR(10), +fts_field VARCHAR(10), +FULLTEXT INDEX f(fts_field)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'AAA', 'BBB'); +SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB"); +ID no_fts_field fts_field +1 AAA BBB +UPDATE t1 SET fts_field='anychange' where id = 1; +SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange"); +ID no_fts_field fts_field +1 AAA anychange +UPDATE t1 SET no_fts_field='anychange' where id = 1; +SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange"); +ID no_fts_field fts_field +1 anychange anychange +UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1; +SELECT * FROM t1 WHERE MATCH(fts_field) against("other"); +ID no_fts_field fts_field +1 anychange other +SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB"); +ID no_fts_field fts_field +DROP INDEX f on t1; +UPDATE t1 SET fts_field='anychange' where id = 1; +UPDATE t1 SET no_fts_field='anychange' where id = 1; +UPDATE t1 SET no_fts_field='anychange', fts_field='other' where id = 1; +CREATE FULLTEXT INDEX f ON t1(FTS_FIELD); +SELECT * FROM t1 WHERE MATCH(fts_field) against("other"); +ID no_fts_field fts_field +1 anychange other +DROP TABLE t1; +CREATE TABLE t1(`FTS_DOC_ID` serial, +no_fts_field VARCHAR(10), +fts_field VARCHAR(10), +FULLTEXT INDEX f(fts_field)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'AAA', 'BBB'); +UPDATE t1 SET fts_field='anychange' where FTS_DOC_ID = 1; +ERROR HY000: Invalid InnoDB FTS Doc ID +UPDATE t1 SET fts_field='anychange', FTS_DOC_ID = 2 where FTS_DOC_ID = 1; +SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange"); +FTS_DOC_ID no_fts_field fts_field +2 AAA anychange +SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB"); +FTS_DOC_ID no_fts_field fts_field +UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2; +SELECT * FROM t1 WHERE MATCH(fts_field) against("anychange"); +FTS_DOC_ID no_fts_field fts_field +2 anychange anychange +UPDATE t1 SET no_fts_field='anychange', fts_field='other' where FTS_DOC_ID = 2; +ERROR HY000: Invalid InnoDB FTS Doc ID +SELECT * FROM t1 WHERE MATCH(fts_field) against("other"); +FTS_DOC_ID no_fts_field fts_field +UPDATE t1 SET FTS_DOC_ID = 1 where FTS_DOC_ID = 2; +ERROR HY000: Invalid InnoDB FTS Doc ID +DROP INDEX f ON t1; +UPDATE t1 SET fts_field='newchange' where FTS_DOC_ID = 2; +UPDATE t1 SET no_fts_field='anychange' where FTS_DOC_ID = 2; +SELECT * FROM t1; +FTS_DOC_ID no_fts_field fts_field +2 anychange newchange +DROP TABLE t1; +CREATE TABLE t1(ID INT PRIMARY KEY, +no_fts_field VARCHAR(10), +fts_field VARCHAR(10), +FULLTEXT INDEX f(fts_field), index k(fts_field)) ENGINE=INNODB; +CREATE TABLE t2(ID INT PRIMARY KEY, +no_fts_field VARCHAR(10), +fts_field VARCHAR(10), +FULLTEXT INDEX f(fts_field), +INDEX k2(fts_field), +FOREIGN KEY(fts_field) REFERENCES +t1(fts_field) ON UPDATE CASCADE) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 'AAA', 'BBB'); +INSERT INTO t2 VALUES (1, 'AAA', 'BBB'); +update t1 set fts_field='newchange' where id =1; +SELECT * FROM t1 WHERE MATCH(fts_field) against("BBB"); +ID no_fts_field fts_field +SELECT * FROM t2 WHERE MATCH(fts_field) against("BBB"); +ID no_fts_field fts_field +SELECT * FROM t1 WHERE MATCH(fts_field) against("newchange"); +ID no_fts_field fts_field +1 AAA newchange +SELECT * FROM t2 WHERE MATCH(fts_field) against("newchange"); +ID no_fts_field fts_field +1 AAA newchange +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1(id INT PRIMARY KEY, +fts_field VARCHAR(10), +FULLTEXT INDEX f(fts_field)) ENGINE=INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, +fts_field VARCHAR(10), +FULLTEXT INDEX f(fts_field)) ENGINE=INNODB; +INSERT INTO t1 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800'),(9,'900'),(10,'1000'),(11,'1100'),(12,'1200'); +INSERT INTO t2 values (1,'100'),(2,'200'),(3,'300'),(4,'400'),(5,'500'),(6,'600'), (7,'700'),(8,'800'); +UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo'); +UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'foo') WHERE t1.fts_field = "100foo"; +UPDATE t1, t2 set t1.fts_field = CONCAT(t1.fts_field, 'xoo'), t2.fts_field = CONCAT(t1.fts_field, 'xoo') where t1.fts_field=CONCAT(t2.fts_field, 'foo'); +SELECT * FROM t1 WHERE MATCH(fts_field) against("100foofoo"); +id fts_field +1 100foofoo +SELECT * FROM t1 WHERE MATCH(fts_field) against("100foo"); +id fts_field +SELECT * FROM t1 WHERE MATCH(fts_field) against("100"); +id fts_field +SELECT * FROM t2 WHERE MATCH(fts_field) against("400fooxoo"); +id fts_field +4 400fooxoo +SELECT * FROM t2 WHERE MATCH(fts_field) against("100"); +id fts_field +1 100 +SELECT * FROM t2 WHERE MATCH(fts_field) against("200"); +id fts_field +SELECT * FROM t2 WHERE MATCH(fts_field) against("400"); +id fts_field +DROP TABLE t1; +DROP TABLE t2; + +BUG#13701973/64274: MYSQL THREAD WAS SUSPENDED WHEN EXECUTE UPDATE QUERY + +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +CREATE TABLE t1 ( +t1_id INT(10) UNSIGNED NOT NULL, +t2_id INT(10) UNSIGNED DEFAULT NULL, +PRIMARY KEY (t1_id), +FOREIGN KEY (t2_id) REFERENCES t2 (t2_id) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t2 ( +t1_id INT(10) UNSIGNED NOT NULL, +t2_id INT(10) UNSIGNED NOT NULL, +t3_id INT(10) UNSIGNED NOT NULL, +t4_id INT(10) UNSIGNED NOT NULL, +PRIMARY KEY (t2_id), +FOREIGN KEY (t1_id) REFERENCES t1 (t1_id), +FOREIGN KEY (t3_id) REFERENCES t3 (t3_id) +ON DELETE CASCADE ON UPDATE CASCADE, +FOREIGN KEY (t4_id) REFERENCES t4 (t4_id) +) ENGINE=InnoDB; +CREATE TABLE t3 ( +t3_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +payload char(3), +PRIMARY KEY (t3_id) +) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1, '100'); +CREATE TABLE t4 ( +t2_id INT(10) UNSIGNED DEFAULT NULL, +t4_id INT(10) UNSIGNED NOT NULL, +PRIMARY KEY (t4_id), +FOREIGN KEY (t2_id) REFERENCES t2 (t2_id) +ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +UPDATE t3 SET payload='101' WHERE t3_id=1; +SET FOREIGN_KEY_CHECKS=0; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; +# +# InnoDB: Failing assertion: result != FTS_INVALID in +# fts_trx_row_get_new_state +# +SET FOREIGN_KEY_CHECKS=1; +CREATE TABLE t1 (pk INT PRIMARY KEY, +f1 VARCHAR(10), f2 VARCHAR(10), +f3 VARCHAR(10), f4 VARCHAR(10), +f5 VARCHAR(10), f6 VARCHAR(10), +f7 VARCHAR(10), f8 VARCHAR(10), +FULLTEXT(f1), FULLTEXT(f2), FULLTEXT(f3), FULLTEXT(f4), +FULLTEXT(f5), FULLTEXT(f6), FULLTEXT(f7), FULLTEXT(f8), +INDEX(f1), INDEX(f2), INDEX(f3), INDEX(f4), +INDEX(f5), INDEX(f6), INDEX(f7), INDEX(f8)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'mariadb', 'mariadb', 'mariadb', 'mariadb', +'mariadb', 'mariadb', 'mariadb', 'mariadb'), +(2, 'mariadb', 'mariadb', 'mariadb', 'mariadb', +'mariadb', 'mariadb', 'mariadb', 'mariadb'), +(3, 'innodb', 'innodb', 'innodb', 'innodb', +'innodb', 'innodb', 'innodb', 'innodb'); +ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t1 (f2) ON DELETE SET NULL; +START TRANSACTION; +DELETE FROM t1 where f1='mariadb'; +SELECT * FROM t1; +pk f1 f2 f3 f4 f5 f6 f7 f8 +2 NULL mariadb mariadb mariadb mariadb mariadb mariadb mariadb +3 innodb innodb innodb innodb innodb innodb innodb innodb +ROLLBACK; +ALTER TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f4) ON DELETE CASCADE; +START TRANSACTION; +DELETE FROM t1 where f3='mariadb'; +SELECT * FROM t1; +pk f1 f2 f3 f4 f5 f6 f7 f8 +3 innodb innodb innodb innodb innodb innodb innodb innodb +ROLLBACK; +ALTER TABLE t1 ADD FOREIGN KEY (f5) REFERENCES t1 (f6) ON UPDATE SET NULL; +UPDATE t1 SET f6='update'; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL) +ALTER TABLE t1 ADD FOREIGN KEY (f7) REFERENCES t1 (f8) ON UPDATE CASCADE; +UPDATE t1 SET f6='cascade'; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL) +DROP TABLE t1; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +# +# MDEV-25536 sym_node->table != NULL in pars_retrieve_table_def +# +CREATE TABLE t1 (f1 TEXT,FULLTEXT (f1)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SET GLOBAL innodb_ft_aux_table='test/t1'; +SELECT * FROM information_schema.innodb_ft_deleted; +DOC_ID +DROP TABLE t1; +SET GLOBAL innodb_ft_aux_table=DEFAULT; +# +# MDEV-19522 InnoDB commit fails when FTS_DOC_ID value +# is greater than 4294967295 +# +CREATE TABLE t1( +FTS_DOC_ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, +f1 TEXT, f2 TEXT, PRIMARY KEY (FTS_DOC_ID), +FULLTEXT KEY (f1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,'txt','bbb'); +UPDATE t1 SET FTS_DOC_ID = 4294967298; +SELECT * FROM t1 WHERE match(f1) against("txt"); +FTS_DOC_ID f1 f2 +4294967298 txt bbb +SET @@session.insert_id = 100000000000; +INSERT INTO t1(f1, f2) VALUES ('aaa', 'bbb'); +CREATE FULLTEXT INDEX i ON t1 (f2); +SELECT * FROM t1 WHERE match(f2) against("bbb"); +FTS_DOC_ID f1 f2 +4294967298 txt bbb +100000000000 aaa bbb +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result b/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result new file mode 100644 index 00000000..bbf6f3ee --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result @@ -0,0 +1,211 @@ +drop table if exists t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB STATS_PERSISTENT=0; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'); +ALTER TABLE t1 ADD FULLTEXT INDEX idx_1 (a); +ALTER TABLE t1 ADD FULLTEXT INDEX idx_2 (b); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `a` varchar(200) DEFAULT NULL, + `b` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx_1` (`a`), + FULLTEXT KEY `idx_2` (`b`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0 +START TRANSACTION; +INSERT INTO t1 (a,b) VALUES +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +ROLLBACK; +SELECT * FROM t1 WHERE MATCH (a) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(a) AGAINST("+mysql +Tutorial" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(b) AGAINST("+Tutorial" IN BOOLEAN MODE); +id a b +3 Optimizing MySQL In this tutorial we will show ... +select * from t1 where MATCH(b) AGAINST("+stands +(DataBase)" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(b) AGAINST("+DataBase -(comparison)" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1; +id a b x +1 MySQL Tutorial DBMS stands for DataBase ... 0.000000001885928302414186 +2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186 +3 Optimizing MySQL In this tutorial we will show ... 0.22764469683170319 +select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1; +id a b x +1 MySQL Tutorial DBMS stands for DataBase ... 0 +2 How To Use MySQL Well After you went through a ... 0 +3 Optimizing MySQL In this tutorial we will show ... 0 +select * from t1 where MATCH a AGAINST ("+Optimiz* +Optimiz*" IN BOOLEAN MODE); +id a b +3 Optimizing MySQL In this tutorial we will show ... +select * from t1 where MATCH b AGAINST ('"DBMS stands"' IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH b AGAINST ('"DBMS STANDS"' IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(b) AGAINST ("DataBase" WITH QUERY EXPANSION); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(a) AGAINST ("Security" WITH QUERY EXPANSION); +id a b +ALTER TABLE t1 DROP INDEX idx_1; +ALTER TABLE t1 DROP INDEX idx_2; +ALTER TABLE t1 ADD FULLTEXT INDEX idx_1 (a); +ALTER TABLE t1 ADD FULLTEXT INDEX idx_2 (b); +SELECT * FROM t1 WHERE MATCH (a) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(a) AGAINST("+mysql +Tutorial" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(b) AGAINST("+Tutorial" IN BOOLEAN MODE); +id a b +3 Optimizing MySQL In this tutorial we will show ... +select * from t1 where MATCH(b) AGAINST("+stands +(DataBase)" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(b) AGAINST("+DataBase -(comparison)" IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1; +id a b x +1 MySQL Tutorial DBMS stands for DataBase ... 0.000000001885928302414186 +2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186 +3 Optimizing MySQL In this tutorial we will show ... 0.22764469683170319 +select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1; +id a b x +1 MySQL Tutorial DBMS stands for DataBase ... 0 +2 How To Use MySQL Well After you went through a ... 0 +3 Optimizing MySQL In this tutorial we will show ... 0 +select * from t1 where MATCH a AGAINST ("+Optimiz* +Optimiz*" IN BOOLEAN MODE); +id a b +3 Optimizing MySQL In this tutorial we will show ... +select * from t1 where MATCH b AGAINST ('"DBMS stands"' IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH b AGAINST ('"DBMS STANDS"' IN BOOLEAN MODE); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(b) AGAINST ("DataBase" WITH QUERY EXPANSION); +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +select * from t1 where MATCH(a) AGAINST ("Security" WITH QUERY EXPANSION); +id a b +INSERT INTO t1 (a,b) VALUES ('test query expansion','for database ...'); +INSERT INTO t1 (a,b) VALUES +('test proximity search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test proximity fts search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO t1 (a,b) VALUES +('test more of proximity for fts search, test, more proximity and phrase', +'search, with proximity innodb'); +SELECT * FROM t1 +WHERE MATCH (a) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id a b +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id a b +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (b) +AGAINST ('"proximity innodb"@4' IN BOOLEAN MODE); +id a b +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +10 test more of proximity for fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id a b +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +10 test more of proximity for fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id a b +10 test more of proximity for fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 +WHERE MATCH (a) +AGAINST ('"more test proximity"@2' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a) +AGAINST ('"more fts proximity"@02' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE CONCAT(t1.a,t1.b) IN ( +SELECT CONCAT(a,b) FROM t1 AS t2 WHERE +MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +) OR t1.id = 3 ; +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t1 WHERE CONCAT(t1.a,t1.b) IN ( +SELECT CONCAT(a,b) FROM t1 AS t2 +WHERE MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +AND t2.id != 3) ; +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM t1 WHERE id IN (SELECT MIN(id) FROM t1 WHERE +MATCH (b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) OR id = 3 ; +id a b +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t1 WHERE id NOT IN (SELECT MIN(id) FROM t1 +WHERE MATCH (b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE)) ; +id a b +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +7 test query expansion for database ... +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +10 test more of proximity for fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 WHERE EXISTS (SELECT t2.id FROM t1 AS t2 WHERE +MATCH (t2.b) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +AND t1.id = t2.id) ; +id a b +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM t1 WHERE NOT EXISTS (SELECT t2.id FROM t1 AS t2 WHERE +MATCH (t2.a) AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE) +AND t1.id = t2.id) ; +id a b +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +7 test query expansion for database ... +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +10 test more of proximity for fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM t1 WHERE t1.id = (SELECT MAX(t2.id) FROM t1 AS t2 WHERE +MATCH(t2.a) AGAINST ('"proximity search"@3' IN BOOLEAN MODE)); +id a b +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +SELECT * FROM t1 WHERE t1.id > (SELECT MIN(t2.id) FROM t1 AS t2 WHERE +MATCH(t2.b) AGAINST ('"proximity innodb"@3' IN BOOLEAN MODE)); +id a b +9 test proximity fts search, test, proximity and phrase search, with proximity innodb +10 test more of proximity for fts search, test, more proximity and phrase search, with proximity innodb +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result new file mode 100644 index 00000000..b9b2350c --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result @@ -0,0 +1,221 @@ +INSTALL PLUGIN simple_parser SONAME 'mypluglib'; +FLUSH TABLES; +# Test Part 1: Grammar Test +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +FULLTEXT (title) WITH PARSER simple_parser +) ENGINE=MyISAM; +ALTER TABLE articles ENGINE=InnoDB; +DROP TABLE articles; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +comment TEXT, +FULLTEXT (title) WITH PARSER simple_parser +) ENGINE=InnoDB; +ALTER TABLE articles ADD FULLTEXT INDEX (body) WITH PARSER simple_parser; +CREATE FULLTEXT INDEX ft_index ON articles(comment) WITH PARSER simple_parser; +DROP TABLE articles; +# Test Part 2: Create Index Test(CREATE TABLE WITH FULLTEXT INDEX) +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title, body) WITH PARSER simple_parser +) ENGINE=InnoDB; +INSERT INTO articles (title, body) VALUES +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','How to use full-text search engine'), +('Go MySQL Tricks','How to use full text search engine'); +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('mysql') ORDER BY id; +id title body +1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('will go'); +id title body +# Test plugin parser tokenizer difference +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full-text'); +id title body +4 1001 MySQL Tricks How to use full-text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full text'); +id title body +5 Go MySQL Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); +id title body +DROP TABLE articles; +# Test Part 3: Row Merge Create Index Test(ALTER TABLE ADD FULLTEXT INDEX) +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT +) ENGINE=InnoDB; +INSERT INTO articles (title, body) VALUES +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','How to use full-text search engine'), +('Go MySQL Tricks','How to use full text search engine'); +ALTER TABLE articles ADD FULLTEXT INDEX (title, body) WITH PARSER simple_parser; +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('mysql') ORDER BY id; +id title body +1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('will go'); +id title body +# Test plugin parser tokenizer difference +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full-text'); +id title body +4 1001 MySQL Tricks How to use full-text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full text'); +id title body +5 Go MySQL Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full-text' WITH QUERY EXPANSION) +ORDER BY id; +id title body +1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full text' WITH QUERY EXPANSION) +ORDER BY id; +id title body +1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('"mysql database"' IN BOOLEAN MODE); +id title body +DROP TABLE articles; +# Test Part 3 END +# Test Part 4:crash on commit(before/after) +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title, body) WITH PARSER simple_parser +) ENGINE=InnoDB; +SET unique_checks=0, foreign_key_checks=0; +BEGIN; +INSERT INTO articles (title, body) VALUES +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','How to use full-text search engine'), +('Go MySQL Tricks','How to use full text search engine'); +# restart +SELECT COUNT(*) FROM articles; +COUNT(*) +0 +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('mysql'); +id title body +INSERT INTO articles (title, body) VALUES +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','How to use full-text search engine'), +('Go MariaDB Tricks','How to use full text search engine'); +# restart +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('MySQL') ORDER BY id; +id title body +1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('tutorial') ORDER BY id; +id title body +1 MySQL Tutorial DBMS stands for MySQL DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('Tricks') ORDER BY id; +id title body +4 1001 MySQL Tricks How to use full-text search engine +5 Go MariaDB Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full text search') ORDER BY id; +id title body +4 1001 MySQL Tricks How to use full-text search engine +5 Go MariaDB Tricks How to use full text search engine +SELECT COUNT(*) FROM articles; +COUNT(*) +5 +INSERT INTO articles (title, body) VALUES ('111', '1234 1234 1234'); +DROP TABLE articles; +# Test Part 5: Test Uninstall Plugin After Index is Built +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title, body) WITH PARSER simple_parser +) ENGINE=InnoDB; +UNINSTALL PLUGIN simple_parser; +INSERT INTO articles (title, body) VALUES +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'); +ERROR HY000: Plugin 'simple_parser' is not loaded +INSTALL PLUGIN simple_parser SONAME 'mypluglib'; +INSERT INTO articles (title, body) VALUES +('MySQL Tutorial','DBMS stands for MySQL DataBase ...'), +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','How to use full-text search engine'), +('Go MySQL Tricks','How to use full text search engine'); +UNINSTALL PLUGIN simple_parser; +Warnings: +Warning 1620 Plugin is busy and will be uninstalled on shutdown +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('mysql') +ORDER BY id; +id title body +1 MySQL Tutorial DBMS stands for MySQL DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks How to use full-text search engine +5 Go MySQL Tricks How to use full text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('will go'); +id title body +# Test plugin parser tokenizer difference +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full-text'); +id title body +4 1001 MySQL Tricks How to use full-text search engine +SELECT * FROM articles WHERE +MATCH(title, body) AGAINST('full text'); +id title body +5 Go MySQL Tricks How to use full text search engine +CREATE TABLE articles2 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title, body) WITH PARSER simple_parser +) ENGINE=InnoDB; +ERROR HY000: Function 'simple_parser' is not defined +DROP TABLE articles; +UNINSTALL PLUGIN simple_parser; +ERROR 42000: PLUGIN simple_parser does not exist diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result b/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result new file mode 100644 index 00000000..d67981e0 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_proximity.result @@ -0,0 +1,217 @@ +drop table if exists t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE= InnoDB; +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'); +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("where will"); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("when"); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("what" WITH QUERY EXPANSION); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("whe*" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+what +will" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+from" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE MATCH(a,b) AGAINST("+where +(show what)" IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"where will"@6' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"where will"@9' IN BOOLEAN MODE); +id a b +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','request docteam@oraclehelp.com ...') , +('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...') , +('when To Use MySQL Well','for free faq mail@xyz.com ...'); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"request"@10' IN BOOLEAN MODE); +id a b +4 MySQL Tutorial request docteam@oraclehelp.com ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"Trial version"@0' IN BOOLEAN MODE); +id a b +5 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"request docteam@oraclehelp.com"@10' IN BOOLEAN MODE); +id a b +4 MySQL Tutorial request docteam@oraclehelp.com ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"1255 minute"@1' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"1255 minute"@2' IN BOOLEAN MODE); +id a b +5 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"1255"@10' IN BOOLEAN MODE); +id a b +5 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('1255' WITH QUERY EXPANSION); +id a b +5 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"request docteam"@2' IN BOOLEAN MODE); +id a b +4 MySQL Tutorial request docteam@oraclehelp.com ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"1255 minute"' IN BOOLEAN MODE); +id a b +5 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request docteam@oraclehelp.com'); +id a b +4 MySQL Tutorial request docteam@oraclehelp.com ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"MySQL request"@3' IN BOOLEAN MODE); +id a b +4 MySQL Tutorial request docteam@oraclehelp.com ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"Trial memory"@10' IN BOOLEAN MODE); +id a b +5 Trial version query performace @1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"Trial memory"@9' IN BOOLEAN MODE); +id a b +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = UTF8, ENGINE= InnoDB; +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'); +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','request docteam@oraclehelp.com ...') , +('Trial version','query performace @1255 minute on 2.1Hz Memory 2GB...'), +('when To Use MySQL Well','for free faq mail@xyz.com ...'); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"mysql use"@2' IN BOOLEAN MODE); +id a b +2 when To Use MySQL Well After that you went through a ... +6 when To Use MySQL Well for free faq mail@xyz.com ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"mysql use"@1' IN BOOLEAN MODE); +id a b +INSERT INTO t1 (a,b) VALUES ('XYZ, long blob', repeat("a", 9000)); +INSERT IGNORE INTO t1 (a,b) VALUES (repeat("b", 9000), 'XYZ, long blob'); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT count(*) FROM t1 +WHERE MATCH (a,b) +AGAINST ('"xyz blob"@3' IN BOOLEAN MODE); +count(*) +2 +DROP TABLE t1; +set global innodb_file_per_table=1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a TEXT, +b TEXT, +c TEXT +) CHARACTER SET = UTF8, ROW_FORMAT=DYNAMIC, ENGINE= InnoDB; +INSERT INTO t1 (a,b,c) VALUES (repeat("b", 19000), 'XYZ, long text', 'very long blob'); +INSERT INTO t1 (a,b,c) VALUES (repeat("b", 19000), 'XYZ, very little long blob very much blob', 'very long blob'); +INSERT INTO t1 (a,b,c) VALUES (repeat("b", 19000),"very 租车 ä¾› blob","new 供需分æžinformation"); +CREATE FULLTEXT INDEX idx on t1 (a,b,c); +INSERT INTO t1 (a,b,c) VALUES (repeat("x", 19000), 'new, long text', 'very new blob'); +INSERT INTO t1 (a,b,c) VALUES ('interesting, long text', repeat("x", 19000), 'very very good new blob'); +SELECT count(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"very blob"@3' IN BOOLEAN MODE); +count(*) +3 +SELECT count(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"very long blob"@0' IN BOOLEAN MODE); +count(*) +2 +SELECT count(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"very blob"@4' IN BOOLEAN MODE); +count(*) +4 +SELECT count(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"interesting blob"@9' IN BOOLEAN MODE); +count(*) +1 +SELECT COUNT(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"interesting blob"@9 "very long blob"@0' IN BOOLEAN MODE); +COUNT(*) +3 +SELECT COUNT(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"very blob"@4 - "interesting blob"@9' IN BOOLEAN MODE); +COUNT(*) +3 +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = UTF8, ENGINE= InnoDB; +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for + DataBase ...'); +CREATE FULLTEXT INDEX idx on t1 (a,b); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"stands database"@3' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for + DataBase ... +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a TEXT, +b TEXT, +c TEXT +) CHARACTER SET = UTF8, ROW_FORMAT=DYNAMIC, ENGINE= InnoDB; +INSERT INTO t1 (a,b,c) VALUES (repeat("b", 19000), 'XYZ, long text', 'very long blob'); +INSERT INTO t1 (a,b,c) VALUES ('XYZ, 租车 very little long blob very much blob', repeat("b", 19000), 'very long but smaller blob'); +CREATE FULLTEXT INDEX idx on t1 (a,b,c); +DELETE FROM t1; +INSERT INTO t1 (a,b,c) VALUES (repeat("b", 19000), 'XYZ, long text', 'very long blob'); +INSERT INTO t1 (a,b,c) VALUES ('XYZ, 租车 very little long blob is a very much longer blob', repeat("b", 19000), 'this is very long but smaller blob'); +SELECT count(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"very blob"@4' IN BOOLEAN MODE); +count(*) +2 +SELECT count(*) FROM t1 +WHERE MATCH (a,b,c) +AGAINST ('"very blob"@3' IN BOOLEAN MODE); +count(*) +1 +DROP TABLE t1; +SET GLOBAL innodb_file_per_table=1; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_result_cache_limit.result b/mysql-test/suite/innodb_fts/r/innodb_fts_result_cache_limit.result new file mode 100644 index 00000000..61eb5294 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_result_cache_limit.result @@ -0,0 +1,30 @@ +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE= InnoDB; +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'), +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'), +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'); +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,fts_instrument_result_cache_limit"; +SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' IN BOOLEAN MODE); +COUNT(*) +9 +SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('mysql' WITH QUERY EXPANSION); +ERROR HY000: Table handler out of memory +SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database"' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT COUNT(*) FROM t1 WHERE MATCH (a,b) AGAINST ('"mysql database" @ 5' IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +SET GLOBAL innodb_ft_result_cache_limit=default; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result b/mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result new file mode 100644 index 00000000..f2cfcd93 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_stopword_charset.result @@ -0,0 +1,320 @@ +SELECT @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +NULL +SELECT @@innodb_ft_enable_stopword; +@@innodb_ft_enable_stopword +1 +SELECT @@innodb_ft_user_stopword_table; +@@innodb_ft_user_stopword_table +NULL +SET NAMES utf8; +# Test 1 : default latin1_swedish_ci +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB; +INSERT IGNORE INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +3 lòve +4 LÃ’VE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 2 : latin1_general_ci +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci; +INSERT IGNORE INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +3 lòve +4 LÃ’VE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB +DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 3 : latin1_spanish_ci +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB DEFAULT CHARACTER SET latin1 COLLATE latin1_spanish_ci; +INSERT IGNORE INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +3 lòve +4 LÃ’VE +5 löve +6 LÖVE +7 løve +8 LØVE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB +DEFAULT CHARACTER SET latin1 COLLATE latin1_spanish_ci; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 4 : utf8_general_ci +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +INSERT INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +3 lòve +4 LÃ’VE +5 löve +6 LÖVE +9 lṓve +10 Lá¹’VE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB +DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 5 : utf8_unicode_ci +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_swedish_ci; +INSERT INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +3 lòve +4 LÃ’VE +9 lṓve +10 Lá¹’VE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB +DEFAULT CHARACTER SET utf8 COLLATE utf8_swedish_ci; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 6 : utf8_unicode_ci +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; +INSERT INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +3 lòve +4 LÃ’VE +5 löve +6 LÖVE +9 lṓve +10 Lá¹’VE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB +DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 7 : gb2312_chinese_ci +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci; +INSERT INTO articles (title) VALUES +('相亲相爱'),('怜香惜爱'),('充满å¯çˆ±'),('爱æ¨äº¤ç»‡'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('相亲相爱' IN NATURAL LANGUAGE MODE); +id title +1 相亲相爱 +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB +DEFAULT CHARACTER SET gb2312 COLLATE gb2312_chinese_ci; +INSERT INTO user_stopword VALUES('相亲相爱'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('相亲相爱' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('怜香惜爱' IN NATURAL LANGUAGE MODE); +id title +2 怜香惜爱 +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 8 : test shutdown to check if stopword still works +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB; +INSERT IGNORE INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +3 lòve +4 LÃ’VE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +# Shutdown and restart mysqld +# restart +SET NAMES utf8; +INSERT IGNORE INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +DROP TABLE articles; +DROP TABLE user_stopword; +# Test 9 : drop user stopwrod table,test shutdown to check if it works +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200) +) ENGINE=InnoDB; +INSERT IGNORE INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +1 love +2 LOVE +3 lòve +4 LÃ’VE +CREATE TABLE user_stopword(value varchar(30)) ENGINE = InnoDB; +INSERT INTO user_stopword VALUES('lòve'); +SET GLOBAL innodb_ft_server_stopword_table = 'test/user_stopword'; +DROP INDEX ft_idx ON articles; +CREATE FULLTEXT INDEX ft_idx ON articles(title); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +DROP TABLE user_stopword; +# Shutdown and restart mysqld +# restart +SET NAMES utf8; +INSERT IGNORE INTO articles (title) VALUES +('love'),('LOVE'),('lòve'),('LÃ’VE'),('löve'),('LÖVE'),('løve'),('LØVE'), +('lṓve'),('Lá¹’VE'); +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('lòve' IN NATURAL LANGUAGE MODE); +id title +11 love +12 LOVE +13 lòve +14 LÃ’VE +SELECT * FROM articles WHERE MATCH (title) +AGAINST ('love' IN NATURAL LANGUAGE MODE); +id title +11 love +12 LOVE +13 lòve +14 LÃ’VE +DROP TABLE articles; diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_transaction.result b/mysql-test/suite/innodb_fts/r/innodb_fts_transaction.result new file mode 100644 index 00000000..fc6a1d1a --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_transaction.result @@ -0,0 +1,1047 @@ +drop table if exists t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB STATS_PERSISTENT=0; +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'); +START TRANSACTION; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','request docteam for oraclehelp.'); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request' IN NATURAL LANGUAGE MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request MySQL' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('-request +MySQL' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE); +id a b +2 when To Use MySQL Well After that you went through a ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"stands Database"@11' IN BOOLEAN MODE) ORDER BY 1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' WITH QUERY EXPANSION); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +2 when To Use MySQL Well After that you went through a ... +COMMIT; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 MySQL Tutorial request docteam for oraclehelp. +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request MySQL' IN BOOLEAN MODE); +id a b +4 MySQL Tutorial request docteam for oraclehelp. +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' WITH QUERY EXPANSION); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +4 MySQL Tutorial request docteam for oraclehelp. +3 where will Optimizing MySQL what In this tutorial we will show ... +2 when To Use MySQL Well After that you went through a ... +START TRANSACTION; +INSERT INTO t1 (a,b) VALUES (NULL,NULL); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+request +MySQL' IN BOOLEAN MODE); +id a b +4 MySQL Tutorial request docteam for oraclehelp. +UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...' +WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('query performace' IN BOOLEAN MODE); +id a b +UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq xyz.com ...' +WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('performace'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+mail +MySQL' IN BOOLEAN MODE); +id a b +COMMIT; +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE); +SELECT * FROM t1; +id a b +4 Trial version query performace 1255 minute on 2.1Hz Memory 2GB... +5 NULL NULL +INSERT INTO t1 (a,b) VALUES +('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...') , +('when To Use MySQL Well','for free faq mail@xyz.com ...'); +SELECT * FROM t1; +id a b +4 Trial version query performace 1255 minute on 2.1Hz Memory 2GB... +5 NULL NULL +6 Trial version query performace 1255 minute on 2.1Hz Memory 2GB... +7 when To Use MySQL Well for free faq mail@xyz.com ... +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'); +START TRANSACTION; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','request docteam for oraclehelp.'); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request' IN NATURAL LANGUAGE MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request MySQL' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('-request +MySQL' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE); +id a b +2 when To Use MySQL Well After that you went through a ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' WITH QUERY EXPANSION); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +2 when To Use MySQL Well After that you went through a ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' WITH QUERY EXPANSION); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +2 when To Use MySQL Well After that you went through a ... +ROLLBACK; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request MySQL' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' WITH QUERY EXPANSION); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +2 when To Use MySQL Well After that you went through a ... +START TRANSACTION; +INSERT INTO t1 (a,b) VALUES (NULL,NULL); +UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...' +WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('query performace' IN BOOLEAN MODE); +id a b +UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq xyz.com ...' +WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('performace'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+mail +MySQL' IN BOOLEAN MODE); +id a b +ROLLBACK; +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE); +SELECT * FROM t1; +id a b +INSERT INTO t1 (a,b) VALUES +('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...') , +('when To Use MySQL Well','for free faq mail@xyz.com ...'); +SELECT * FROM t1; +id a b +6 Trial version query performace 1255 minute on 2.1Hz Memory 2GB... +7 when To Use MySQL Well for free faq mail@xyz.com ... +DROP TABLE t1; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) ENGINE = InnoDB; +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'); +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','request docteam for oraclehelp.'); +START TRANSACTION; +INSERT INTO t1 (a,b) VALUES (NULL,NULL); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+request +MySQL' IN BOOLEAN MODE); +id a b +4 MySQL Tutorial request docteam for oraclehelp. +UPDATE t1 SET a = 'Trial version' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...' WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE); +SELECT * from t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Trial version query performace 1255 minute on 2.1Hz Memory 2GB... +5 NULL NULL +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('query performace' IN BOOLEAN MODE); +id a b +UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq mail xyz.com ...' WHERE MATCH (a,b) AGAINST ('+query +performace' IN BOOLEAN MODE); +UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq mail xyz.com ...' WHERE b like '%query performace%'; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('performace'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+mail +MySQL' IN BOOLEAN MODE); +id a b +SELECT * from t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 when To Use MySQL Well for free faq mail xyz.com ... +5 NULL NULL +COMMIT; +SELECT * from t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 when To Use MySQL Well for free faq mail xyz.com ... +5 NULL NULL +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+MySQL' IN BOOLEAN MODE); +SELECT * FROM t1; +id a b +5 NULL NULL +INSERT INTO t1 (a,b) VALUES +('Trial version','query performace 1255 minute on 2.1Hz Memory 2GB...') , +('when To Use MySQL Well','for free faq mail@xyz.com ...'); +SELECT * FROM t1; +id a b +5 NULL NULL +6 Trial version query performace 1255 minute on 2.1Hz Memory 2GB... +7 when To Use MySQL Well for free faq mail@xyz.com ... +DROP TABLE t1; +SET NAMES UTF8; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = UTF8,ENGINE = InnoDB; +connect con1,localhost,root,,; +SET NAMES UTF8; +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'), +('Я могу еÑÑ‚ÑŒ Ñтекло', 'оно мне Mне вредит'), +('ΜποÏῶ νὰ φάω σπασμÎνα' ,'γυαλιὰ χωÏὶς νὰ πάθω τίποτα'), +('Sævör grét', 'áðan þvà úlpan var ónýt'); +connect con2,localhost,root,,; +SET NAMES UTF8; +CREATE FULLTEXT INDEX idx on t1 (a,b); +connection con1; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' IN NATURAL LANGUAGE MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +INSERT INTO t1 (a,b) VALUES +('adding record using session 1','for verifying multiple concurrent transactions'), +('Мога да Ñм Ñтъкло', 'то Mне ми вреди'); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+γυαλιὰ +χωÏὶ*' IN BOOLEAN MODE); +id a b +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +START TRANSACTION; +INSERT INTO t1 (a,b) VALUES +('MySQL Tutorial','request docteam for oraclehelp.'), +('PÅ™ÃliÅ¡ žluÅ¥ouÄký kůň', 'úpÄ›l Äábelské kódy'); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request Äábelské' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY 1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +6 Sævör grét áðan þvà úlpan var ónýt +connection con2; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+record +multiple' IN BOOLEAN MODE); +id a b +7 adding record using session 1 for verifying multiple concurrent transactions +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutor* Sævö*' IN BOOLEAN MODE) ORDER BY 1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +3 where will Optimizing MySQL what In this tutorial we will show ... +6 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('usin* multipl*' IN BOOLEAN MODE); +id a b +7 adding record using session 1 for verifying multiple concurrent transactions +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"request docteam"@08' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request' IN NATURAL LANGUAGE MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request MySQL' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('-request +MySQL' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+MySQL -(Tutorial Optimizing)' IN BOOLEAN MODE); +id a b +2 when To Use MySQL Well After that you went through a ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('"stands Database"@11' IN BOOLEAN MODE) ORDER BY 1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('tutorial' WITH QUERY EXPANSION) ORDER BY 1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +connection con1; +COMMIT; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+request +MySQL' IN BOOLEAN MODE); +id a b +9 MySQL Tutorial request docteam for oraclehelp. +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('PÅ™ÃliÅ¡ žluÅ¥ouÄký' IN BOOLEAN MODE); +id a b +10 PÅ™ÃliÅ¡ žluÅ¥ouÄký kůň úpÄ›l Äábelské kódy +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('PÅ™ÃliÅ¡'); +id a b +10 PÅ™ÃliÅ¡ žluÅ¥ouÄký kůň úpÄ›l Äábelské kódy +INSERT INTO t1 (a,b) VALUES (NULL,NULL); +SELECT * FROM t1 WHERE a IS NULL AND b IS NULL; +id a b +11 NULL NULL +connection con2; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('usin* multipl*' IN BOOLEAN MODE); +id a b +7 adding record using session 1 for verifying multiple concurrent transactions +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+request +MySQL' IN BOOLEAN MODE); +id a b +9 MySQL Tutorial request docteam for oraclehelp. +SELECT * FROM t1 WHERE a IS NULL AND b IS NULL; +id a b +11 NULL NULL +ALTER TABLE t1 DROP INDEX idx; +CREATE FULLTEXT INDEX idx on t1 (a,b); +START TRANSACTION; +UPDATE t1 SET a = 'Trial version PÅ™ÃliÅ¡ žluÅ¥ouÄký' , b = 'query performace 1255 minute on 2.1Hz Memory 2GB...' +WHERE MATCH (a,b) AGAINST ('+request +MySQL' IN BOOLEAN MODE); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+query +performace' IN BOOLEAN MODE); +id a b +UPDATE t1 SET a = UPPER(a) WHERE MATCH (a,b) AGAINST ('+PÅ™ÃliÅ¡ +žluÅ¥ouÄký' IN BOOLEAN MODE); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+PÅ™ÃliÅ¡ +žluÅ¥ouÄký' IN BOOLEAN MODE); +id a b +UPDATE t1 SET a = UPPER(a) WHERE a LIKE '%version PÅ™ÃliÅ¡%'; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+query +performace' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 WHERE b LIKE '%query performace%'; +id a b +9 TRIAL VERSION PŘÃLIŠŽLUŤOUÄŒKà query performace 1255 minute on 2.1Hz Memory 2GB... +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('request'); +id a b +connection con1; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('query performace' IN BOOLEAN MODE); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('performace'); +id a b +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+mail +MySQL' IN BOOLEAN MODE); +id a b +connection con2; +COMMIT; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+query +performace' IN BOOLEAN MODE); +id a b +9 TRIAL VERSION PŘÃLIŠŽLUŤOUÄŒKà query performace 1255 minute on 2.1Hz Memory 2GB... +connection con1; +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('+query +performace' IN BOOLEAN MODE); +id a b +9 TRIAL VERSION PŘÃLIŠŽLUŤOUÄŒKà query performace 1255 minute on 2.1Hz Memory 2GB... +UPDATE t1 SET a = 'when To Use MySQL Well' , b = 'for free faq xyz.com ...' +WHERE MATCH (a,b) AGAINST ('+πάθω +τίποτα' IN BOOLEAN MODE); +SELECT * FROM t1 +WHERE MATCH (a,b) +AGAINST ('well free') ORDER BY 1; +id a b +2 when To Use MySQL Well After that you went through a ... +5 when To Use MySQL Well for free faq xyz.com ... +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; +SET NAMES UTF8; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = UTF8,ENGINE = InnoDB; +connect con1,localhost,root,,; +SET NAMES UTF8; +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'), +('Я могу еÑÑ‚ÑŒ Ñтекло', 'оно мне Mне вредит'), +('ΜποÏῶ νὰ φάω σπασμÎνα' ,'γυαλιὰ χωÏὶς νὰ πάθω τίποτα'), +('Sævör grét', 'áðan þvà úlpan var ónýt'); +connect con2,localhost,root,,; +SET NAMES UTF8; +select @@session.tx_isolation; +@@session.tx_isolation +REPEATABLE-READ +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('adding record using session 1','for verifying multiple concurrent transactions'), +('Мога да Ñм Ñтъкло', 'то Mне ми вреди'); +connection con1; +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +6 Sævör grét áðan þvà úlpan var ónýt +7 adding record using session 1 for verifying multiple concurrent transactions +8 Мога да Ñм Ñтъкло то Mне ми вреди +START TRANSACTION; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Мога +Mне' IN BOOLEAN MODE); +id a b +8 Мога да Ñм Ñтъкло то Mне ми вреди +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+Мога +Mне' IN BOOLEAN MODE); +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +7 adding record using session 1 for verifying multiple concurrent transactions +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +7 adding record using session 1 for verifying multiple concurrent transactions +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +8 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +6 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +6 Sævör grét áðan þvà úlpan var ónýt +7 adding record using session 1 for verifying multiple concurrent transactions +8 Мога да Ñм Ñтъкло то Mне ми вреди +connection con1; +COMMIT; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +7 adding record using session 1 for verifying multiple concurrent transactions +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; +SET NAMES UTF8; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = UTF8,ENGINE = InnoDB; +connect con1,localhost,root,,; +SET NAMES UTF8; +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'), +('Я могу еÑÑ‚ÑŒ Ñтекло', 'оно мне Mне вредит'); +connect con2,localhost,root,,; +SET NAMES UTF8; +select @@session.tx_isolation; +@@session.tx_isolation +REPEATABLE-READ +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('adding record using session 1','for verifying multiple concurrent transactions'), +('Мога да Ñм Ñтъкло', 'то Mне ми вреди'); +connection con1; +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +START TRANSACTION; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Мога +Mне' IN BOOLEAN MODE); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +UPDATE t1 SET a = 'ΜποÏῶ νὰ φάω σπασμÎνα' , b = 'γυαλιὰ χωÏὶς νὰ πάθω τίποτα' WHERE MATCH (a,b) AGAINST ('+могу +Mне' IN BOOLEAN MODE); +INSERT INTO t1(a,b) VALUES ('Sævör grét', 'áðan þvà úlpan var ónýt'); +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +7 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +7 Sævör grét áðan þvà úlpan var ónýt +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +7 Sævör grét áðan þvà úlpan var ónýt +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +connection con1; +COMMIT; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +7 Sævör grét áðan þvà úlpan var ónýt +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтекло'); +id a b +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +7 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +7 Sævör grét áðan þvà úlpan var ónýt +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; +SET NAMES UTF8; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = UTF8,ENGINE = InnoDB; +connect con1,localhost,root,,; +SET NAMES UTF8; +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'), +('Я могу еÑÑ‚ÑŒ Ñтекло', 'оно мне Mне вредит'), +('ΜποÏῶ νὰ φάω σπασμÎνα' ,'γυαλιὰ χωÏὶς νὰ πάθω τίποτα'), +('Sævör grét', 'áðan þvà úlpan var ónýt'); +connect con2,localhost,root,,; +SET NAMES UTF8; +select @@session.tx_isolation; +@@session.tx_isolation +REPEATABLE-READ +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('adding record using session 1','for verifying multiple concurrent transactions'), +('Мога да Ñм Ñтъкло', 'то Mне ми вреди'); +connection con1; +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +6 Sævör grét áðan þvà úlpan var ónýt +7 adding record using session 1 for verifying multiple concurrent transactions +8 Мога да Ñм Ñтъкло то Mне ми вреди +START TRANSACTION; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Мога +Mне' IN BOOLEAN MODE); +id a b +8 Мога да Ñм Ñтъкло то Mне ми вреди +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('+Мога +Mне' IN BOOLEAN MODE); +DELETE FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +7 adding record using session 1 for verifying multiple concurrent transactions +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +7 adding record using session 1 for verifying multiple concurrent transactions +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +8 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +8 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +6 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +6 Sævör grét áðan þvà úlpan var ónýt +7 adding record using session 1 for verifying multiple concurrent transactions +8 Мога да Ñм Ñтъкло то Mне ми вреди +connection con1; +ROLLBACK; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +8 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +8 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +6 Sævör grét áðan þvà úlpan var ónýt +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +8 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +8 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +6 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +6 Sævör grét áðan þvà úlpan var ónýt +7 adding record using session 1 for verifying multiple concurrent transactions +8 Мога да Ñм Ñтъкло то Mне ми вреди +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; +SET NAMES UTF8; +CREATE TABLE t1 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +a VARCHAR(200), +b TEXT +) CHARACTER SET = UTF8,ENGINE = InnoDB; +connect con1,localhost,root,,; +SET NAMES UTF8; +INSERT INTO t1 (a,b) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','what In this tutorial we will show ...'), +('Я могу еÑÑ‚ÑŒ Ñтекло', 'оно мне Mне вредит'); +connect con2,localhost,root,,; +SET NAMES UTF8; +select @@session.tx_isolation; +@@session.tx_isolation +REPEATABLE-READ +CREATE FULLTEXT INDEX idx on t1 (a,b); +INSERT INTO t1 (a,b) VALUES +('adding record using session 1','for verifying multiple concurrent transactions'), +('Мога да Ñм Ñтъкло', 'то Mне ми вреди'); +connection con1; +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +START TRANSACTION; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+могу +Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +UPDATE t1 SET a = 'ΜποÏῶ νὰ φάω σπασμÎνα' , b = 'γυαλιὰ χωÏὶς νὰ πάθω τίποτα' WHERE MATCH (a,b) AGAINST ('+могу +Mне' IN BOOLEAN MODE); +INSERT INTO t1(a,b) VALUES ('Sævör grét', 'áðan þvà úlpan var ónýt'); +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +7 Sævör grét áðan þvà úlpan var ónýt +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +7 Sævör grét áðan þvà úlpan var ónýt +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 ΜποÏῶ νὰ φάω σπασμÎνα γυαλιὰ χωÏὶς νὰ πάθω τίποτα +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +7 Sævör grét áðan þvà úlpan var ónýt +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"dbms stands"@05' IN BOOLEAN MODE); +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +connection con1; +ROLLBACK; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +connection con2; +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('+Mне' IN BOOLEAN MODE); +id a b +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('Ñтъкло'); +id a b +6 Мога да Ñм Ñтъкло то Mне ми вреди +SELECT * FROM t1 WHERE MATCH (a,b) AGAINST ('"Sævör grét"@18' IN BOOLEAN MODE); +id a b +SELECT * FROM t1; +id a b +1 MySQL from Tutorial DBMS stands for DataBase ... +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL what In this tutorial we will show ... +4 Я могу еÑÑ‚ÑŒ Ñтекло оно мне Mне вредит +5 adding record using session 1 for verifying multiple concurrent transactions +6 Мога да Ñм Ñтъкло то Mне ми вреди +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/misc_debug.result b/mysql-test/suite/innodb_fts/r/misc_debug.result new file mode 100644 index 00000000..cdfc4ff4 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/misc_debug.result @@ -0,0 +1,76 @@ +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +SET @saved_debug_dbug = @@SESSION.debug_dbug; +SET SESSION debug_dbug="+d,ib_dict_create_index_tree_fail"; +CREATE FULLTEXT INDEX idx ON articles(body); +ERROR HY000: Out of memory. +SET SESSION debug_dbug=@saved_debug_dbug; +ALTER TABLE articles STATS_PERSISTENT=DEFAULT; +DROP TABLE articles; +CREATE TABLE t (a INT, b TEXT) engine=innodb; +SET debug_dbug='+d,alter_table_rollback_new_index'; +ALTER TABLE t ADD FULLTEXT INDEX (b(64)); +ERROR HY000: Unknown error +SET SESSION debug_dbug=@saved_debug_dbug; +DROP TABLE t; +CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk), +FULLTEXT KEY(a)) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, FOREIGN KEY(b) REFERENCES t1(pk)) ENGINE=InnoDB; +DROP TABLE/*foo*/ t1; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails +SET DEBUG_DBUG="+d,fts_instrument_sync"; +INSERT INTO t1 VALUES(1, "mariadb"); +ALTER TABLE t1 FORCE; +DROP TABLE t2, t1; +SET SESSION debug_dbug=@saved_debug_dbug; +# +# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX +# +CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, "test", "test_1"); +connect con1,localhost,root,,test; +SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter"; +SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2'; +ALTER TABLE t1 ADD FULLTEXT(c); +connection default; +SET DEBUG_SYNC='now WAIT_FOR s2'; +START TRANSACTION; +SELECT * FROM t1; +a b c +1 test test_1 +SET DEBUG_SYNC='now SIGNAL g2'; +connection con1; +ERROR HY000: Out of memory. +disconnect con1; +connection default; +SET DEBUG_SYNC=RESET; +ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +# +# MDEV-25663 Double free of transaction during TRUNCATE +# +call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); +call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Too many concurrent transactions"); +SET @saved_debug_dbug= @@debug_dbug; +CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB; +SET debug_dbug='+d,ib_create_table_fail_too_many_trx'; +TRUNCATE t1; +SET debug_dbug=@saved_debug_dbug; +DROP TABLE t1; +# End of 10.3 tests +CREATE TABLE t1(f1 INT NOT NULL, f2 CHAR(100))ENGINE=InnoDB; +SET DEBUG_DBUG="+d,stats_lock_fail"; +ALTER TABLE t1 ADD FULLTEXT(f2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SET debug_dbug=@saved_debug_dbug; +ALTER TABLE t1 DISCARD TABLESPACE; +ALTER TABLE t1 ADD FULLTEXT(f2); +ERROR HY000: Tablespace has been discarded for table `t1` +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result new file mode 100644 index 00000000..9601e8fc --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result @@ -0,0 +1,23 @@ +call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded."); +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); +CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; +set debug_dbug="+d,fts_instrument_sync_request"; +INSERT INTO mdev21563 VALUES('This is a test'); +ALTER TABLE mdev21563 DISCARD TABLESPACE; +# restart +DROP TABLE mdev21563; +# +# MDEV-29342 Assertion failure in file que0que.cc line 728 +# +CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; +INSERT INTO t1 VALUES('mysql'), ('innodb'); +SET @save_dbug=@@debug_dbug; +set debug_dbug="+d,fts_instrument_sync_request"; +INSERT INTO t1 VALUES('test'); +set debug_dbug=@save_dbug; +INSERT INTO t1 VALUES('This is a fts issue'); +# restart +set debug_dbug="+d,fts_instrument_sync_request"; +UPDATE t1 SET f1="mariadb"; +set debug_dbug=@save_dbug; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff b/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff new file mode 100644 index 00000000..7405c47c --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/stopword,vers.rdiff @@ -0,0 +1,192 @@ +--- stopword.result ++++ stopword,vers.reject +@@ -46,7 +46,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles (title,body) VALUES + ('MySQL Tutorial','DBMS stands for DataBase ...') , + ('How To Use MySQL Well','After you went through a ...'), +@@ -60,7 +60,7 @@ + set global innodb_ft_server_stopword_table = "not_defined"; + ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined' + set global innodb_ft_server_stopword_table = NULL; +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set global innodb_ft_server_stopword_table = "test/user_stopword"; + drop index title on articles; + create fulltext index idx on articles(title, body); +@@ -73,7 +73,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_2 (title, body) + VALUES ('test for stopwords','this is it...'); + SELECT * FROM articles_2 WHERE MATCH (title,body) +@@ -88,13 +88,13 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_3 (title, body) + VALUES ('test for stopwords','this is it...'); + SELECT * FROM articles_3 WHERE MATCH (title,body) + AGAINST ('this' IN NATURAL LANGUAGE MODE); + id title body +-create table user_stopword_session(value varchar(30)) engine = innodb; ++create table user_stopword_session(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + insert into user_stopword values("this"); + delete from user_stopword; + insert into user_stopword_session values("session"); +@@ -104,7 +104,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_4 (title, body) + VALUES ('test for session stopwords','this should also be excluded...'); + SELECT * FROM articles_4 WHERE MATCH (title,body) +@@ -120,7 +120,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles_5 (title, body) + VALUES ('test for session stopwords','this should also be excluded...'); + SELECT * FROM articles_5 WHERE MATCH (title,body) +@@ -142,7 +142,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + SHOW CREATE TABLE articles; + Table Create Table + articles CREATE TABLE `articles` ( +@@ -151,7 +151,7 @@ + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -248,7 +248,7 @@ + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`) +-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); + ANALYZE TABLE articles; + Table Op Msg_type Msg_text +@@ -320,7 +320,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -332,9 +332,9 @@ + id title body + SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); + id title body +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword"; +-create table server_stopword(value varchar(30)) engine = innodb; ++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set global innodb_ft_server_stopword_table = "test/server_stopword"; + insert into user_stopword values("when"),("where"); + delete from user_stopword; +@@ -419,7 +419,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + SHOW CREATE TABLE articles; + Table Create Table + articles CREATE TABLE `articles` ( +@@ -428,7 +428,7 @@ + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -440,7 +440,7 @@ + id title body + SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); + id title body +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword"; + insert into user_stopword values("mysqld"),("DBMS"); + SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +@@ -466,7 +466,7 @@ + SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); + id title body + set session innodb_ft_user_stopword_table = default; +-create table server_stopword(value varchar(30)) engine = innodb; ++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set global innodb_ft_server_stopword_table = "test/server_stopword"; + insert into server_stopword values("root"),("properly"); + ALTER TABLE articles DROP INDEX idx; +@@ -530,7 +530,7 @@ + title VARCHAR(200), + body TEXT, + FULLTEXT `idx` (title,body) +-) ENGINE=InnoDB; ++) WITH SYSTEM VERSIONING ENGINE=InnoDB; + SHOW CREATE TABLE articles; + Table Create Table + articles CREATE TABLE `articles` ( +@@ -539,7 +539,7 @@ + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ++) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING + INSERT INTO articles (title,body) VALUES + ('MySQL from Tutorial','DBMS stands for DataBase ...') , + ('when To Use MySQL Well','After that you went through a ...'), +@@ -656,7 +656,7 @@ + "In connection 1" + connection con1; + SET SESSION innodb_ft_enable_stopword = 1; +-create table user_stopword(value varchar(30)) engine = innodb; ++create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword"; + insert into user_stopword values("this"),("will"),("the"); + ALTER TABLE articles DROP INDEX idx; +@@ -674,7 +674,7 @@ + select @@innodb_ft_user_stopword_table; + @@innodb_ft_user_stopword_table + NULL +-create table user_stopword_1(value varchar(30)) engine = innodb; ++create table user_stopword_1(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + set session innodb_ft_user_stopword_table = "test/user_stopword_1"; + insert into user_stopword_1 values("when"); + SET SESSION innodb_ft_enable_stopword = 1; +@@ -702,7 +702,7 @@ + select @@innodb_ft_server_stopword_table; + @@innodb_ft_server_stopword_table + NULL +-create table server_stopword(value varchar(30)) engine = innodb; ++create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb; + SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword"; + select @@innodb_ft_server_stopword_table; + @@innodb_ft_server_stopword_table diff --git a/mysql-test/suite/innodb_fts/r/stopword.result b/mysql-test/suite/innodb_fts/r/stopword.result new file mode 100644 index 00000000..aa6f51aa --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/stopword.result @@ -0,0 +1,754 @@ +SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table; +SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword; +SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table; +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist."); +select * from information_schema.innodb_ft_default_stopword; +value +a +about +an +are +as +at +be +by +com +de +en +for +from +how +i +in +is +it +la +of +on +or +that +the +this +to +was +what +when +where +who +will +with +und +the +www +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +set global innodb_ft_server_stopword_table = "not_defined"; +ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined' +set global innodb_ft_server_stopword_table = NULL; +create table user_stopword(value varchar(30)) engine = innodb; +set global innodb_ft_server_stopword_table = "test/user_stopword"; +drop index title on articles; +create fulltext index idx on articles(title, body); +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +CREATE TABLE articles_2 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles_2 (title, body) +VALUES ('test for stopwords','this is it...'); +SELECT * FROM articles_2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +1 test for stopwords this is it... +insert into user_stopword values("the"); +delete from user_stopword; +insert into user_stopword values("this"); +CREATE TABLE articles_3 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles_3 (title, body) +VALUES ('test for stopwords','this is it...'); +SELECT * FROM articles_3 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +create table user_stopword_session(value varchar(30)) engine = innodb; +insert into user_stopword values("this"); +delete from user_stopword; +insert into user_stopword_session values("session"); +set session innodb_ft_user_stopword_table="test/user_stopword_session"; +CREATE TABLE articles_4 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles_4 (title, body) +VALUES ('test for session stopwords','this should also be excluded...'); +SELECT * FROM articles_4 WHERE MATCH (title,body) +AGAINST ('session' IN NATURAL LANGUAGE MODE); +id title body +SELECT * FROM articles_4 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +1 test for session stopwords this should also be excluded... +connect con1,localhost,root,,; +CREATE TABLE articles_5 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +INSERT INTO articles_5 (title, body) +VALUES ('test for session stopwords','this should also be excluded...'); +SELECT * FROM articles_5 WHERE MATCH (title,body) +AGAINST ('session' IN NATURAL LANGUAGE MODE); +id title body +1 test for session stopwords this should also be excluded... +connection default; +drop table articles; +drop table articles_2; +drop table articles_3; +drop table articles_4; +drop table articles_5; +drop table user_stopword; +drop table user_stopword_session; +SET GLOBAL innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig; +SET GLOBAL innodb_ft_server_stopword_table=default; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT `idx` (title,body) +) ENGINE=InnoDB; +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO articles (title,body) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','In what tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); +id title body +INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); +id title body +UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' +WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' +WHERE id = 7; +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +SELECT * FROM articles WHERE id = 7; +id title body +7 update the record to see will is indexed or not +DELETE FROM articles WHERE id = 7; +SET global innodb_ft_server_stopword_table = NULL; +SET SESSION innodb_ft_enable_stopword = 0; +select @@innodb_ft_enable_stopword; +@@innodb_ft_enable_stopword +0 +SET global innodb_ft_user_stopword_table = NULL; +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); +id title body +INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); +id title body +UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' +WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' +WHERE id = 8; +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +SELECT * FROM articles WHERE id = 8; +id title body +8 update the record to see will is indexed or not +DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +SELECT * FROM articles WHERE id = 8; +id title body +8 update the record to see will is indexed or not +DELETE FROM articles WHERE id = 8; +ALTER TABLE articles DROP INDEX idx; +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +ANALYZE TABLE articles; +Table Op Msg_type Msg_text +test.articles analyze status Engine-independent statistics collected +test.articles analyze Warning Engine-independent statistics are not collected for column 'body' +test.articles analyze status OK +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); +id title body +2 when To Use MySQL Well After that you went through a ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +1 MySQL from Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +2 when To Use MySQL Well After that you went through a ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); +id title body +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL In what tutorial we will show ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); +id title body +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +9 the record will not index the , will words +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); +id title body +9 the record will not index the , will words +UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not' +WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +SELECT COUNT(*),max(id) FROM articles; +COUNT(*) max(id) +7 9 +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +9 update the record to see will is indexed or not +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +9 update the record to see will is indexed or not +DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +SELECT * FROM articles WHERE id = 9; +id title body +DROP TABLE articles; +SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig; +SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig; +SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig; +SET SESSION innodb_ft_user_stopword_table=default; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT `idx` (title,body) +) ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','In what tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +create table user_stopword(value varchar(30)) engine = innodb; +set session innodb_ft_user_stopword_table = "test/user_stopword"; +create table server_stopword(value varchar(30)) engine = innodb; +set global innodb_ft_server_stopword_table = "test/server_stopword"; +insert into user_stopword values("when"),("where"); +delete from user_stopword; +insert into user_stopword values("this"),("will"),("the"); +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +insert into server_stopword values("what"),("where"); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +DELETE FROM user_stopword; +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +insert into user_stopword values("this"),("will"),("the"); +ALTER TABLE articles DROP INDEX idx; +SET SESSION innodb_ft_enable_stopword = 0; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SET SESSION innodb_ft_enable_stopword = 1; +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +SET SESSION innodb_ft_enable_stopword = 1; +SET SESSION innodb_ft_user_stopword_table = default; +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +DROP TABLE articles,user_stopword,server_stopword; +SET innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig; +SET GLOBAL innodb_ft_server_stopword_table=default; +SET SESSION innodb_ft_user_stopword_table=default; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT `idx` (title,body) +) ENGINE=InnoDB; +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO articles (title,body) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','In what tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +create table user_stopword(value varchar(30)) engine = innodb; +set session innodb_ft_user_stopword_table = "test/user_stopword"; +insert into user_stopword values("mysqld"),("DBMS"); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); +id title body +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); +id title body +set session innodb_ft_user_stopword_table = default; +create table server_stopword(value varchar(30)) engine = innodb; +set global innodb_ft_server_stopword_table = "test/server_stopword"; +insert into server_stopword values("root"),("properly"); +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); +id title body +set session innodb_ft_user_stopword_table = "test/user_stopword"; +set global innodb_ft_server_stopword_table = "test/server_stopword"; +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); +id title body +6 MySQL Security When configured properly, MySQL ... +set session innodb_ft_user_stopword_table = "test/user_stopword"; +DELETE FROM user_stopword; +set global innodb_ft_server_stopword_table = "test/server_stopword"; +DELETE FROM server_stopword; +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly'); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE); +id title body +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +DROP TABLE articles,user_stopword,server_stopword; +SET SESSION innodb_ft_enable_stopword=@innodb_ft_enable_stopword_orig; +SET GLOBAL innodb_ft_server_stopword_table=default; +SET SESSION innodb_ft_user_stopword_table=default; +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT `idx` (title,body) +) ENGINE=InnoDB; +SHOW CREATE TABLE articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `idx` (`title`,`body`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +INSERT INTO articles (title,body) VALUES +('MySQL from Tutorial','DBMS stands for DataBase ...') , +('when To Use MySQL Well','After that you went through a ...'), +('where will Optimizing MySQL','In what tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SET SESSION innodb_ft_enable_stopword = 0; +select @@innodb_ft_enable_stopword; +@@innodb_ft_enable_stopword +0 +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +"In connection 1" +connection con1; +select @@innodb_ft_enable_stopword; +@@innodb_ft_enable_stopword +1 +ANALYZE TABLE articles; +Table Op Msg_type Msg_text +test.articles analyze status Engine-independent statistics collected +test.articles analyze Warning Engine-independent statistics are not collected for column 'body' +test.articles analyze status OK +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); +id title body +2 when To Use MySQL Well After that you went through a ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +1 MySQL from Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +2 when To Use MySQL Well After that you went through a ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); +id title body +2 when To Use MySQL Well After that you went through a ... +3 where will Optimizing MySQL In what tutorial we will show ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); +id title body +1 MySQL from Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SET SESSION innodb_ft_enable_stopword = 1; +select @@innodb_ft_enable_stopword; +@@innodb_ft_enable_stopword +1 +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); +id title body +"In connection default" +connection default; +select @@innodb_ft_enable_stopword; +@@innodb_ft_enable_stopword +0 +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when"); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE); +id title body +INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words'); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); +id title body +SET SESSION innodb_ft_enable_stopword = 1; +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE); +id title body +"In connection 1" +connection con1; +SET SESSION innodb_ft_enable_stopword = 1; +create table user_stopword(value varchar(30)) engine = innodb; +set session innodb_ft_user_stopword_table = "test/user_stopword"; +insert into user_stopword values("this"),("will"),("the"); +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +"In connection default" +connection default; +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will'); +id title body +select @@innodb_ft_user_stopword_table; +@@innodb_ft_user_stopword_table +NULL +create table user_stopword_1(value varchar(30)) engine = innodb; +set session innodb_ft_user_stopword_table = "test/user_stopword_1"; +insert into user_stopword_1 values("when"); +SET SESSION innodb_ft_enable_stopword = 1; +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); +id title body +2 when To Use MySQL Well After that you went through a ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when'); +id title body +2 when To Use MySQL Well After that you went through a ... +6 MySQL Security When configured properly, MySQL ... +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when'); +id title body +"In connection 1" +connection con1; +SET SESSION innodb_ft_enable_stopword = 1; +SET SESSION innodb_ft_user_stopword_table=default; +select @@innodb_ft_user_stopword_table; +@@innodb_ft_user_stopword_table +NULL +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +NULL +create table server_stopword(value varchar(30)) engine = innodb; +SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword"; +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +test/server_stopword +insert into server_stopword values("when"),("the"); +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the'); +id title body +disconnect con1; +"In connection default" +connection default; +SET SESSION innodb_ft_enable_stopword = 1; +SET SESSION innodb_ft_user_stopword_table=default; +select @@innodb_ft_server_stopword_table; +@@innodb_ft_server_stopword_table +test/server_stopword +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +insert into server_stopword values("where"),("will"); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); +id title body +3 where will Optimizing MySQL In what tutorial we will show ... +ALTER TABLE articles DROP INDEX idx; +ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the'); +id title body +SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where'); +id title body +DROP TABLE articles,user_stopword,user_stopword_1,server_stopword; +SET GLOBAL innodb_ft_user_stopword_table=@innodb_ft_user_stopword_table_orig; +SET GLOBAL innodb_ft_server_stopword_table=@innodb_ft_server_stopword_table_orig; diff --git a/mysql-test/suite/innodb_fts/r/sync.result b/mysql-test/suite/innodb_fts/r/sync.result new file mode 100644 index 00000000..928efffd --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/sync.result @@ -0,0 +1,157 @@ +connect con1,localhost,root,,; +connection default; +# Case 1: Test select and insert(row in both disk and cache) +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +FULLTEXT(title) +) ENGINE = InnoDB; +INSERT INTO t1(title) VALUES('mysql'); +INSERT INTO t1(title) VALUES('database'); +connection con1; +SET @old_dbug = @@SESSION.debug_dbug; +SET debug_dbug = '+d,fts_instrument_sync_debug'; +SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR selected'; +INSERT INTO t1(title) VALUES('mysql database'); +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR written'; +SET GLOBAL innodb_ft_aux_table="test/t1"; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +database 2 3 2 2 0 +database 2 3 2 3 6 +mysql 1 3 2 1 0 +mysql 1 3 2 3 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SET GLOBAL innodb_ft_aux_table=default; +SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); +FTS_DOC_ID title +1 mysql +2 database +SET DEBUG_SYNC= 'now SIGNAL selected'; +connection con1; +SET @old_dbug = @@SESSION.debug_dbug; +SET GLOBAL innodb_ft_aux_table="test/t1"; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +database 2 3 2 2 0 +database 2 3 2 3 6 +mysql 1 3 2 1 0 +mysql 1 3 2 3 0 +SET GLOBAL innodb_ft_aux_table=default; +SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); +FTS_DOC_ID title +3 mysql database +1 mysql +2 database +connection default; +DROP TABLE t1; +# Case 2: Test insert and insert(sync) +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +FULLTEXT(title) +) ENGINE = InnoDB; +INSERT INTO t1(title) VALUES('mysql'); +INSERT INTO t1(title) VALUES('database'); +connection con1; +SET debug_dbug = '+d,fts_instrument_sync_debug'; +SET DEBUG_SYNC= 'fts_write_node SIGNAL written WAIT_FOR inserted'; +INSERT INTO t1(title) VALUES('mysql database'); +connection default; +SET DEBUG_SYNC= 'now WAIT_FOR written'; +INSERT INTO t1(title) VALUES('mysql database'); +SET DEBUG_SYNC= 'now SIGNAL inserted'; +connection con1; +SET debug_dbug = @old_dbug; +SET GLOBAL innodb_ft_aux_table="test/t1"; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +database 2 3 2 2 0 +database 2 3 2 3 6 +database 4 4 1 4 6 +mysql 1 4 3 1 0 +mysql 1 4 3 3 0 +mysql 1 4 3 4 0 +SET GLOBAL innodb_ft_aux_table=default; +SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); +FTS_DOC_ID title +3 mysql database +4 mysql database +1 mysql +2 database +connection default; +disconnect con1; +DROP TABLE t1; +# Case 3: Test insert crash recovery +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +FULLTEXT(title) +) ENGINE = InnoDB; +INSERT INTO t1(title) VALUES('database'); +SET debug_dbug = '+d,fts_instrument_sync_debug,fts_write_node_crash'; +INSERT INTO t1(title) VALUES('mysql'); +ERROR HY000: Lost connection to server during query +# restart +After restart +SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); +title +database +SET @old_dbug = @@SESSION.debug_dbug; +SET debug_dbug = '+d,fts_instrument_sync_debug'; +INSERT INTO t1(title) VALUES('mysql'); +SET debug_dbug = @old_dbug; +SELECT title FROM t1 WHERE MATCH(title) AGAINST ('mysql database'); +title +database +mysql +DROP TABLE t1; +# Case 4: Test sync commit & rollback in background +CREATE TABLE t1( +id INT AUTO_INCREMENT, +title VARCHAR(100), +FULLTEXT(title), +PRIMARY KEY(id)) ENGINE=InnoDB; +SET debug_dbug = '+d,fts_instrument_sync'; +INSERT INTO t1(title) VALUES('mysql'); +SET debug_dbug = @old_dbug; +# restart +SET @old_global_dbug = @@GLOBAL.debug_dbug; +SET @old_dbug = @@SESSION.debug_dbug; +SET GLOBAL debug_dbug='+d,fts_instrument_sync,fts_instrument_sync_interrupted'; +INSERT INTO t1(title) VALUES('database'); +SET GLOBAL debug_dbug = @old_global_dbug; +SET debug_dbug = '+d,fts_instrument_sync_debug'; +INSERT INTO t1(title) VALUES('good'); +SET debug_dbug = @old_dbug; +SET GLOBAL innodb_ft_aux_table="test/t1"; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +database 2 2 1 2 0 +good 3 3 1 3 0 +mysql 1 1 1 1 0 +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SET GLOBAL innodb_ft_aux_table=default; +SELECT * FROM t1 WHERE MATCH(title) AGAINST ('mysql database good'); +id title +1 mysql +2 database +3 good +DROP TABLE t1; +# +# MDEV-26273 InnoDB fts DDL fails when +# innodb_force_recovery is set to 2 +# +# restart: --innodb_force_recovery=2 +CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED KEY, +f1 CHAR(200)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FULLTEXT INDEX(f1); +DROP TABLE t1; +# restart diff --git a/mysql-test/suite/innodb_fts/r/sync_block.result b/mysql-test/suite/innodb_fts/r/sync_block.result new file mode 100644 index 00000000..65bee127 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/sync_block.result @@ -0,0 +1,83 @@ +SET @old_log_output = @@global.log_output; +SET @old_slow_query_log = @@global.slow_query_log; +SET @old_general_log = @@global.general_log; +SET @old_long_query_time = @@global.long_query_time; +SET @old_debug = @@global.debug_dbug; +SET GLOBAL log_output = 'TABLE'; +SET GLOBAL general_log = 1; +SET GLOBAL slow_query_log = 1; +SET GLOBAL long_query_time = 1; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection default; +# Case 1: Sync blocks DML(insert) on the same table. +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +FULLTEXT(title) +) ENGINE = InnoDB; +connection con1; +SET GLOBAL debug_dbug='+d,fts_instrument_sync_debug,fts_instrument_sync_sleep'; +SET DEBUG_SYNC= 'fts_sync_begin SIGNAL begin WAIT_FOR continue'; +INSERT INTO t1(title) VALUES('mysql database'); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR begin'; +SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); +connection default; +SET DEBUG_SYNC= 'now SIGNAL continue'; +connection con1; +/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database'); +connection con2; +/* conneciton con2 */ SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database'); +FTS_DOC_ID title +connection default; +# make con1 & con2 show up in mysql.slow_log +SELECT SLEEP(2); +SLEEP(2) +0 +# slow log results should only contain INSERT INTO t1. +SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; +sql_text +INSERT INTO t1(title) VALUES('mysql database') +SET GLOBAL debug_dbug = @old_debug; +TRUNCATE TABLE mysql.slow_log; +DROP TABLE t1; +# Case 2: Sync blocks DML(insert) on other tables. +CREATE TABLE t1 ( +FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +FULLTEXT(title) +) ENGINE = InnoDB; +CREATE TABLE t2(id INT); +connection con1; +SET GLOBAL debug_dbug='+d,fts_instrument_sync_request,fts_instrument_sync_sleep'; +SET DEBUG_SYNC= 'fts_instrument_sync_request SIGNAL begin WAIT_FOR continue'; +INSERT INTO t1(title) VALUES('mysql database'); +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR begin'; +INSERT INTO t2 VALUES(1); +connection default; +SET DEBUG_SYNC= 'now SIGNAL continue'; +connection con1; +/* connection con1 */ INSERT INTO t1(title) VALUES('mysql database'); +connection con2; +/* conneciton con2 */ INSERT INTO t2 VALUES(1); +connection default; +SET DEBUG_SYNC = 'RESET'; +# make con1 & con2 show up in mysql.slow_log +SELECT SLEEP(2); +SLEEP(2) +0 +# slow log results should be empty here. +SELECT sql_text FROM mysql.slow_log WHERE query_time >= '00:00:02'; +sql_text +SET GLOBAL debug_dbug = @old_debug; +TRUNCATE TABLE mysql.slow_log; +DROP TABLE t1,t2; +disconnect con1; +disconnect con2; +# Restore slow log settings. +SET GLOBAL log_output = @old_log_output; +SET GLOBAL general_log = @old_general_log; +SET GLOBAL slow_query_log = @old_slow_query_log; +SET GLOBAL long_query_time = @old_long_query_time; diff --git a/mysql-test/suite/innodb_fts/r/sync_ddl.result b/mysql-test/suite/innodb_fts/r/sync_ddl.result new file mode 100644 index 00000000..441954dc --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/sync_ddl.result @@ -0,0 +1,105 @@ +CREATE TABLE t1 ( +id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, +value VARCHAR(1024) +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx1 ON t1(value); +SET @save_debug = @@GLOBAL.debug_dbug; +SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_sync_before_syncing,ib_trunc_sleep_before_fts_cache_clear'; +INSERT INTO t1 (value) VALUES +('By default or with the IN NATURAL LANGUAGE MODE modifier') +; +TRUNCATE TABLE t1; +DROP TABLE t1; +SET GLOBAL debug_dbug = @save_debug; +CREATE TABLE t1 ( +id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, +value VARCHAR(1024) +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx1 ON t1(value); +SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_write_words_before_select_index,ib_trunc_sleep_before_fts_cache_clear'; +INSERT INTO t1 (value) VALUES +('By default or with the IN NATURAL LANGUAGE MODE modifier'), +('performs a natural language search for a string'), +('collection is a set of one or more columns included'), +('returns a relevance value; that is, a similarity measure'), +('and the text in that row in the columns named in'), +('By default, the search is performed in case-insensitive'), +('sensitive full-text search, use a binary collation '), +('example, a column that uses the latin1 character'), +('collation of latin1_bin to make it case sensitive') +; +TRUNCATE TABLE t1; +DROP TABLE t1; +SET GLOBAL debug_dbug = @save_debug; +CREATE TABLE t1 ( +value VARCHAR(1024) +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx1 ON t1(value); +SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep'; +INSERT INTO t1 (value) VALUES +('By default or with the IN NATURAL LANGUAGE MODE modifier'), +('performs a natural language search for a string'), +('collection is a set of one or more columns included'), +('returns a relevance value; that is, a similarity measure'), +('and the text in that row in the columns named in'), +('By default, the search is performed in case-insensitive'), +('sensitive full-text search, use a binary collation '), +('example, a column that uses the latin1 character'), +('collation of latin1_bin to make it case sensitive') +; +DROP INDEX idx1 ON t1; +DROP TABLE t1; +SET GLOBAL debug_dbug = @save_debug; +CREATE TABLE t1 ( +value VARCHAR(1024) +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx1 ON t1(value); +SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep'; +INSERT INTO t1 (value) VALUES +('By default or with the IN NATURAL LANGUAGE MODE modifier'), +('performs a natural language search for a string'), +('collection is a set of one or more columns included'), +('returns a relevance value; that is, a similarity measure'), +('and the text in that row in the columns named in'), +('By default, the search is performed in case-insensitive'), +('sensitive full-text search, use a binary collation '), +('example, a column that uses the latin1 character'), +('collation of latin1_bin to make it case sensitive') +; +ALTER TABLE t1 +DROP INDEX idx1, +ALGORITHM=INPLACE; +DROP TABLE t1; +SET GLOBAL debug_dbug = @save_debug; +CREATE TABLE t1 ( +value VARCHAR(1024) +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx1 ON t1(value); +SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep'; +INSERT INTO t1 (value) VALUES +('example, a column that uses the latin1 character'), +('collation of latin1_bin to make it case sensitive') +; +ALTER TABLE t1 +DROP INDEX idx1, +ALGORITHM=COPY; +DROP TABLE t1; +SET GLOBAL debug_dbug = @save_debug; +CREATE TABLE t1 ( +id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +value VARCHAR(1024) +) ENGINE=InnoDB; +CREATE FULLTEXT INDEX idx1 ON t1(value); +SET GLOBAL debug_dbug = '+d,fts_instrument_sync_request,fts_instrument_msg_sync_sleep'; +INSERT INTO t1 (value) VALUES +('example, a column that uses the latin1 character'), +('collation of latin1_bin to make it case sensitive') +; +ALTER TABLE t1 +DROP COLUMN id1, +ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +DROP INDEX idx1, +ADD FULLTEXT INDEX idx2(value), +ALGORITHM=INPLACE; +DROP TABLE t1; +SET GLOBAL debug_dbug = @save_debug; diff --git a/mysql-test/suite/innodb_fts/r/versioning,prepare.result b/mysql-test/suite/innodb_fts/r/versioning,prepare.result new file mode 100644 index 00000000..ada4f30d --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/versioning,prepare.result @@ -0,0 +1,695 @@ +# Upgrade test +CREATE TEMPORARY TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table +CREATE TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +)with system versioning ENGINE=InnoDB; +INSERT INTO articles (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +INSERT INTO articles (title,body) VALUES +('test query expansion','for database ...'); +INSERT INTO articles (title,body) VALUES +('test proximity search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO articles (title,body) VALUES +('test my proximity fts new search, test, proximity and phrase', +'search, with proximity innodb'); +INSERT INTO articles (title,body) VALUES +('test more of proximity fts search, test, more proximity and phrase', +'search, with proximity innodb'); +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist."); +select * from information_schema.innodb_ft_default_stopword; +value +a +about +an +are +as +at +be +by +com +de +en +for +from +how +i +in +is +it +la +of +on +or +that +the +this +to +was +what +when +where +who +will +with +und +the +www +CREATE TABLE articles2 ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +)with system versioning ENGINE=InnoDB; +INSERT INTO articles2 (title,body) VALUES +('MySQL Tutorial','DBMS stands for DataBase ...') , +('How To Use MySQL Well','After you went through a ...'), +('Optimizing MySQL','In this tutorial we will show ...'), +('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), +('MySQL vs. YourSQL','In the following database comparison ...'), +('MySQL Security','When configured properly, MySQL ...'); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +set global innodb_ft_server_stopword_table = "not_defined"; +ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined' +set global innodb_ft_server_stopword_table = NULL; +create table user_stopword(value varchar(30)) engine = innodb; +set global innodb_ft_server_stopword_table = "test/user_stopword"; +drop index title on articles2; +create fulltext index idx on articles2(title, body); +insert into articles2 (title, body) +values ('test for stopwords','this is it...'); +insert into user_stopword values("the"); +delete from user_stopword; +insert into user_stopword values("this"); +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +ERROR HY000: Index articles is corrupted +call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB"); +alter table articles force; +Warnings: +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +flush tables; +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`body`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +7 test query expansion for database ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +3 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +3 +SELECT id, body, MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score +FROM articles; +id body score +1 DBMS stands for DataBase ... 0.2734021842479706 +2 After you went through a ... 0 +3 In this tutorial we will show ... 0 +4 1. Never run mysqld as root. 2. ... 0 +5 In the following database comparison ... 0.2734021842479706 +6 When configured properly, MySQL ... 0 +7 for database ... 0.2734021842479706 +8 search, with proximity innodb 0 +9 search, with proximity innodb 0 +10 search, with proximity innodb 0 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('t*' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +7 test query expansion for database ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MY*' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('ru*' IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +10 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('test' WITH QUERY EXPANSION); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +8 test proximity search, test, proximity and phrase search, with proximity innodb +7 test query expansion for database ... +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@3' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@2' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following database"' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@1' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"' IN BOOLEAN MODE); +id title body +set global innodb_ft_server_stopword_table= "test/user_stopword"; +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +drop index idx on articles2; +Warnings: +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +create fulltext index idx on articles2(title, body); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +# Downgrade test +alter table articles force; +Warnings: +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +flush tables; +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`body`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +7 test query expansion for database ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +3 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +3 +SELECT id, body, MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score +FROM articles; +id body score +1 DBMS stands for DataBase ... 0.2734021842479706 +2 After you went through a ... 0 +3 In this tutorial we will show ... 0 +4 1. Never run mysqld as root. 2. ... 0 +5 In the following database comparison ... 0.2734021842479706 +6 When configured properly, MySQL ... 0 +7 for database ... 0.2734021842479706 +8 search, with proximity innodb 0 +9 search, with proximity innodb 0 +10 search, with proximity innodb 0 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('t*' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +7 test query expansion for database ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MY*' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('ru*' IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +10 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('test' WITH QUERY EXPANSION); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +8 test proximity search, test, proximity and phrase search, with proximity innodb +7 test query expansion for database ... +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@3' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@2' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following database"' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@1' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"' IN BOOLEAN MODE); +id title body +set global innodb_ft_server_stopword_table= "test/user_stopword"; +drop index idx on articles2; +Warnings: +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +create fulltext index idx on articles2(title, body); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +# Cleanup +drop tables articles, articles2, user_stopword; +set global innodb_ft_server_stopword_table= default; diff --git a/mysql-test/suite/innodb_fts/r/versioning.result b/mysql-test/suite/innodb_fts/r/versioning.result new file mode 100644 index 00000000..baf25331 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/versioning.result @@ -0,0 +1,304 @@ +# Upgrade test +DROP TABLE mysql.innodb_table_stats, mysql.innodb_index_stats; +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +ERROR HY000: Index articles is corrupted +call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB"); +alter table articles force; +Warnings: +Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB +flush tables; +show create table articles; +Table Create Table +articles CREATE TABLE `articles` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(200) DEFAULT NULL, + `body` text DEFAULT NULL, + PRIMARY KEY (`id`), + FULLTEXT KEY `title` (`title`,`body`) +) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +7 test query expansion for database ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE); +COUNT(*) +3 +SELECT * FROM articles +WHERE MATCH (title, body) +AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT COUNT(IF(MATCH (title,body) +AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL)) +AS count FROM articles; +count +3 +SELECT id, body, MATCH (title,body) +AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score +FROM articles; +id body score +1 DBMS stands for DataBase ... 0.2734021842479706 +2 After you went through a ... 0 +3 In this tutorial we will show ... 0 +4 1. Never run mysqld as root. 2. ... 0 +5 In the following database comparison ... 0.2734021842479706 +6 When configured properly, MySQL ... 0 +7 for database ... 0.2734021842479706 +8 search, with proximity innodb 0 +9 search, with proximity innodb 0 +10 search, with proximity innodb 0 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('MySQL' IN NATURAL LANGUAGE MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('DBMS Security' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('t*' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +7 test query expansion for database ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('MY*' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('ru*' IN BOOLEAN MODE); +id title body +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +6 MySQL Security When configured properly, MySQL ... +1 MySQL Tutorial DBMS stands for DataBase ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR HY000: Table handler out of memory +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +id title body +6 MySQL Security When configured properly, MySQL ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))' + IN BOOLEAN MODE); +id title body +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) AGAINST +('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))' + IN BOOLEAN MODE); +ERROR 42000: syntax error, unexpected $end +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +1 MySQL Tutorial DBMS stands for DataBase ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) +AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE); +id title body +1 MySQL Tutorial DBMS stands for DataBase ... +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE); +id title body +2 How To Use MySQL Well After you went through a ... +3 Optimizing MySQL In this tutorial we will show ... +4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT COUNT(*) FROM articles +WHERE MATCH (title,body) +AGAINST ('database' WITH QUERY EXPANSION); +COUNT(*) +10 +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('test' WITH QUERY EXPANSION); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +8 test proximity search, test, proximity and phrase search, with proximity innodb +7 test query expansion for database ... +1 MySQL Tutorial DBMS stands for DataBase ... +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@3' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following comparison"@2' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"following database"' IN BOOLEAN MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@2' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"proximity search"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@5' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@1' IN BOOLEAN MODE); +id title body +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@4' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"test proximity"@3' IN BOOLEAN MODE); +id title body +8 test proximity search, test, proximity and phrase search, with proximity innodb +9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@4' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"@3' IN BOOLEAN MODE); +id title body +10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb +SELECT * FROM articles +WHERE MATCH (title,body) +AGAINST ('"more test proximity"' IN BOOLEAN MODE); +id title body +set global innodb_ft_server_stopword_table= "test/user_stopword"; +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +drop index idx on articles2; +Warnings: +Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB +create fulltext index idx on articles2(title, body); +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('the' IN NATURAL LANGUAGE MODE); +id title body +5 MySQL vs. YourSQL In the following database comparison ... +SELECT * FROM articles2 WHERE MATCH (title,body) +AGAINST ('this' IN NATURAL LANGUAGE MODE); +id title body +# Cleanup +drop tables articles, articles2, user_stopword; +set global innodb_ft_server_stopword_table= default; |