/ Check-in [5f80140a]
Login

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

Overview
Comment:The fix in (6111) was not quite right. This version works better. (CVS 6113)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5f80140a2df48fd43a7cbc0990de0205004541b0
User & Date: drh 2009-01-05 22:30:39
Context
2009-01-06
00:08
Fix a problem in the WHERE clause generator when the FROM clause is empty. (CVS 6114) check-in: a7015625 user: drh tags: trunk
2009-01-05
22:30
The fix in (6111) was not quite right. This version works better. (CVS 6113) check-in: 5f80140a user: drh tags: trunk
19:36
Reenable fuzz testing for all.test. Make sure the query flattener copies over aggregate information from expressions on outer query terms while flattening. (CVS 6112) check-in: e02323b3 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
1518
1519
1520
1521
1522
1523
1524
1525
1526



1527
1528
1529
1530
1531
1532
1533
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** 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.809 2009/01/05 18:02:27 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** The following global variable is incremented every time a cursor
................................................................................
** A NULL value is not changed by this routine.  It remains NULL.
*/
case OP_ToBlob: {                  /* same as TK_TO_BLOB, in1 */
  if( pIn1->flags & MEM_Null ) break;
  if( (pIn1->flags & MEM_Blob)==0 ){
    applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding);
    assert( pIn1->flags & MEM_Str || db->mallocFailed );
  }
  MemSetTypeFlag(pIn1, MEM_Blob);



  UPDATE_MAX_BLOBSIZE(pIn1);
  break;
}

/* Opcode: ToNumeric P1 * * * *
**
** Force the value in register P1 to be numeric (either an







|







 







<
|
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
1518
1519
1520
1521
1522
1523
1524

1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** 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.810 2009/01/05 22:30:39 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** The following global variable is incremented every time a cursor
................................................................................
** A NULL value is not changed by this routine.  It remains NULL.
*/
case OP_ToBlob: {                  /* same as TK_TO_BLOB, in1 */
  if( pIn1->flags & MEM_Null ) break;
  if( (pIn1->flags & MEM_Blob)==0 ){
    applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding);
    assert( pIn1->flags & MEM_Str || db->mallocFailed );

    MemSetTypeFlag(pIn1, MEM_Blob);
  }else{
    pIn1->flags &= ~(MEM_TypeMask&~MEM_Blob);
  }
  UPDATE_MAX_BLOBSIZE(pIn1);
  break;
}

/* Opcode: ToNumeric P1 * * * *
**
** Force the value in register P1 to be numeric (either an

Changes to src/vdbemem.c.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
*************************************************************************
**
** This file contains code use to manipulate "Mem" structure.  A "Mem"
** stores a single value in the VDBE.  Mem is an opaque structure visible
** only within the VDBE.  Interface routines refer to a Mem using the
** name sqlite_value
**
** $Id: vdbemem.c,v 1.133 2008/12/10 19:26:24 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
................................................................................

/*
** Delete any previous value and set the value to be a BLOB of length
** n containing all zeros.
*/
void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
  sqlite3VdbeMemRelease(pMem);
  MemSetTypeFlag(pMem, MEM_Blob);
  pMem->flags = MEM_Blob|MEM_Zero;
  pMem->type = SQLITE_BLOB;
  pMem->n = 0;
  if( n<0 ) n = 0;
  pMem->u.nZero = n;
  pMem->enc = SQLITE_UTF8;
}







|







 







<







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
460
461
462
463
464
465
466

467
468
469
470
471
472
473
*************************************************************************
**
** This file contains code use to manipulate "Mem" structure.  A "Mem"
** stores a single value in the VDBE.  Mem is an opaque structure visible
** only within the VDBE.  Interface routines refer to a Mem using the
** name sqlite_value
**
** $Id: vdbemem.c,v 1.134 2009/01/05 22:30:39 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
................................................................................

/*
** Delete any previous value and set the value to be a BLOB of length
** n containing all zeros.
*/
void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
  sqlite3VdbeMemRelease(pMem);

  pMem->flags = MEM_Blob|MEM_Zero;
  pMem->type = SQLITE_BLOB;
  pMem->n = 0;
  if( n<0 ) n = 0;
  pMem->u.nZero = n;
  pMem->enc = SQLITE_UTF8;
}

Changes to test/fuzz.test.

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
...
244
245
246
247
248
249
250

















251
252
253
254
255
256
257
#
# The tests in this file are really about testing fuzzily generated
# SQL parse-trees. The majority of the fuzzily generated SQL is 
# valid as far as the parser is concerned. 
#
# The most complicated trees are for SELECT statements.
#
# $Id: fuzz.test,v 1.15 2009/01/05 19:36:30 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

set ::REPEATS 5000

# If running quick.test, don't do so many iterations.
................................................................................
} {0 {}}
do_test fuzz-1.16.4 {
  execsql {
    DROP TABLE abc; DROP TABLE def; DROP TABLE ghi;
  }
} {}


















#----------------------------------------------------------------
# Test some fuzzily generated expressions.
#
do_fuzzy_test fuzz-2 -template  { SELECT [Expr] }

do_test fuzz-3.1 {
  execsql {







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
...
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#
# The tests in this file are really about testing fuzzily generated
# SQL parse-trees. The majority of the fuzzily generated SQL is 
# valid as far as the parser is concerned. 
#
# The most complicated trees are for SELECT statements.
#
# $Id: fuzz.test,v 1.16 2009/01/05 22:30:39 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

set ::REPEATS 5000

# If running quick.test, don't do so many iterations.
................................................................................
} {0 {}}
do_test fuzz-1.16.4 {
  execsql {
    DROP TABLE abc; DROP TABLE def; DROP TABLE ghi;
  }
} {}

do_test fuzz-1.17 {
  catchsql {
    SELECT 'hardware', 56.1 NOTNULL, random()&0
    FROM (
       SELECT ALL lower(~ EXISTS (
           SELECT 1 NOT IN (SELECT ALL 1)
       )), CAST(456 AS integer), -2147483647
       FROM (
         SELECT DISTINCT -456, CAST(1 AS integer) ISNULL
         FROM (SELECT ALL 2147483647, typeof(2147483649))
       )
    )
    GROUP BY CAST(CAST('experiments' AS blob) AS blob)
    HAVING random()
  }
} {0 {hardware 1 0}}

#----------------------------------------------------------------
# Test some fuzzily generated expressions.
#
do_fuzzy_test fuzz-2 -template  { SELECT [Expr] }

do_test fuzz-3.1 {
  execsql {