Index: third_party/sqlite/src/test/fts3d.test |
diff --git a/third_party/sqlite/src/test/fts3d.test b/third_party/sqlite/src/test/fts3d.test |
index 715980d86d3b2e53e3684ee797561bdee70f843c..5c04ead0a05446915856b16c6419dc6b9e8d9abf 100644 |
--- a/third_party/sqlite/src/test/fts3d.test |
+++ b/third_party/sqlite/src/test/fts3d.test |
@@ -213,16 +213,17 @@ do_test fts3d-4.matches { |
{0 1 0 4 0 2 5 3 0 3 9 1 0 5 11 4} \ |
{0 0 0 4 0 4 5 2 0 3 8 1 0 5 10 4}] |
-check_terms_all fts3d-4.1 {a four is one test that this three two was} |
+puts [db eval {SELECT c FROM t1 } ] |
+check_terms_all fts3d-4.1 {a four is test that this was} |
check_doclist_all fts3d-4.1.1 a {[1 0[2]] [2 0[2]] [3 0[2]]} |
check_doclist_all fts3d-4.1.2 four {} |
check_doclist_all fts3d-4.1.3 is {[1 0[1]] [3 0[1]]} |
-check_doclist_all fts3d-4.1.4 one {} |
+#check_doclist_all fts3d-4.1.4 one {} |
check_doclist_all fts3d-4.1.5 test {[1 0[3]] [2 0[3]] [3 0[3]]} |
check_doclist_all fts3d-4.1.6 that {[2 0[0]]} |
check_doclist_all fts3d-4.1.7 this {[1 0[0]] [3 0[0]]} |
-check_doclist_all fts3d-4.1.8 three {} |
-check_doclist_all fts3d-4.1.9 two {} |
+#check_doclist_all fts3d-4.1.8 three {} |
+#check_doclist_all fts3d-4.1.9 two {} |
check_doclist_all fts3d-4.1.10 was {[2 0[1]]} |
check_terms fts3d-4.2 0 0 {a four test that was} |
@@ -239,21 +240,20 @@ check_doclist fts3d-4.3.3 0 1 is {[3 0[1]]} |
check_doclist fts3d-4.3.4 0 1 test {[3 0[3]]} |
check_doclist fts3d-4.3.5 0 1 this {[3 0[0]]} |
-check_terms fts3d-4.4 1 0 {a four is one test that this three two was} |
+check_terms fts3d-4.4 1 0 {a four is test that this was} |
check_doclist fts3d-4.4.1 1 0 a {[1 0[2]] [2 0[2]] [3 0[2]]} |
-check_doclist fts3d-4.4.2 1 0 four {[1] [2 0[4]] [3 0[4]]} |
+check_doclist fts3d-4.4.2 1 0 four {[2 0[4]] [3 0[4]]} |
check_doclist fts3d-4.4.3 1 0 is {[1 0[1]] [3 0[1]]} |
-check_doclist fts3d-4.4.4 1 0 one {[1] [2] [3]} |
+#check_doclist fts3d-4.4.4 1 0 one {[1] [2] [3]} |
check_doclist fts3d-4.4.5 1 0 test {[1 0[3]] [2 0[3]] [3 0[3]]} |
check_doclist fts3d-4.4.6 1 0 that {[2 0[0]]} |
check_doclist fts3d-4.4.7 1 0 this {[1 0[0]] [3 0[0]]} |
-check_doclist fts3d-4.4.8 1 0 three {[1] [2] [3]} |
-check_doclist fts3d-4.4.9 1 0 two {[1] [2] [3]} |
+#check_doclist fts3d-4.4.8 1 0 three {[1] [2] [3]} |
+#check_doclist fts3d-4.4.9 1 0 two {[1] [2] [3]} |
check_doclist fts3d-4.4.10 1 0 was {[2 0[1]]} |
# Optimize should leave the result in the level of the highest-level |
# prior segment. |
-breakpoint |
do_test fts3d-4.5 { |
execsql { |
SELECT OPTIMIZE(t1) FROM t1 LIMIT 1; |
@@ -304,4 +304,68 @@ do_test fts3d-5.1 { |
} |
} {{Index already optimal} 2 0} |
+ |
+# ALTER TABLE RENAME should work regardless of the database encoding. |
+# |
+do_test fts3d-6.0 { |
+ db close |
+ forcedelete test.db |
+ sqlite3 db test.db |
+ db eval { |
+ PRAGMA encoding=UTF8; |
+ CREATE VIRTUAL TABLE fts USING fts3(a,b,c); |
+ SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
+ } |
+} {fts_content fts_segdir fts_segments} |
+do_test fts3d-6.1 { |
+ db eval { |
+ ALTER TABLE fts RENAME TO xyz; |
+ SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
+ } |
+} {xyz_content xyz_segdir xyz_segments} |
+do_test fts3d-6.2 { |
+ db close |
+ forcedelete test.db |
+ sqlite3 db test.db |
+ db eval { |
+ PRAGMA encoding=UTF16le; |
+ CREATE VIRTUAL TABLE fts USING fts3(a,b,c); |
+ SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
+ } |
+} {fts_content fts_segdir fts_segments} |
+do_test fts3d-6.3 { |
+ db eval { |
+ ALTER TABLE fts RENAME TO xyz; |
+ SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
+ } |
+} {xyz_content xyz_segdir xyz_segments} |
+do_test fts3d-6.4 { |
+ db close |
+ forcedelete test.db |
+ sqlite3 db test.db |
+ db eval { |
+ PRAGMA encoding=UTF16be; |
+ CREATE VIRTUAL TABLE fts USING fts3(a,b,c); |
+ SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
+ } |
+} {fts_content fts_segdir fts_segments} |
+do_test fts3d-6.5 { |
+ db eval { |
+ ALTER TABLE fts RENAME TO xyz; |
+ SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
+ } |
+} {xyz_content xyz_segdir xyz_segments} |
+ |
+# ALTER TABLE RENAME on an FTS3 table following an incr-merge op. |
+# |
+do_test fts3d-6.6 { |
+ execsql { INSERT INTO xyz(xyz) VALUES('merge=2,2') } |
+ sqlite3 db test.db |
+ execsql { |
+ ALTER TABLE xyz RENAME TO ott; |
+ SELECT name FROM sqlite_master WHERE name GLOB '???_*' ORDER BY 1; |
+ } |
+} {ott_content ott_segdir ott_segments ott_stat} |
+ |
+ |
finish_test |