diff options
author | drh <drh@noemail.net> | 2017-05-02 16:46:41 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-05-02 16:46:41 +0000 |
commit | ab314001b80737422a101b6600a0531fb867f38d (patch) | |
tree | ff09e50760454806448d24cc12d9ebfe51c27da3 /src/expr.c | |
parent | c478c8daec5b41ac03aae74972b2c6c8785be5a8 (diff) | |
download | sqlite-ab314001b80737422a101b6600a0531fb867f38d.tar.gz sqlite-ab314001b80737422a101b6600a0531fb867f38d.zip |
Additional comments on the sqlite3ExprIsConstantOrGroupBy() routine. No
code changes.
FossilOrigin-Name: 8424492eac506866d2918e5fe03c8f65fef960215d56012a3b52ed42789ed35a
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c index 73143c51d..a79b0b749 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1848,6 +1848,20 @@ static int exprNodeIsConstantOrGroupBy(Walker *pWalker, Expr *pExpr){ ** Walk the expression tree passed as the first argument. Return non-zero ** if the expression consists entirely of constants or copies of terms ** in pGroupBy that sort with the BINARY collation sequence. +** +** This routine is used to determine if a term of the HAVING clause can +** be promoted into the WHERE clause. In order for such a promotion to work, +** the value of the HAVING clause term must be the same for all members of +** a "group". The requirement that the GROUP BY term must be BINARY +** assumes that no other collating sequence will have a finer-grained +** grouping than binary. In other words (A=B COLLATE binary) implies +** A=B in every other collating sequence. The requirement that the +** GROUP BY be BINARY is stricter than necessary. It would also work +** to promote HAVING clauses that use the same alternative collating +** sequence as the GROUP BY term, but that is much harder to check, +** alternative collating sequences are uncommon, and this is only an +** optimization, so we take the easy way out and simply require the +** GROUP BY to use the BINARY collating sequence. */ int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprList *pGroupBy){ Walker w; |