aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-08-31 14:31:17 +0000
committerdrh <>2024-08-31 14:31:17 +0000
commit90fa4c7b2c7653cb64a4662bc98ea73d12143b43 (patch)
tree6c24df8d0811e2b959ae089db4a09108a6c64dbf /src
parent3196c349d12c7b29917a0fec7a6a9175519a972b (diff)
downloadsqlite-90fa4c7b2c7653cb64a4662bc98ea73d12143b43.tar.gz
sqlite-90fa4c7b2c7653cb64a4662bc98ea73d12143b43.zip
Enhance the percentile() and median() extension functions so that they can be
window functions. FossilOrigin-Name: 4d0e3df4b9c609755977b8a462126242d2be1310c0122a8d4ba76d98d32a7230
Diffstat (limited to 'src')
-rw-r--r--src/func.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/func.c b/src/func.c
index 8fcda11dc..a634a7fbe 100644
--- a/src/func.c
+++ b/src/func.c
@@ -2049,7 +2049,11 @@ static void minMaxFinalize(sqlite3_context *context){
** group_concat(EXPR, ?SEPARATOR?)
** string_agg(EXPR, SEPARATOR)
**
-** The SEPARATOR goes before the EXPR string. This is tragic. The
+** Content is accumulated in GroupConcatCtx.str with the SEPARATOR
+** coming before the EXPR value, except for the first entry which
+** omits the SEPARATOR.
+**
+** It is tragic that the SEPARATOR goes before the EXPR string. The
** groupConcatInverse() implementation would have been easier if the
** SEPARATOR were appended after EXPR. And the order is undocumented,
** so we could change it, in theory. But the old behavior has been
@@ -2153,7 +2157,7 @@ static void groupConcatInverse(
/* pGCC is always non-NULL since groupConcatStep() will have always
** run first to initialize it */
if( ALWAYS(pGCC) ){
- int nVS;
+ int nVS; /* Number of characters to remove */
/* Must call sqlite3_value_text() to convert the argument into text prior
** to invoking sqlite3_value_bytes(), in case the text encoding is UTF16 */
(void)sqlite3_value_text(argv[0]);