Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Allow GROUP BY on aggregate queries only. Ticket #1039. (CVS 2176) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
8ef2c644ebce851d7a3e0db3b2266fc2 |
User & Date: | drh 2005-01-03 02:26:55 |
Context
2005-01-03
| ||
18:13 | add comment that table is accessed by primary key (CVS 2177) check-in: 707690c5 user: tpoindex tags: trunk | |
02:26 | Allow GROUP BY on aggregate queries only. Ticket #1039. (CVS 2176) check-in: 8ef2c644 user: drh tags: trunk | |
01:33 | Fix typos in comments in test code. (Oops. This check-in also picked up some unrelated changes to documentation.) (CVS 2175) check-in: 586acc85 user: drh tags: trunk | |
Changes
Changes to src/select.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
|
** 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.219 2004/12/25 01:03:14 drh Exp $ */ #include "sqliteInt.h" /* ** Allocate a new Select structure and return a pointer to that ** structure. ................................................................................ if( pGroupBy==0 ){ sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING"); goto select_end; } if( sqlite3ExprResolveAndCheck(pParse, pTabList, pEList,pHaving,1,&isAgg) ){ goto select_end; } } if( processOrderGroupBy(pParse, pOrderBy, pTabList, pEList, isAgg, "ORDER") || processOrderGroupBy(pParse, pGroupBy, pTabList, pEList, isAgg, "GROUP") ){ goto select_end; } |
|
>
>
>
>
|
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
|
** 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.220 2005/01/03 02:26:55 drh Exp $ */ #include "sqliteInt.h" /* ** Allocate a new Select structure and return a pointer to that ** structure. ................................................................................ if( pGroupBy==0 ){ sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING"); goto select_end; } if( sqlite3ExprResolveAndCheck(pParse, pTabList, pEList,pHaving,1,&isAgg) ){ goto select_end; } } if( pGroupBy && !isAgg ){ sqlite3ErrorMsg(pParse, "GROUP BY may only be used on aggregate queries"); goto select_end; } if( processOrderGroupBy(pParse, pOrderBy, pTabList, pEList, isAgg, "ORDER") || processOrderGroupBy(pParse, pGroupBy, pTabList, pEList, isAgg, "GROUP") ){ goto select_end; } |
Changes to test/collate3.test.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# 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 page cache subsystem. # # $Id: collate3.test,v 1.6 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # # Tests are organised as follows: # ................................................................................ } } {1 {no such collation sequence: string_compare}} do_test collate3-2.6 { catchsql { SELECT * FROM collate3t1; } } {0 {}} do_test collate3-2.7 { catchsql { SELECT * FROM collate3t1 GROUP BY c1; } } {1 {no such collation sequence: string_compare}} do_test collate3-2.8 { catchsql { SELECT DISTINCT c1 FROM collate3t1; } } {1 {no such collation sequence: string_compare}} ifcapable compound { |
|
|
>
>
>
>
>
|
|
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# 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 page cache subsystem. # # $Id: collate3.test,v 1.7 2005/01/03 02:26:55 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # # Tests are organised as follows: # ................................................................................ } } {1 {no such collation sequence: string_compare}} do_test collate3-2.6 { catchsql { SELECT * FROM collate3t1; } } {0 {}} do_test collate3-2.7.1 { catchsql { SELECT count(*) FROM collate3t1 GROUP BY c1; } } {1 {no such collation sequence: string_compare}} do_test collate3-2.7.2 { catchsql { SELECT * FROM collate3t1 GROUP BY c1; } } {1 {GROUP BY may only be used on aggregate queries}} do_test collate3-2.8 { catchsql { SELECT DISTINCT c1 FROM collate3t1; } } {1 {no such collation sequence: string_compare}} ifcapable compound { |
Changes to test/select7.test.
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
48
49
50
51
52
53
54
55
56
|
# May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing compute SELECT statements and nested # views. # # $Id: select7.test,v 1.3 2004/11/22 13:35:42 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable compound { ................................................................................ SELECT * FROM tv2; } } {1 1} } ;# ifcapable view } ;# ifcapable compound finish_test |
|
>
|
>
>
>
>
>
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing compute SELECT statements and nested # views. # # $Id: select7.test,v 1.4 2005/01/03 02:26:55 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable compound { ................................................................................ SELECT * FROM tv2; } } {1 1} } ;# ifcapable view } ;# ifcapable compound # Do not allow GROUP BY without an aggregate. Ticket #1039. # do_test select7-3.1 { catchsql { SELECT * FROM (SELECT * FROM sqlite_master) GROUP BY name } } {1 {GROUP BY may only be used on aggregate queries}} finish_test |