Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Better error message when DISTINCT is used on an aggregate function that takes two or more arguments. Ticket #3641. (CVS 6269) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e20bf384668bcde7c2f2152ca88e28cf |
User & Date: | drh 2009-02-09 13:19:28.000 |
Context
2009-02-09
| ||
17:34 | Add assert() statements to os_unix.c which fire if there is a read or write for the locking region of a database file. (CVS 6270) (check-in: 93e792ffa8 user: drh tags: trunk) | |
13:19 | Better error message when DISTINCT is used on an aggregate function that takes two or more arguments. Ticket #3641. (CVS 6269) (check-in: e20bf38466 user: drh tags: trunk) | |
05:32 | Ignore the return structure of and F_GETLK fcntl() call on djgpp. Fix for #3642. (CVS 6268) (check-in: 8227af3463 user: danielk1977 tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.499 2009/02/09 13:19:28 drh Exp $ */ #include "sqliteInt.h" /* ** Delete all the content of a Select structure but do not deallocate ** the select structure itself. |
︙ | ︙ | |||
3361 3362 3363 3364 3365 3366 3367 | sqlite3VdbeAddOp2(v, OP_Null, 0, pAggInfo->aCol[i].iMem); } for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){ sqlite3VdbeAddOp2(v, OP_Null, 0, pFunc->iMem); if( pFunc->iDistinct>=0 ){ Expr *pE = pFunc->pExpr; if( pE->pList==0 || pE->pList->nExpr!=1 ){ | | | | 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 | sqlite3VdbeAddOp2(v, OP_Null, 0, pAggInfo->aCol[i].iMem); } for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){ sqlite3VdbeAddOp2(v, OP_Null, 0, pFunc->iMem); if( pFunc->iDistinct>=0 ){ Expr *pE = pFunc->pExpr; if( pE->pList==0 || pE->pList->nExpr!=1 ){ sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one " "argument"); pFunc->iDistinct = -1; }else{ KeyInfo *pKeyInfo = keyInfoFromExprList(pParse, pE->pList); sqlite3VdbeAddOp4(v, OP_OpenEphemeral, pFunc->iDistinct, 0, 0, (char*)pKeyInfo, P4_KEYINFO_HANDOFF); } } |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** 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. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** 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.815 2009/02/09 13:19:28 drh Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" /* ** The following global variable is incremented every time a cursor ** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test |
︙ | ︙ | |||
478 479 480 481 482 483 484 485 486 487 488 489 490 491 | ** but that meant we more testing that we needed. By only testing the ** flag on jump instructions, we get a (small) speed improvement. */ #define CHECK_FOR_INTERRUPT \ if( db->u1.isInterrupted ) goto abort_due_to_interrupt; #ifdef SQLITE_DEBUG static int fileExists(sqlite3 *db, const char *zFile){ int res = 0; int rc = SQLITE_OK; #ifdef SQLITE_TEST /* If we are currently testing IO errors, then do not call OsAccess() to ** test for the presence of zFile. This is because any IO error that ** occurs here will not be reported, causing the test to fail. | > > > | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | ** but that meant we more testing that we needed. By only testing the ** flag on jump instructions, we get a (small) speed improvement. */ #define CHECK_FOR_INTERRUPT \ if( db->u1.isInterrupted ) goto abort_due_to_interrupt; #ifdef SQLITE_DEBUG # define fileExists(A,B) 0 #endif #if 0 static int fileExists(sqlite3 *db, const char *zFile){ int res = 0; int rc = SQLITE_OK; #ifdef SQLITE_TEST /* If we are currently testing IO errors, then do not call OsAccess() to ** test for the presence of zFile. This is because any IO error that ** occurs here will not be reported, causing the test to fail. |
︙ | ︙ |
Changes to test/distinctagg.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2005 September 11 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is the DISTINCT modifier on aggregate functions. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2005 September 11 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this script is the DISTINCT modifier on aggregate functions. # # $Id: distinctagg.test,v 1.3 2009/02/09 13:19:28 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test distinctagg-1.1 { execsql { |
︙ | ︙ | |||
48 49 50 51 52 53 54 | } } {1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3} do_test distinctagg-2.1 { catchsql { SELECT count(distinct) FROM t1; } | | > > > | > > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | } } {1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3} do_test distinctagg-2.1 { catchsql { SELECT count(distinct) FROM t1; } } {1 {DISTINCT aggregates must have exactly one argument}} do_test distinctagg-2.2 { catchsql { SELECT group_concat(distinct a,b) FROM t1; } } {1 {DISTINCT aggregates must have exactly one argument}} finish_test |