Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix the generate_series extension for the case where the termination value is not an even multiple of the step from the start value and there is also a value=NNN constraint in the WHERE clause. Forum post bf2dc8e9 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
75e72e3b0d0d689d39e00a01dc361dd6 |
User & Date: | drh 2025-03-13 18:51:18 |
Context
2025-03-14
| ||
09:34 | Cherrypick the [2b582c0097e33] doc addition, which was initially committed to the wrong branch. (check-in: f786de8d user: stephan tags: trunk) | |
2025-03-13
| ||
18:51 | Fix the generate_series extension for the case where the termination value is not an even multiple of the step from the start value and there is also a value=NNN constraint in the WHERE clause. Forum post bf2dc8e9 (check-in: 75e72e3b user: drh tags: trunk) | |
2025-03-12
| ||
15:17 | The --echo flag on the CLI also echos dot-commands provided on the command-line. (check-in: 6ec0c03b user: drh tags: trunk) | |
Changes
Changes to ext/misc/series.c.
︙ | ︙ | |||
515 516 517 518 519 520 521 | if( pCur->ss.iStep>0 ){ sqlite3_int64 szStep = pCur->ss.iStep; if( pCur->ss.iBase<iMin ){ sqlite3_uint64 d = iMin - pCur->ss.iBase; pCur->ss.iBase += ((d+szStep-1)/szStep)*szStep; } if( pCur->ss.iTerm>iMax ){ | < | < | | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | if( pCur->ss.iStep>0 ){ sqlite3_int64 szStep = pCur->ss.iStep; if( pCur->ss.iBase<iMin ){ sqlite3_uint64 d = iMin - pCur->ss.iBase; pCur->ss.iBase += ((d+szStep-1)/szStep)*szStep; } if( pCur->ss.iTerm>iMax ){ pCur->ss.iTerm = iMax; } }else{ sqlite3_int64 szStep = -pCur->ss.iStep; assert( szStep>0 ); if( pCur->ss.iBase>iMax ){ sqlite3_uint64 d = pCur->ss.iBase - iMax; pCur->ss.iBase -= ((d+szStep-1)/szStep)*szStep; } if( pCur->ss.iTerm<iMin ){ pCur->ss.iTerm = iMin; } } } /* Apply LIMIT and OFFSET constraints, if any */ if( idxNum & 0x20 ){ if( iOffset>0 ){ |
︙ | ︙ |
Changes to test/tabfunc01.test.
︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 | SELECT * FROM aux1.generate_series(1,4) } {1 2 3 4} # 2018-12-03: Fix bug reported by by private email. do_execsql_test tabfunc01-4.4 { SELECT * FROM (generate_series(1,5,2)) AS x LIMIT 10; } {1 3 5} # The next series of tests is verifying that virtual table are able # to optimize the IN operator, even on terms that are not marked "omit". # When the generate_series virtual table is compiled for the testfixture, # the special -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 option is used, which # causes the xBestIndex method of generate_series to leave the # sqlite3_index_constraint_usage.omit flag set to 0, which should cause | > > > > > > > > > > > > > | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | SELECT * FROM aux1.generate_series(1,4) } {1 2 3 4} # 2018-12-03: Fix bug reported by by private email. do_execsql_test tabfunc01-4.4 { SELECT * FROM (generate_series(1,5,2)) AS x LIMIT 10; } {1 3 5} # 2025-03-13 forum post bf2dc8e909983511 # do_execsql_test tabfunc01-5.1 { SELECT value FROM generate_series(60,73,6) WHERE value=66; } 66 do_execsql_test tabfunc01-5.2 { SELECT value FROM generate_series(73,60,-6) WHERE value=67; } 67 # The next series of tests is verifying that virtual table are able # to optimize the IN operator, even on terms that are not marked "omit". # When the generate_series virtual table is compiled for the testfixture, # the special -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 option is used, which # causes the xBestIndex method of generate_series to leave the # sqlite3_index_constraint_usage.omit flag set to 0, which should cause |
︙ | ︙ |