1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Fix a bug in LIMIT 0 for compound SELECT statement.

The problem was introduced by recent enhancements and has not appeared
in any release.

FossilOrigin-Name: c6ed7e2a73a7a65cfa914ffcad4f603b6b7a22a8
This commit is contained in:
drh
2009-11-20 16:13:15 +00:00
parent 3278315768
commit 456e4e4fba
3 changed files with 12 additions and 13 deletions

View File

@@ -1323,11 +1323,10 @@ static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){
v = sqlite3GetVdbe(pParse);
if( NEVER(v==0) ) return; /* VDBE should have already been allocated */
if( sqlite3ExprIsInteger(p->pLimit, &n) ){
sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);
VdbeComment((v, "LIMIT counter"));
if( n==0 ){
sqlite3VdbeAddOp2(v, OP_Goto, 0, iBreak);
}else{
sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);
VdbeComment((v, "LIMIT counter"));
}
}else{
sqlite3ExprCode(pParse, p->pLimit, iLimit);