aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-09-01 23:56:14 +0000
committerdrh <>2024-09-01 23:56:14 +0000
commitb5df31d15f085ff0b22f61b1a3cc730c49c19d8b (patch)
treedd36d8b192e0ec34865c30ba085bc3010c9b1ab7 /src
parentb9a6e42a5513e12f633f9f1d895c3f575c056544 (diff)
downloadsqlite-b5df31d15f085ff0b22f61b1a3cc730c49c19d8b.tar.gz
sqlite-b5df31d15f085ff0b22f61b1a3cc730c49c19d8b.zip
More internal documentation improvements.
FossilOrigin-Name: 8b91b74931c36e1955ef933a07d8ec40c8b54c882efe7084d179168867c5244f
Diffstat (limited to 'src')
-rw-r--r--src/parse.y20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/parse.y b/src/parse.y
index 72c1b66cf..138a41d30 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -1184,7 +1184,23 @@ expr(A) ::= idj(X) LP STAR RP. {
%ifdef SQLITE_ENABLE_ORDERED_SET_FUNCS
%include {
- /* Generate an expression node that represents an ordered-set aggregate function */
+ /* Generate an expression node that represents an ordered-set aggregate function.
+ **
+ ** SQLite does not do anything special to evaluate ordered-set aggregates. The
+ ** aggregate function itself is expected to do any required ordering on its own.
+ ** This is just syntactic sugar.
+ **
+ ** This syntax: percentile(f) WITHIN GROUP ( ORDER BY y )
+ **
+ ** Is equivalent to: percentile(y,f)
+ **
+ ** The purpose of this function is to generate an Expr node from the first syntax
+ ** into a TK_FUNCTION node that looks like it came from the second syntax.
+ **
+ ** Only functions that have the SQLITE_SELFORDER1 perperty are allowed to do this
+ ** transformation. Because DISTINCT is not allowed in the ordered-set aggregate
+ ** syntax, an error is raised if DISTINCT is used.
+ */
static Expr *sqlite3ExprAddOrderedsetFunction(
Parse *pParse, /* Parsing context */
Token *pFuncname, /* Name of the function */
@@ -1213,7 +1229,7 @@ expr(A) ::= idj(X) LP STAR RP. {
if( pDef==0 || (pDef->funcFlags & SQLITE_SELFORDER1)==0 ){
sqlite3ErrorMsg(pParse, "%#T() is not an ordered-set aggregate", pExpr);
}else if( isDistinct==SF_Distinct ){
- sqlite3ErrorMsg(pParse, "DISTINCT not allows on ordered-set aggregate %T()",
+ sqlite3ErrorMsg(pParse, "DISTINCT not allowed on ordered-set aggregate %T()",
pFuncname);
}
}