SQLite

Changes On Branch rightjoin-agg-idxexpr
Login

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

Changes In Branch rightjoin-agg-idxexpr Excluding Merge-Ins

This is equivalent to a diff from c104e5c6 to 4d05a009

2023-03-25
23:52
When the left table of a RIGHT JOIN is used inside an aggregate function and the left table employs an index on expressions, then make sure the expressions evaluate to NULL for the cases where the left table should be NULL. Fix for forum post 9b491e1deb. (check-in: ffe23af7 user: drh tags: trunk)
23:40
Add usage detection to the NULL value generator for the left table of a RIGHT JOIN inside of an aggregate. (Closed-Leaf check-in: 4d05a009 user: drh tags: rightjoin-agg-idxexpr)
22:37
When reading sqlite_stat4 data during query planning, be sure to expand zeroblobs prior to running comparisons. Fix for the issue identified by forum post 5275207102. (check-in: 5c8dd8df user: drh tags: trunk)
21:01
When the left table of a RIGHT JOIN is used inside an aggregate function and the left table employs an index on expressions, then make sure the expressions evaluate to NULL for the cases where the left table should be NULL. Proposed fix for forum post 9b491e1deb. More testing an analysis needed - there is a FIXME in this check-in. (check-in: 3572b40a user: drh tags: rightjoin-agg-idxexpr)
19:46
In the byte-code generator, when the result of an expression needs to be in a particular register, always use the sqlite3ExprCode() routine because it has the smarts to know whether to use OP_Copy or OP_SCopy. Do not try to OP_SCopy inline because an OP_Copy might be required. (check-in: 2d439ccc user: drh tags: branch-3.41)
19:44
In the byte-code generator, when the result of an expression needs to be in a particular register, always use the sqlite3ExprCode() routine because it has the smarts to know whether to use OP_Copy or OP_SCopy. Do not try to OP_SCopy inline because an OP_Copy might be required. Fix for the problem identified by forum post 5522082cfc. (check-in: c104e5c6 user: drh tags: trunk)
18:41
Add the tag-20230325-1 comment that was omitted from the prior check-in. (check-in: a13c01d0 user: drh tags: trunk)

Changes to src/expr.c.

4218
4219
4220
4221
4222
4223
4224
4225












4226
4227
4228
4229
4230
4231
4232
    op = pExpr->op;
  }
  switch( op ){
    case TK_AGG_COLUMN: {
      AggInfo *pAggInfo = pExpr->pAggInfo;
      struct AggInfo_col *pCol;
      assert( pAggInfo!=0 );
      assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );












      pCol = &pAggInfo->aCol[pExpr->iAgg];
      if( !pAggInfo->directMode ){
        return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
      }else if( pAggInfo->useSortingIdx ){
        Table *pTab = pCol->pTab;
        sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
                              pCol->iSorterColumn, target);







|
>
>
>
>
>
>
>
>
>
>
>
>







4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
    op = pExpr->op;
  }
  switch( op ){
    case TK_AGG_COLUMN: {
      AggInfo *pAggInfo = pExpr->pAggInfo;
      struct AggInfo_col *pCol;
      assert( pAggInfo!=0 );
      assert( pExpr->iAgg>=0 );
      if( pExpr->iAgg>=pAggInfo->nColumn ){
        /* Happens when the left table of a RIGHT JOIN is null and
        ** is using an expression index */
        sqlite3VdbeAddOp2(v, OP_Null, 0, target);
#ifdef SQLITE_VDBE_COVERAGE
        /* Verify that the OP_Null above is exercised by tests
        ** tag-20230325-2 */
        sqlite3VdbeAddOp2(v, OP_NotNull, target, 1);
        VdbeCoverageNeverTaken(v);
#endif
        break;
      }
      pCol = &pAggInfo->aCol[pExpr->iAgg];
      if( !pAggInfo->directMode ){
        return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
      }else if( pAggInfo->useSortingIdx ){
        Table *pTab = pCol->pTab;
        sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab,
                              pCol->iSorterColumn, target);