aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <>2024-06-06 23:56:36 +0000
committerdrh <>2024-06-06 23:56:36 +0000
commitdf9471b1b55e956fec7f25392bfe7fc5ca481202 (patch)
tree4edf89134b9d2744dde6058a0de1bec0ac4de09d /src/select.c
parent404ddadbd421fd3754cab1a3e90bb2dd74467fbd (diff)
parentbd1402487b5e2efcf8d7efa439ab070cee8f8ee2 (diff)
downloadsqlite-df9471b1b55e956fec7f25392bfe7fc5ca481202.tar.gz
sqlite-df9471b1b55e956fec7f25392bfe7fc5ca481202.zip
Allow the query planner access to the argument of LIMIT even if that
argument is a bound parameter. FossilOrigin-Name: c4a9dda2809c6e0e3d928e11e5553ead82cd9df551bcd35b11a7d869ef80ab8e
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/select.c b/src/select.c
index 4671dfa6d..9a0f2e40f 100644
--- a/src/select.c
+++ b/src/select.c
@@ -2492,7 +2492,7 @@ static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){
p->iLimit = iLimit = ++pParse->nMem;
v = sqlite3GetVdbe(pParse);
assert( v!=0 );
- if( sqlite3ExprIsInteger(pLimit->pLeft, &n) ){
+ if( sqlite3ExprIsInteger(pLimit->pLeft, &n, pParse) ){
sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);
VdbeComment((v, "LIMIT counter"));
if( n==0 ){
@@ -2972,7 +2972,7 @@ static int multiSelect(
p->pPrior = pPrior;
p->nSelectRow = sqlite3LogEstAdd(p->nSelectRow, pPrior->nSelectRow);
if( p->pLimit
- && sqlite3ExprIsInteger(p->pLimit->pLeft, &nLimit)
+ && sqlite3ExprIsInteger(p->pLimit->pLeft, &nLimit, pParse)
&& nLimit>0 && p->nSelectRow > sqlite3LogEst((u64)nLimit)
){
p->nSelectRow = sqlite3LogEst((u64)nLimit);