Have the xBestIndex method of the generate_series virtual table ignore contraints on the "value" column with usable=0.

FossilOrigin-Name: f5113a2ef84831ad2da723fa7e29e0d575e74e10585741ff51db8c2e37332cd2
This commit is contained in:
dan 2024-11-05 18:25:32 +00:00
parent 2ad29f3611
commit 19c4fa92dd
4 changed files with 33 additions and 10 deletions

View File

@ -659,7 +659,7 @@ static int seriesBestIndex(
continue;
}
if( pConstraint->iColumn<SERIES_COLUMN_START ){
if( pConstraint->iColumn==SERIES_COLUMN_VALUE ){
if( pConstraint->iColumn==SERIES_COLUMN_VALUE && pConstraint->usable ){
switch( op ){
case SQLITE_INDEX_CONSTRAINT_EQ:
case SQLITE_INDEX_CONSTRAINT_IS: {

View File

@ -1,5 +1,5 @@
C Work\saround\sa\sTCL\s{list-quoting}\squirk\swhen\sescaped/deferred\svar\sderefs\sare\spassed\sin\sas\svalues\sto\sthe\sautotools-conventional\s--XYZdir\sflags\s(as\sseen\sin\sa\sdownstream\spackage\sbuild\sscript).
D 2024-11-05T13:34:30.811
C Have\sthe\sxBestIndex\smethod\sof\sthe\sgenerate_series\svirtual\stable\signore\scontraints\son\sthe\s"value"\scolumn\swith\susable=0.
D 2024-11-05T18:25:32.313
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
@ -434,7 +434,7 @@ F ext/misc/regexp.c 4bdd0045912f81c84908bd535ec5ad3b1c8540b4287c70ab840709636240
F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c
F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/scrub.c 2a44b0d44c69584c0580ad2553f6290a307a49df4668941d2812135bfb96a946
F ext/misc/series.c ea604a16f9c5f7e09ccff3f18d94f2c3a6fa24ca08856156823d981873b8143c
F ext/misc/series.c cbdda2e2eb8159a1331974d246984c6e2693c6ea93930e6165046c8dbb8db0e9
F ext/misc/sha1.c cb5002148c2661b5946f34561701e9105e9d339b713ec8ac057fd888b196dcb9
F ext/misc/shathree.c 1821d90a0040c9accdbe3e3527d378d30569475d758aa70f6848924c0b430e8c
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
@ -1707,7 +1707,7 @@ F test/sync.test 89539f4973c010eda5638407e71ca7fddbcd8e0594f4c9980229f804d433309
F test/sync2.test 8f9f7d4f6d5be8ca8941a8dadcc4299e558cb6a1ff653a9469146c7a76ef2039
F test/syscall.test a067468b43b8cb2305e9f9fe414e5f40c875bb5d2cba5f00b8154396e95fcf37
F test/sysfault.test c9f2b0d8d677558f74de750c75e12a5454719d04
F test/tabfunc01.test 6002a5f37b76355f173c75c2b3b03173b19d6a8b078c5baaa4c78bbcd0fa6323
F test/tabfunc01.test 7be82bd50c7ede7f01b2dd17cd1b84f352c516078222d0b067d858f081e3f9a7
F test/table.test 7862a00b58b5541511a26757ea9c5c7c3f8298766e98aa099deec703d9c0a8e0
F test/tableapi.test ecbcc29c4ab62c1912c3717c48ea5c5e59f7d64e4a91034e6148bd2b82f177f4
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
@ -2199,8 +2199,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 77db0cd736746873d4ed3dbf0e9a43a3e15ab49961fccee20417e01f88de8664
R dc412e7f7529f14cc6f79cc175ee95e6
U stephan
Z 5cbeb98d76b54f40a03e87cc7f52d846
P 6adfca7e85648584740c8a127b95bd46aaad45fa2d162bd44622bb47debbcbcb
R fb38b73bd5bdc524c9d9ddb12da6fa10
U dan
Z af4d59a9b5ba76359d3ebd50499f4172
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
6adfca7e85648584740c8a127b95bd46aaad45fa2d162bd44622bb47debbcbcb
f5113a2ef84831ad2da723fa7e29e0d575e74e10585741ff51db8c2e37332cd2

View File

@ -348,6 +348,29 @@ do_execsql_test tabfunc01-920 {
) LIMIT -1 OFFSET 0;
} {1 2 3 4 5 6 7 8 9 10 101 102 103 104}
#-------------------------------------------------------------------------
# Forum post https://sqlite.org/forum/forumpost/e7c3ae1215
#
foreach {tn where res} {
1000 "where value = 2" 2
1010 "where value in (2)" 2
1020 "where value in (select 2)" 2
1030 "where value = 2 OR value = 4" {2 4}
1040 "where value in (2, 4)" {2 4}
} {
do_execsql_test $tn "
SELECT value FROM generate_series(1, 5) $where
" $res
}
do_execsql_test 1100 {
select 1 as c_0
from
generate_series(1, 1) as ref_3
where (ref_3.value) in (select 1);
} {1}
# Free up memory allocations
intarray_addr