Require that the contentless_unindexed=1 option be specified before storing the values of fts5 UNINDEXED column belonging to contentless tables.
FossilOrigin-Name: c51dc2a5e75baacbd905cf314e7b1a58a81993ff05ca656739e028d7db25d5b2
This commit is contained in:
parent
6e8b3d3caa
commit
0218424e5a
@ -224,6 +224,7 @@ struct Fts5Config {
|
||||
int *aPrefix; /* Sizes in bytes of nPrefix prefix indexes */
|
||||
int eContent; /* An FTS5_CONTENT value */
|
||||
int bContentlessDelete; /* "contentless_delete=" option (dflt==0) */
|
||||
int bContentlessUnindexed; /* "contentless_unindexed=" option (dflt=0) */
|
||||
char *zContent; /* content table */
|
||||
char *zContentRowid; /* "content_rowid=" option value */
|
||||
int bColumnsize; /* "columnsize=" option value (dflt==1) */
|
||||
|
@ -241,6 +241,7 @@ static int fts5ConfigParseSpecial(
|
||||
){
|
||||
int rc = SQLITE_OK;
|
||||
int nCmd = (int)strlen(zCmd);
|
||||
|
||||
if( sqlite3_strnicmp("prefix", zCmd, nCmd)==0 ){
|
||||
const int nByte = sizeof(int) * FTS5_MAX_PREFIX_INDEXES;
|
||||
const char *p;
|
||||
@ -360,6 +361,16 @@ static int fts5ConfigParseSpecial(
|
||||
return rc;
|
||||
}
|
||||
|
||||
if( sqlite3_strnicmp("contentless_unindexed", zCmd, nCmd)==0 ){
|
||||
if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\0' ){
|
||||
*pzErr = sqlite3_mprintf("malformed contentless_delete=... directive");
|
||||
rc = SQLITE_ERROR;
|
||||
}else{
|
||||
pConfig->bContentlessUnindexed = (zArg[0]=='1');
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
if( sqlite3_strnicmp("content_rowid", zCmd, nCmd)==0 ){
|
||||
if( pConfig->zContentRowid ){
|
||||
*pzErr = sqlite3_mprintf("multiple content_rowid=... directives");
|
||||
@ -655,6 +666,19 @@ int sqlite3Fts5ConfigParse(
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
|
||||
/* We only allow contentless_unindexed=1 if the table is actually a
|
||||
** contentless one.
|
||||
*/
|
||||
if( rc==SQLITE_OK
|
||||
&& pRet->bContentlessUnindexed
|
||||
&& pRet->eContent!=FTS5_CONTENT_NONE
|
||||
){
|
||||
*pzErr = sqlite3_mprintf(
|
||||
"contentless_unindexed=1 requires a contentless table"
|
||||
);
|
||||
rc = SQLITE_ERROR;
|
||||
}
|
||||
|
||||
/* If no zContent option was specified, fill in the default values. */
|
||||
if( rc==SQLITE_OK && pRet->zContent==0 ){
|
||||
const char *zTail = 0;
|
||||
@ -663,7 +687,7 @@ int sqlite3Fts5ConfigParse(
|
||||
);
|
||||
if( pRet->eContent==FTS5_CONTENT_NORMAL ){
|
||||
zTail = "content";
|
||||
}else if( bUnindexed ){
|
||||
}else if( bUnindexed && pRet->bContentlessUnindexed ){
|
||||
pRet->eContent = FTS5_CONTENT_UNINDEXED;
|
||||
zTail = "content";
|
||||
}else if( pRet->bColumnsize ){
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 2015 Apr 24
|
||||
# 2024 Sep 13
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
@ -24,7 +24,9 @@ ifcapable !fts5 {
|
||||
|
||||
|
||||
do_execsql_test 1.1 {
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(a, b UNINDEXED, content=);
|
||||
CREATE VIRTUAL TABLE t1 USING fts5(
|
||||
a, b UNINDEXED, content=, contentless_unindexed=1
|
||||
);
|
||||
} {}
|
||||
|
||||
do_execsql_test 1.2 {
|
||||
@ -93,7 +95,7 @@ do_execsql_test 1.15 {
|
||||
|
||||
do_execsql_test 2.0 {
|
||||
CREATE VIRTUAL TABLE t4 USING fts5(
|
||||
x, y UNINDEXED, z, columnsize=0, content=''
|
||||
x, y UNINDEXED, z, columnsize=0, content='', contentless_unindexed=1
|
||||
);
|
||||
}
|
||||
|
||||
@ -106,7 +108,8 @@ reset_db
|
||||
|
||||
do_execsql_test 3.0 {
|
||||
CREATE VIRTUAL TABLE x1 USING fts5(
|
||||
a UNINDEXED, b, c UNINDEXED, d, content=, contentless_delete=1
|
||||
a UNINDEXED, b, c UNINDEXED, d, content=, contentless_delete=1,
|
||||
contentless_unindexed=1
|
||||
);
|
||||
}
|
||||
|
||||
@ -172,5 +175,31 @@ do_execsql_test 3.10 {
|
||||
SELECT rowid, fts5_test_columntext(x1) FROM x1('b*')
|
||||
} {1000 {AAA {} CCC {}}}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Check that if contentless_unindexed=1 is not specified, the values
|
||||
# of UNINDEXED columns are not stored in the database.
|
||||
#
|
||||
# Also check that contentless_unindexed=1 is not allowed unless the table
|
||||
# is actually contentless.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test 4.0 {
|
||||
CREATE VIRTUAL TABLE ft USING fts5(a, b, c UNINDEXED, content='');
|
||||
INSERT INTO ft VALUES('one', 'two', 'three');
|
||||
SELECT rowid, * FROM ft;
|
||||
} {1 {} {} {}}
|
||||
|
||||
do_execsql_test 4.1 {
|
||||
SELECT name FROM sqlite_schema ORDER BY 1
|
||||
} {
|
||||
ft ft_config ft_data ft_docsize ft_idx
|
||||
}
|
||||
|
||||
do_catchsql_test 4.2 {
|
||||
CREATE VIRTUAL TABLE ft2 USING fts5(
|
||||
a, b, c UNINDEXED, contentless_unindexed=1
|
||||
);
|
||||
} {1 {contentless_unindexed=1 requires a contentless table}}
|
||||
|
||||
finish_test
|
||||
|
||||
|
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Merge\slatest\strunk\schanges,\sincluding\sthe\schanges\sto\sthe\sfts5\slocale=1\sfeature,\sinto\sthis\sbranch.
|
||||
D 2024-09-13T15:37:31.588
|
||||
C Require\sthat\sthe\scontentless_unindexed=1\soption\sbe\sspecified\sbefore\sstoring\sthe\svalues\sof\sfts5\sUNINDEXED\scolumn\sbelonging\sto\scontentless\stables.
|
||||
D 2024-09-13T16:30:18.635
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -93,10 +93,10 @@ F ext/fts3/unicode/mkunicode.tcl 63db9624ccf70d4887836c320eda93ab552f21008f3be7e
|
||||
F ext/fts3/unicode/parseunicode.tcl a981bd6466d12dd17967515801c3ff23f74a281be1a03cf1e6f52a6959fc77eb
|
||||
F ext/fts5/extract_api_docs.tcl 009cf59c77afa86d137b0cca3e3b1a5efbe2264faa2df233f9a7aa8563926d15
|
||||
F ext/fts5/fts5.h efaaac0df3d3bc740383044c144b582f47921aafa21d7b10eb98f42c24c740b0
|
||||
F ext/fts5/fts5Int.h 6ec0c8a49412e2d7433ebc416cc5a5fd8583dbda30ba46c8835027a4e5c9b41a
|
||||
F ext/fts5/fts5Int.h 927772e795bc897a210630296531c6a397b247f0b6f65ef9e9dc8e03baa77d1d
|
||||
F ext/fts5/fts5_aux.c 65a0468dd177d6093aa9ae1622e6d86b0136b8d267c62c0ad6493ad1e9a3d759
|
||||
F ext/fts5/fts5_buffer.c 0eec58bff585f1a44ea9147eae5da2447292080ea435957f7488c70673cb6f09
|
||||
F ext/fts5/fts5_config.c 700d7accca99d931390c4fcb7c71b92bbcff9093aa9c2d566d7f16a3c9550a59
|
||||
F ext/fts5/fts5_config.c a6633d88596758941c625b526075b85d3d9fd1089d8d9eab5db6e8a71fd347ad
|
||||
F ext/fts5/fts5_expr.c 9a56f53700d1860f0ee2f373c2b9074eaf2a7aa0637d0e27a6476de26a3fee33
|
||||
F ext/fts5/fts5_hash.c adda4272be401566a6e0ba1acbe70ee5cb97fce944bc2e04dc707152a0ec91b1
|
||||
F ext/fts5/fts5_index.c 571483823193f09439356741669aa8c81da838ae6f5e1bfa7517f7ee2fb3addd
|
||||
@ -246,7 +246,7 @@ F ext/fts5/test/fts5unicode2.test 3bbd30152f9f760bf13886e5b1e5ec23ff62f56758ddda
|
||||
F ext/fts5/test/fts5unicode3.test f4891a3dac3b49c3d7c0fdb29566e9eb0ecff35263370c89f9661b1952b20818
|
||||
F ext/fts5/test/fts5unicode4.test 728c8f0caafb05567f524ad313d9f8b780fa45987b8a8df04eff87923c74b4d0
|
||||
F ext/fts5/test/fts5unindexed.test 168838d2c385e131120bbf5b516d2432a5fabc4caa2259c932e1d49ae209a4ae
|
||||
F ext/fts5/test/fts5unindexed2.test f8453dcf1df11544263d350d388d5c612be4b379079b308f1ad74cdaa940804e
|
||||
F ext/fts5/test/fts5unindexed2.test ec091c92a74d9dd8fa968c6de743982a39ab48b3f1d78e85a45865a615a982ce
|
||||
F ext/fts5/test/fts5update.test b8affd796e45c94a4d19ad5c26606ea06065a0f162a9562d9f005b5a80ccf0bc
|
||||
F ext/fts5/test/fts5version.test c22d163c17e60a99f022cbc52de5a48bb7f84deaa00fe15e9bc4c3aa1996204e
|
||||
F ext/fts5/test/fts5vocab.test 2a2bdb60d0998fa3124d541b6d30b019504918dc43a6584645b63a24be72f992
|
||||
@ -436,7 +436,7 @@ F ext/misc/urifuncs.c f71360d14fa9e7626b563f1f781c6148109462741c5235ac63ae0f8917
|
||||
F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505cf
|
||||
F ext/misc/vfslog.c 3932ab932eeb2601dbc4447cb14d445aaa9fbe43b863ef5f014401c3420afd20
|
||||
F ext/misc/vfsstat.c a85df08654743922a19410d7b1e3111de41bb7cd07d20dd16eda4e2b808d269d
|
||||
F ext/misc/vfstrace.c 03f90dd465968e01f5d1d3e79c36cbc53a5bfe1bd55d239435ce94df19d5b0ac w src/test_vfstrace.c
|
||||
F ext/misc/vfstrace.c 03f90dd465968e01f5d1d3e79c36cbc53a5bfe1bd55d239435ce94df19d5b0ac
|
||||
F ext/misc/vtablog.c 1100250ce8782db37c833e3a9a5c9a3ecf1af5e15b8325572b82e6e0a138ffb5
|
||||
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
|
||||
F ext/misc/wholenumber.c 0fa0c082676b7868bf2fa918e911133f2b349bcdceabd1198bba5f65b4fc0668
|
||||
@ -2213,8 +2213,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 dcacb1a8ef359b4507b4733356d3150ba5dc105cc9867c103d16a0908a1a9f64 4cad385b90eaca2d90e3375e473472145af4134160b81097a8535d06638c2e4a
|
||||
R 6b427d068701369235fcf90674c4aaf6
|
||||
P d2f0d19936222911bc317efecc831007d3aba81f9b32877030ffb29d1728bbdc
|
||||
R e6e3b6faf33ff387284e052d2e40ed37
|
||||
U dan
|
||||
Z a31c0a78609956d9ed51a360c49325fd
|
||||
Z 7aa60982204ecdadda49bd214e78d921
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
d2f0d19936222911bc317efecc831007d3aba81f9b32877030ffb29d1728bbdc
|
||||
c51dc2a5e75baacbd905cf314e7b1a58a81993ff05ca656739e028d7db25d5b2
|
||||
|
Loading…
Reference in New Issue
Block a user