/ Check-in [c6ed7e2a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug in LIMIT 0 for compound SELECT statement. The problem was introduced by recent enhancements and has not appeared in any release.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c6ed7e2a73a7a65cfa914ffcad4f603b6b7a22a8
User & Date: drh 2009-11-20 16:13:15
Context
2009-11-20
17:23
Merge leaf accidentally created by [1c4984c62f]. check-in: cae949ce user: dan tags: trunk
16:13
Fix a bug in LIMIT 0 for compound SELECT statement. The problem was introduced by recent enhancements and has not appeared in any release. check-in: c6ed7e2a user: drh tags: trunk
15:02
If the root pages numbers of the internal schema are adjusted due to autovacuum on a DROP TABLE statement and that statement later aborts (for example, due to an OOM error) then reset the internal schema at the conclusion of the statement. Partial fix for ticket [564d412f15a]. check-in: e493b093 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

  1319   1319     sqlite3ExprCacheClear(pParse);
  1320   1320     assert( p->pOffset==0 || p->pLimit!=0 );
  1321   1321     if( p->pLimit ){
  1322   1322       p->iLimit = iLimit = ++pParse->nMem;
  1323   1323       v = sqlite3GetVdbe(pParse);
  1324   1324       if( NEVER(v==0) ) return;  /* VDBE should have already been allocated */
  1325   1325       if( sqlite3ExprIsInteger(p->pLimit, &n) ){
         1326  +      sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);
         1327  +      VdbeComment((v, "LIMIT counter"));
  1326   1328         if( n==0 ){
  1327   1329           sqlite3VdbeAddOp2(v, OP_Goto, 0, iBreak);
  1328         -      }else{
  1329         -        sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);
  1330         -        VdbeComment((v, "LIMIT counter"));
  1331   1330         }
  1332   1331       }else{
  1333   1332         sqlite3ExprCode(pParse, p->pLimit, iLimit);
  1334   1333         sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit);
  1335   1334         VdbeComment((v, "LIMIT counter"));
  1336   1335         sqlite3VdbeAddOp2(v, OP_IfZero, iLimit, iBreak);
  1337   1336       }