/ Check-in [370ca539]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Reinsert code deleted by (1998) that we thought was unused but was in fact needed. Fix for ticket #966. (CVS 2025)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 370ca539506a431dbe77dcb644215886760f34e9
User & Date: drh 2004-10-19 16:40:59
Context
2004-10-22
16:22
Fix alignment problems in btree and pager and allow page sizes that are not a multiple of 8. (CVS 2026) check-in: 0539c2d2 user: drh tags: trunk
2004-10-19
16:40
Reinsert code deleted by (1998) that we thought was unused but was in fact needed. Fix for ticket #966. (CVS 2025) check-in: 370ca539 user: drh tags: trunk
01:31
Fix a typo in the quickstart document. (CVS 2024) check-in: 55b03c56 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.418 2004/10/06 15:41:17 drh Exp $
           46  +** $Id: vdbe.c,v 1.419 2004/10/19 16:40:59 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  4233   4233   ** of the current aggregate.  Strings are not duplicated so
  4234   4234   ** string values will be ephemeral.
  4235   4235   */
  4236   4236   case OP_AggGet: {
  4237   4237     AggElem *pFocus;
  4238   4238     int i = pOp->p2;
  4239   4239     pFocus = p->agg.pCurrent;
  4240         -  if( pFocus==0 ) goto no_mem;
         4240  +  if( pFocus==0 ){
         4241  +    int res;
         4242  +    if( sqlite3_malloc_failed ) goto no_mem;
         4243  +    rc = sqlite3BtreeFirst(p->agg.pCsr, &res);
         4244  +    if( rc!=SQLITE_OK ){
         4245  +      return rc;
         4246  +    }
         4247  +    if( res!=0 ){
         4248  +      rc = AggInsert(&p->agg,"",1);
         4249  +      pFocus = p->agg.pCurrent;
         4250  +    }else{
         4251  +      rc = sqlite3BtreeData(p->agg.pCsr, 0, 4, (char *)&pFocus);
         4252  +    }
         4253  +  }
  4241   4254     assert( i>=0 && i<p->agg.nMem );
  4242   4255     pTos++;
  4243   4256     sqlite3VdbeMemShallowCopy(pTos, &pFocus->aMem[i], MEM_Ephem);
  4244   4257     if( pTos->flags&MEM_Str ){
  4245   4258       sqlite3VdbeChangeEncoding(pTos, db->enc);
  4246   4259     }
  4247   4260     break;

Changes to test/misc4.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests for miscellanous features that were
    14     14   # left out of other test files.
    15     15   #
    16         -# $Id: misc4.test,v 1.6 2004/07/24 17:38:30 drh Exp $
           16  +# $Id: misc4.test,v 1.7 2004/10/19 16:40:59 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # Prepare a statement that will create a temporary table.  Then do
    22     22   # a rollback.  Then try to execute the prepared statement.
    23     23   #
................................................................................
    78     78   } SQLITE_OK
    79     79   do_test misc4-2.4 {
    80     80     catchsql {
    81     81       INSERT INTO t3 VALUES(1);
    82     82     }
    83     83   } {0 {}}
    84     84   
           85  +# Ticket #966
           86  +#
           87  +do_test misc4-3.1 {
           88  +  execsql { 
           89  +    CREATE TABLE Table1(ID integer primary key, Value TEXT);
           90  +    INSERT INTO Table1 VALUES(1, 'x');
           91  +    CREATE TABLE Table2(ID integer NOT NULL, Value TEXT);
           92  +    INSERT INTO Table2 VALUES(1, 'z');
           93  +    INSERT INTO Table2 VALUES (1, 'a');
           94  +    SELECT ID, Value FROM Table1
           95  +       UNION SELECT ID, max(Value) FROM Table2 GROUP BY 1,2
           96  +    ORDER BY 1, 2;
           97  +  }
           98  +} {{} {} 1 x 1 z}
           99  +
    85    100   
    86    101   finish_test