Commit Graph

31 Commits

Author SHA1 Message Date
drh
d5e040b6f0 Add string_agg(X,Y) as an alias for group_concat(X,Y), for compatibility
with SQLServer and PG.

FossilOrigin-Name: b91c19bf2680f60d7826ab5d9e7902e2dc2a55d847bbea565a6489d47f2cc8f1
2023-10-20 20:19:30 +00:00
dan
4784a78d1c Add test cases related to fix [e717e029].
FossilOrigin-Name: 2909f36bfba8f34b818e5d9ecd8c759f05bbe25765089e78bb022de2b77a4f0f
2022-07-26 15:39:32 +00:00
drh
6b6d6c6bd2 TK_IF_NULL_ROW expressions must be accumulated in the same way as TK_COLUMN
expressions in an aggregate query.  Proposed fix for the problem identifyed by
dbsqlfuzz 8e17857db2c5a9294c975123ac807156a6559f13.

FossilOrigin-Name: 40d08807209638aad728be2cedbc904e342e76c8e486c364bd571b55dd2e1e87
2022-07-25 14:05:11 +00:00
dan
2c1b1ddc55 Do not attempt the OP_Count optimization on queries with HAVING clauses.
FossilOrigin-Name: 566b7842ee286ed8620a87b06de65bc173ad0d208df4157292238fcb059cb484
2022-07-01 21:03:19 +00:00
drh
b9294de1e6 Allow a HAVING clause on any aggregate query, even if there is no GROUP BY
clause.  This brings SQLite into closer agreement with PostgreSQL and fixes
the concern raised by 
[forum:/forumpost/1a7fea4651|forum post 1a7fea4651].

FossilOrigin-Name: 9322a7c21f1c22ba00e9b889223e89bc1591db6e561ce05091e905e98c1bf2b3
2022-06-21 13:41:24 +00:00
dan
cd653a3266 Avoid deleting expression nodes in the flattener code, as they may be referenced by AggInfo objects further up the stack.
FossilOrigin-Name: cc1fffdeddf422404170fa163ab80372ae58b444d7012b2c164021b221709b3e
2020-06-13 21:24:40 +00:00
drh
0c76e892d9 Apply the correct affinity transformations when pulling values off of the
sorter index used for GROUP BY.  Ticket [e0c2ad1aa8a9c691]

FossilOrigin-Name: 101f7dea75a203f1f3aa422a607ef701eb0901ba4d5e8d1075cd350454a61956
2020-03-10 11:50:43 +00:00
drh
6bab6f2b4d Disable the optimization where a REAL value with no fractional part
is stored as an INTEGER when the integer uses as much space as the real
value it proposes to stand in for (8 bytes).  This avoids corner cases
of comparing integers against real values that are beyond the resolution
of an IEEE 754 double.  Fix for ticket [6c1d3febc00b22d457c78c2]

FossilOrigin-Name: 9b0915272f4d4052aa31e9297424a7db9a0234b676e8e2a44c3f2dc54236705a
2019-05-09 17:10:30 +00:00
danielk1977
24acd8f939 Use 1<<$x instead of pow(2,$x) in the test suite code. (CVS 4715)
FossilOrigin-Name: 3a289b6d28bcf399845586b15f100d7c3a78b550
2008-01-16 18:20:41 +00:00
danielk1977
01874bfc51 Adjust the test suite to account for recent changes related to #2822. Most changes are related to English language error messages only. (CVS 4622)
FossilOrigin-Name: 2f88b9b3e3c9abc3ae4a5dcef82707dd74f8aace
2007-12-13 07:58:50 +00:00
drh
9245c243b7 Disallow empty GROUP BY clauses. Ticket #2431. (CVS 4099)
FossilOrigin-Name: 9581e7a4a4d74b08ce5380b49862957c804e46bb
2007-06-20 12:18:31 +00:00
drh
945498f3f2 Make sure that integer values are converted to real when pulled from
a REAL table column by GROUP BY.  Ticket #2251.  Also make sure default
values are correctly expanded.  There may be other places in the code
where this issue comes up - we need to look further. (CVS 3659)

FossilOrigin-Name: e11bbf174c5a2fa75e3d1dd450c8b2a18f40e4da
2007-02-24 11:52:52 +00:00
drh
18e87cff0a Allow constant terms in the ORDER BY or GROUP BY clauses. Ticket #1768. (CVS 3173)
FossilOrigin-Name: d83e0230c0c4909cb035e266beffc0967526d9c1
2006-04-11 14:16:21 +00:00
drh
8a51256c0c Create separate affinities for INTEGER and REAL. (CVS 2766)
FossilOrigin-Name: ce06c123d0c5663dbaf263c2e0aaf5d9cdeb2ccd
2005-11-14 22:29:05 +00:00
drh
8df447f0e6 Omit the SQLITE_AFF_INTEGER type affinity. All numeric values are now
of type real, though an integer representation is still sometimes used
internally for efficiency. (CVS 2753)

FossilOrigin-Name: e0d6f61c7de2c03b8fd17ef37cf1a0add36ee618
2005-11-01 15:48:24 +00:00
drh
c2bd913a40 SUM returns NULL when it has no inputs. Ticket #1413. (CVS 2678)
FossilOrigin-Name: 6281859425d39c11d82875301fefafad1f08416d
2005-09-08 20:37:43 +00:00
drh
97571957a1 Aggregates with GROUP BY can sometimes return no result rows. (CVS 2674)
FossilOrigin-Name: 0c3e368d4766685b94a44f2c514e2dea806c297c
2005-09-08 12:57:28 +00:00
drh
3d1d95e625 The SUM() aggregate function returns an integer result if all inputs are
integers.  Any single non-integer input causes the result to be a floating
point value. (CVS 2669)

FossilOrigin-Name: 21adf4bd99e732650a1e8e9a1cc954126983a654
2005-09-08 10:37:01 +00:00
drh
495c09a49a Make the ORDER BY clause return equal elements in the same order they were
seen (a stable sort).  It was returning them in exactly the reverse order. (CVS 2439)

FossilOrigin-Name: e8391491a68018406e30c2a699a4cab9e0de092c
2005-04-01 10:47:40 +00:00
drh
92febd92ad Tcl interface transfers values directly between SQLite and Tcl_Objs, without
at translation to strings. (CVS 1898)

FossilOrigin-Name: e97c331362545ce21117776c7b61d3488668f2bf
2004-08-20 18:34:20 +00:00
danielk1977
ce2663ccc8 Have the vdbe aggregator use a btree table instead of a hash table. (CVS 1569)
FossilOrigin-Name: 8d56118f64dbaf8c8006266fa7026f900a4a16bd
2004-06-11 13:19:21 +00:00
drh
5f3b4ab53c Remove the COPY command. (CVS 1477)
FossilOrigin-Name: 287f86731c71401dbac098e08357367b4f8e5a43
2004-05-27 17:22:54 +00:00
drh
736c22b803 Most sorting problems are fixed. Dead code has been removed. 3 test failures
remain but will be fixed by the new function API once it gets implemented. (CVS 1425)

FossilOrigin-Name: 3b55095e036d68886d007239333bbf90acd15692
2004-05-21 02:14:24 +00:00
drh
88eee38afd Allow double-quoted strings as string constants in the IN operator. As a
side-efffect, allow the GROUP BY clause to refer to columns by their integer
column number.  Ticket #237. (CVS 856)

FossilOrigin-Name: 187d9c405891e543fc706f8ddb41f3966a842214
2003-01-31 17:16:36 +00:00
drh
c66c5a266b Allow an aggregate function in the HAVING clause even if no aggregates appear
in the result set.  Ticket #187. (CVS 793)

FossilOrigin-Name: 33c6fd6b3dc271fa1f2d4500b4f76c736accefce
2002-12-03 02:34:49 +00:00
drh
68d2e5918a Fix for ticket #131: When a SELECT contains a GROUP BY clause it cannot
use an index for sorting.  It has to sort as a separate operation after
the GROUP BY is complete. (CVS 702)

FossilOrigin-Name: 18745c67acdf7ebec378f5538174117970e9f5cc
2002-08-04 00:52:38 +00:00
drh
9208643d2a Constant ORDER BY or GROUP BY expressions are an error. (CVS 352)
FossilOrigin-Name: 035984a5b00b4a1a6505405f40b15c7695283c0a
2002-01-22 14:11:29 +00:00
drh
a2e00042a1 The right-hand side of an AS in a SELECT can be used within expressions of
the WHERE, ORDER BY, GROUP BY, and/or HAVING clauses. (CVS 350)

FossilOrigin-Name: 3684beab0f8a71ebdf453871bbde7a9ab1f65385
2002-01-22 03:13:42 +00:00
drh
b19a2bc603 Disclaimed copyright. Preparing for release 2.0. (CVS 250)
FossilOrigin-Name: 4e926efe2b59adfec4086eb1d2ba830238facb4c
2001-09-16 00:13:26 +00:00
drh
4cfa793437 :-) (CVS 81)
FossilOrigin-Name: 61c381e7e6c85619b7b494417956fc209c5b7b84
2000-06-08 15:10:46 +00:00
drh
da93281e8d :-) (CVS 59)
FossilOrigin-Name: a8fa6719d55b43f8d194aecfcae5af42d17742af
2000-06-06 18:00:15 +00:00