I can reproduce this on Linux, with version 3.6.5: sqlite> create table a (b); sqlite> select max(b) as q from a where q = 1;
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1211238720 (LWP 8893)] 0xb7d4c567 in memcpy () from /lib/tls/libc.so.6 (gdb) bt #0 0xb7d4c567 in memcpy () from /lib/tls/libc.so.6 #1 0xb7e9e6c1 in sqlite3StrAccumAppend (p=0x0, z=0x0, N=-1081252571) at sqlite3.c:17101 #2 0xb7e9f069 in sqlite3VXPrintf (pAccum=0xbf8d64f0, useExtended=1, fmt=0xb7eefddc "T", ap=0xbf8d66ac "W\231��8\231\006\b") at sqlite3.c:17011 #3 0xb7e9faf5 in sqlite3VMPrintf (db=0x805b2f0, zFormat=0xb7eefdc6 "misuse of aggregate: %T", ap=0xbf8d66a8 "$\205\006\bW\231��8\231\006\b") at sqlite3.c:17160 #4 0xb7e9fdea in sqlite3ErrorMsg (pParse=0xbf8d7450, zFormat=0xb7eefdc6 "misuse of aggregate: %T") at sqlite3.c:18515 #5 0xb7eca626 in sqlite3ExprCodeTarget (pParse=0xbf8d7450, pExpr=0x8068508, target=5) at sqlite3.c:54797 #6 0xb7ecacb3 in sqlite3ExprCode (pParse=0xbf8d7450, pExpr=0xbf8d6525, target=5) at sqlite3.c:55145 #7 0xb7ecaf37 in codeAlias (pParse=0xbf8d7450, iAlias=1, pExpr=0x8068508, target=4) at sqlite3.c:54539 #8 0xb7eca1f5 in sqlite3ExprCodeTarget (pParse=0xbf8d7450, pExpr=0x8068300, target=4) at sqlite3.c:54650 #9 0xb7eca652 in sqlite3ExprCodeTemp (pParse=0xbf8d7450, pExpr=0x8068300, pReg=0xbf8d6a34) at sqlite3.c:55126 #10 0xb7eca6bc in codeCompareOperands (pParse=0xbf8d7450, pLeft=0xbf8d6525, pRegLeft=0xbf8d6525, pFreeLeft=0xbf8d6a34, pRight=0x8068710, pRegRight=0xbf8d6525, pFreeRight=0xbf8d6a3c) at sqlite3.c:53050 #11 0xb7ecaad2 in sqlite3ExprIfFalse (pParse=0xbf8d7450, pExpr=0x8068778, dest=-5, jumpIfNull=8) at sqlite3.c:55553 #12 0xb7eceb7f in sqlite3WhereBegin (pParse=0xbf8d7450, pTabList=0x8068918, pWhere=0xbf8d6e44, ppOrderBy=0xbf8d71f4, wflags=2 '\002') at sqlite3.c:78615 #13 0xb7ec7611 in sqlite3Select (pParse=0xbf8d7450, p=0x8067fc0, pDest=0xbf8d7370) at sqlite3.c:72840 #14 0xb7ed3eeb in sqlite3Parser (yyp=0x806a5a0, yymajor=1, yyminor={z = 0x6 <Address 0x6 out of bounds>, dyn = 0, n = 3}, pParse=0x6) at sqlite3.c:81055 #15 0xb7ed55c0 in sqlite3RunParser (pParse=0xbf8d7450, zSql=0x8069080 "select max(b) as q from a where q = 1;", pzErrMsg=0xbf8d744c) at sqlite3.c:82554 #16 0xb7ed6640 in sqlite3LockAndPrepare (db=0x805b2f0, zSql=0x8069080 "select max(b) as q from a where q = 1;", nBytes=-1, saveSqlFlag=0, ppStmt=0xbf8d7674, pzTail=0xbf8d7678) at sqlite3.c:68577 #17 0xb7ed70da in sqlite3_exec (db=0x805b2f0, zSql=0x8069080 "select max(b) as q from a where q = 1;", xCallback=0x8049910 <callback>, pArg=0xbf8d7850, pzErrMsg=0xbf8d76dc) at sqlite3.c:65566 #18 0x0804b134 in process_input (p=0xbf8d7850, in=0x0) at shell.c:1735 #19 0x0804d4ab in main (argc=1, argv=0xbf8d8e04) at shell.c:2078 -John On Wed, Nov 26, 2008 at 2:18 PM, Daniel Zingaro <[EMAIL PROTECTED]> wrote: > Hi all, > > The following session crashes SQLite3.exe 3.6.6.2 on Windows XP: > > sqlite> create table a (b); > sqlite> select max(b) as q from a where q = 1; > > SQLite prevents me from directly using max(b) in the 'where' clause, but > I think it gets fooled by the alias. > > Thanks, > Dan > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users