1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

More internal documentation improvements.

FossilOrigin-Name: 8b91b74931c36e1955ef933a07d8ec40c8b54c882efe7084d179168867c5244f
This commit is contained in:
drh
2024-09-01 23:56:14 +00:00
parent b9a6e42a55
commit b5df31d15f
3 changed files with 25 additions and 9 deletions

View File

@ -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);
}
}