0
0
mirror of https://github.com/sqlite/sqlite.git synced 2024-12-01 17:23:42 +01:00

Make sure virtual table interfaces are not invoked after EOF when

the virtual table appears in an outer join.  Ticket #2894. (CVS 4761)

FossilOrigin-Name: face510bc14f440fc08dd5a354882ae05499bfa7
This commit is contained in:
drh 2008-01-31 15:53:45 +00:00
parent 7c36d07715
commit 2945b4a1ac
4 changed files with 41 additions and 13 deletions

View File

@ -1,5 +1,5 @@
C Add\s"return\src;"\sto\sthe\send\sof\ssqlite3_test_control().\s(CVS\s4760)
D 2008-01-31T15:31:02
C Make\ssure\svirtual\stable\sinterfaces\sare\snot\sinvoked\safter\sEOF\swhen\nthe\svirtual\stable\sappears\sin\san\souter\sjoin.\s\sTicket\s#2894.\s(CVS\s4761)
D 2008-01-31T15:53:45
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in bc2b5df3e3d0d4b801b824b7ef6dec43812b049b
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -170,7 +170,7 @@ F src/update.c 31edd9c9764e80753930bd5f9b43e0edb404636f
F src/utf.c ef4b7d83bae533b76c3e1bf635b113fdad86a736
F src/util.c c56e41ed4769c1f2b8af9ffde4757a7b4fb08ed1
F src/vacuum.c 3f34f278809bf3eb0b62ec46ff779e9c385b28f0
F src/vdbe.c 299e18e4262ba4104710a7fac21d80b2a14eb666
F src/vdbe.c a21942ef4369df8c1251dd128278c376aea4781d
F src/vdbe.h 58a7d931ffb704e034b2a725981cfa5bd406fad9
F src/vdbeInt.h b7a18349e9b29eca4b642aee6233ac02dd63ad87
F src/vdbeapi.c 93c72ed24d59ed86a634b6d593cdec8376b24513
@ -517,7 +517,7 @@ F test/vacuum2.test d3b9691541fe6ed5c711f547a1c7d70e9760ac6f
F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102
F test/view.test 4864e3841ab3213a95297718b94d5d6a8d3bc78b
F test/vtab1.test bd905d1d43637a700308da6ffcc4e014c27e2f0a
F test/vtab2.test 94bb3bf691ac10e34cf7dad46b1cf94b861d513c
F test/vtab2.test 1da49b015582965a8fc386aa23d051a5a622b08e
F test/vtab3.test f38d6d7d19f08bffdadce4d5b8cba078f8118587
F test/vtab4.test a9d7104d41a787754a734740d7aa61c807a69f87
F test/vtab5.test 26bc7a0a52c5c2bcfa849ba327f8a0d4abccdb23
@ -614,7 +614,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 9b207d1a6690206a6d7a10fcb517579b8bdadca2
R 207291ef309d70bb1999aed272070043
U danielk1977
Z ae0f74993961c2dd5a21d43c2be5a879
P b547e7ea75294997de4298e30af813f36dfa3b05
R e903897809b4e69e604c108cab7fed0d
U drh
Z d25fc7ca7545d6d1f72f5f699e12446b

View File

@ -1 +1 @@
b547e7ea75294997de4298e30af813f36dfa3b05
face510bc14f440fc08dd5a354882ae05499bfa7

View File

@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.705 2008/01/23 03:03:05 drh Exp $
** $Id: vdbe.c,v 1.706 2008/01/31 15:53:45 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@ -4493,6 +4493,9 @@ case OP_VRowid: { /* out2-prerelease */
Cursor *pCur = p->apCsr[pOp->p1];
assert( pCur->pVtabCursor );
if( pCur->nullRow ){
break;
}
pModule = pCur->pVtabCursor->pVtab->pModule;
assert( pModule->xRowid );
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
@ -4518,6 +4521,12 @@ case OP_VColumn: {
Cursor *pCur = p->apCsr[pOp->p1];
assert( pCur->pVtabCursor );
assert( pOp->p3>0 && pOp->p3<=p->nMem );
pDest = &p->aMem[pOp->p3];
if( pCur->nullRow ){
sqlite3VdbeMemSetNull(pDest);
break;
}
pModule = pCur->pVtabCursor->pVtab->pModule;
assert( pModule->xColumn );
memset(&sContext, 0, sizeof(sContext));
@ -4531,8 +4540,6 @@ case OP_VColumn: {
** dynamic allocation in sContext.s (a Mem struct) is released.
*/
sqlite3VdbeChangeEncoding(&sContext.s, encoding);
assert( pOp->p3>0 && pOp->p3<=p->nMem );
pDest = &p->aMem[pOp->p3];
REGISTER_TRACE(pOp->p3, pDest);
sqlite3VdbeMemMove(pDest, &sContext.s);
UPDATE_MAX_BLOBSIZE(pDest);
@ -4560,6 +4567,9 @@ case OP_VNext: { /* jump */
Cursor *pCur = p->apCsr[pOp->p1];
assert( pCur->pVtabCursor );
if( pCur->nullRow ){
break;
}
pModule = pCur->pVtabCursor->pVtab->pModule;
assert( pModule->xNext );

View File

@ -10,7 +10,7 @@
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# $Id: vtab2.test,v 1.7 2007/02/14 09:19:37 danielk1977 Exp $
# $Id: vtab2.test,v 1.8 2008/01/31 15:53:46 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -87,4 +87,22 @@ do_test vtab2-2.3 {
unset result
unset var
# Ticket #2894.
#
# Make sure we do call Column(), and Rowid() methods of
# a virtual table when that table is in a LEFT JOIN.
#
do_test vtab2-3.1 {
execsql {
SELECT * FROM schema WHERE dflt_value IS NULL LIMIT 1
}
} {main schema 0 database {} 0 {} 0}
do_test vtab2-3.2 {
execsql {
SELECT *, b.rowid
FROM schema a LEFT JOIN schema b ON a.dflt_value=b.dflt_value
WHERE a.rowid=1
}
} {main schema 0 database {} 0 {} 0 {} {} {} {} {} {} {} {} {}}
finish_test