/ Check-in [1a074c8a]
Login

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

Overview
Comment:The SQLITE_EXTRA_IFNULLROW compile-time option causes OP_IfNullRow opcodes to be issued for references to the right-hand side table of *any* flattened join, not just LEFT JOINs. This puts extra stress on the OP_IfNUllRow opcodes for testing purposes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.19
Files: files | file ages | folders
SHA3-256:1a074c8a2bc0b28918ef905339d11a21d30101b4ea8c06c8b3faca7d17237538
User & Date: drh 2017-05-25 11:39:50
Context
2017-05-25
16:50
Version 3.19.2 check-in: edb4e819 user: drh tags: release, branch-3.19, version-3.19.2
11:39
The SQLITE_EXTRA_IFNULLROW compile-time option causes OP_IfNullRow opcodes to be issued for references to the right-hand side table of *any* flattened join, not just LEFT JOINs. This puts extra stress on the OP_IfNUllRow opcodes for testing purposes. check-in: 1a074c8a user: drh tags: branch-3.19
00:28
The TK_IF_NULL_ROW expression node must be treated as a variable that references the table Expr.iTable. Proposed fix for ticket [7fde638e94287d2c]. check-in: b30a364a user: drh tags: branch-3.19
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

  3507   3507     */
  3508   3508     if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){
  3509   3509       isLeftJoin = 1;
  3510   3510       if( pSubSrc->nSrc>1 || isAgg ){
  3511   3511         return 0; /* Restriction (3) */
  3512   3512       }
  3513   3513     }
         3514  +#ifdef SQLITE_EXTRA_IFNULLROW
         3515  +  else if( iFrom>0 && !isAgg ){
         3516  +    /* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for
         3517  +    ** every reference to any result column from subquery in a join, even though
         3518  +    ** they are not necessary.  This will stress-test the OP_IfNullRow opcode. */
         3519  +    isLeftJoin = -1;
         3520  +  }
         3521  +#endif
  3514   3522   
  3515   3523     /* Restriction 17: If the sub-query is a compound SELECT, then it must
  3516   3524     ** use only the UNION ALL operator. And none of the simple select queries
  3517   3525     ** that make up the compound SELECT are allowed to be aggregate or distinct
  3518   3526     ** queries.
  3519   3527     */
  3520   3528     if( pSub->pPrior ){
................................................................................
  3760   3768         }
  3761   3769         assert( pParent->pOrderBy==0 );
  3762   3770         assert( pSub->pPrior==0 );
  3763   3771         pParent->pOrderBy = pOrderBy;
  3764   3772         pSub->pOrderBy = 0;
  3765   3773       }
  3766   3774       pWhere = sqlite3ExprDup(db, pSub->pWhere, 0);
  3767         -    if( isLeftJoin ){
         3775  +    if( isLeftJoin>0 ){
  3768   3776         setJoinExpr(pWhere, iNewParent);
  3769   3777       }
  3770   3778       if( subqueryIsAgg ){
  3771   3779         assert( pParent->pHaving==0 );
  3772   3780         pParent->pHaving = pParent->pWhere;
  3773   3781         pParent->pWhere = pWhere;
  3774   3782         pParent->pHaving = sqlite3ExprAnd(db, 

Changes to test/releasetest.tcl.

  1032   1032              && $target!="fuzzoomtest" && !$::BUILDONLY && $::QUICK<2} {
  1033   1033         set debug_idx [lsearch -glob $config_options -DSQLITE_DEBUG*]
  1034   1034         set xtarget $target
  1035   1035         regsub -all {fulltest[a-z]*} $xtarget test xtarget
  1036   1036         regsub -all {fuzzoomtest} $xtarget fuzztest xtarget
  1037   1037         if {$debug_idx < 0} {
  1038   1038           incr NTEST
  1039         -        append config_options " -DSQLITE_DEBUG=1"
         1039  +        append config_options " -DSQLITE_DEBUG=1 -DSQLITE_EXTRA_IFNULLROW=1"
  1040   1040           add_test_suite all "${zConfig}_debug" $xtarget $config_options
  1041   1041         } else {
  1042   1042           incr NTEST
  1043   1043           regsub { *-DSQLITE_MEMDEBUG[^ ]* *} $config_options { } config_options
  1044   1044           regsub { *-DSQLITE_DEBUG[^ ]* *} $config_options { } config_options
  1045   1045           add_test_suite all "${zConfig}_ndebug" $xtarget $config_options
  1046   1046         }