Fix another problem with ".expert" and virtual tables. [forum:/forumpost/49d6a19ec|Forum post 49d6a19ec].

FossilOrigin-Name: 7a7162293c8fdb0078fe56948d697703539dd23273b2072990d4391c761e6ae2
This commit is contained in:
dan 2024-10-20 07:19:38 +00:00
parent 72c5b9bf0e
commit b74c7880d6
4 changed files with 37 additions and 12 deletions

View File

@ -579,6 +579,31 @@ ifcapable fts5 {
list [catch { $expert sql "SELECT * FROM ft, t2 WHERE b=1" } msg] $msg
} {1 {no such table: t2}}
$expert destroy
reset_db
do_execsql_test 7.6 {
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS 'bfts_idx_data'(id INTEGER PRIMARY KEY, block BLOB);
CREATE TABLE IF NOT EXISTS 'fts_idx_data'(id INTEGER PRIMARY KEY, block BLOB);
INSERT INTO fts_idx_data VALUES(1,X'');
INSERT INTO fts_idx_data VALUES(10,X'00000000ff000001000000');
CREATE TABLE IF NOT EXISTS 'fts_idx_idx'(segid, term, pgno, PRIMARY KEY(segid, term)) WITHOUT ROWID;
CREATE TABLE IF NOT EXISTS 'fts_idx_docsize'(id INTEGER PRIMARY KEY, sz BLOB, origin INTEGER);
CREATE TABLE IF NOT EXISTS 'fts_idx_config'(k PRIMARY KEY, v) WITHOUT ROWID;
INSERT INTO fts_idx_config VALUES('version',4);
PRAGMA writable_schema=ON;
INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql)VALUES('table','fts_idx','fts_idx',0,'CREATE VIRTUAL TABLE fts_idx USING fts5(Title, Description, Channel, Tags, content='''', contentless_delete=1)');
CREATE TABLE f(x BLOB, y);
COMMIT;
PRAGMA writable_schema = RESET;
}
do_candidates_test 7.4 {
SELECT * FROM fts_idx, f WHERE x = fts_idx.Channel
} {
CREATE INDEX f_idx_00000078 ON f(x);
}
}
finish_test

View File

@ -1463,7 +1463,7 @@ static int idxCreateVtabSchema(sqlite3expert *p, char **pzErrmsg){
** 2) Create the equivalent virtual table in dbv.
*/
rc = idxPrepareStmt(p->db, &pSchema, pzErrmsg,
"SELECT type, name, sql, 1, sql LIKE 'create virtual%' "
"SELECT type, name, sql, 1, sql LIKE 'create virtual%%' "
"FROM sqlite_schema "
"WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%%' "
" UNION ALL "
@ -2024,9 +2024,9 @@ sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){
if( rc==SQLITE_OK ){
sqlite3_stmt *pSql = 0;
rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg,
"SELECT sql, name "
"SELECT sql, name, sql LIKE 'create virtual%%' AS virt "
" FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'"
" ORDER BY rowid"
" ORDER BY virt DESC, rowid"
);
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){
const char *zSql = (const char*)sqlite3_column_text(pSql, 0);

View File

@ -1,5 +1,5 @@
C Add\ssqlite3_rsync\sto\sthe\sdocs\sat\sthe\stop\sof\smktoolzip.tcl.\sNo\scode\schanges.
D 2024-10-19T22:45:50.359
C Fix\sanother\sproblem\swith\s".expert"\sand\svirtual\stables.\s[forum:/forumpost/49d6a19ec|Forum\spost\s49d6a19ec].
D 2024-10-20T07:19:38.106
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -60,8 +60,8 @@ F ext/consio/console_io.c d2b74afae8d301de2e8447b1045fcd33eb59df13bf581d906d99c7
F ext/consio/console_io.h b5ebe34aa15b357621ebbea3d3f2e2b24750d4280b5802516409e23947fd9ee5
F ext/expert/README.md b321c2762bb93c18ea102d5a5f7753a4b8bac646cb392b3b437f633caf2020c3
F ext/expert/expert.c d548d603a4cc9e61f446cc179c120c6713511c413f82a4a32b1e1e69d3f086a4
F ext/expert/expert1.test 1fa0201d8610883c32214b1d83e3a6cc582694ac1067be8319b280235145a555
F ext/expert/sqlite3expert.c b7cbbd7cc109c66ebdf6091467d790abb9d7c25ae3b822bb76388509641d37de
F ext/expert/expert1.test 1d2da6606623b57bb47064e02140823ce1daecd4cacbf402c73ad3473d7f000c
F ext/expert/sqlite3expert.c 9c5d1509407e00e6ed92ca68de33a6310d8f85c6760cfa07aa0083091da85b32
F ext/expert/sqlite3expert.h ca81efc2679a92373a13a3e76a6138d0310e32be53d6c3bfaedabd158ea8969b
F ext/expert/test_expert.c b767b2039a0df707eb3147e86bcf68b252d8455d9a41774b1a836cd052ceca70
F ext/fts3/README.content b9078d0843a094d86af0d48dffbff13c906702b4c3558012e67b9c7cc3bf59ee
@ -2219,8 +2219,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 5a594dbcd533aa1e37acea1702db993672c3c0e621add9ea26a497c52037617f
R f52c4332ad1b572fa4ee0e481be2b2fc
U stephan
Z 6df76b62cd44ada8a9bbd1113c02daf3
P 10f5c4a2fce8a9ea9b1533cabbaf4ca8549e72950d5c460c0f4501a9fc50e3e8
R 6bc83e3b61f3cce2168614e10c5b279e
U dan
Z cf287584db61588d64066982eaae1b83
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
10f5c4a2fce8a9ea9b1533cabbaf4ca8549e72950d5c460c0f4501a9fc50e3e8
7a7162293c8fdb0078fe56948d697703539dd23273b2072990d4391c761e6ae2