Additional comments on the sqlite3ExprIsConstantOrGroupBy() routine. No
code changes.
FossilOrigin-Name: 8424492eac506866d2918e5fe03c8f65fef960215d56012a3b52ed42789ed35a
diff --git a/manifest b/manifest
index 8040d9e..0421bd0 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Remove\san\sunnecessary\sbranch.
-D 2017-05-01T19:53:12.478
+C Additional\scomments\son\sthe\ssqlite3ExprIsConstantOrGroupBy()\sroutine.\s\sNo\ncode\schanges.
+D 2017-05-02T16:46:41.947
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 6a8c838220f7c00820e1fc0ac1bccaaa8e5676067e1dbfa1bafa7a4ffecf8ae6
@@ -355,7 +355,7 @@
F src/date.c cc42a41c7422389860d40419a5e3bce5eaf6e7835c3ba2677751dc653550a5c7
F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
F src/delete.c 0d9d5549d42e79ce4d82ff1db1e6c81e36d2f67c
-F src/expr.c ed8914c001a24ab25aee965f498c96de577bf2c4a6145022b3688c11c2b29c82
+F src/expr.c 965f5e6074ee61cf933be079c6a443c88414490c13ec270b5baaacaa920280fa
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c db65492ae549c3b548c9ef1f279ce1684f1c473b116e1c56a90878cd5dcf968d
F src/func.c 9d52522cc8ae7f5cdadfe14594262f1618bc1f86083c4cd6da861b4cf5af6174
@@ -1578,7 +1578,7 @@
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 4921cd9520080f9baff70e548f64a56e2204b398b8397a2d318a98c32ec4b00c
-R c6e750f01e8b5a0c9293dd8f991b3ffc
+P a33179596f534067a58d68b77160f11ab13272b29f912d7cbe15ea00bbf03ade
+R 23bb18e29d815650d0a53ab5e0119122
U drh
-Z 3a6ca4224cd5b67f49546c5966995b4b
+Z 17cedac15c0a75bf83e81927ffcddf58
diff --git a/manifest.uuid b/manifest.uuid
index 622d624..eeb0aa3 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-a33179596f534067a58d68b77160f11ab13272b29f912d7cbe15ea00bbf03ade
\ No newline at end of file
+8424492eac506866d2918e5fe03c8f65fef960215d56012a3b52ed42789ed35a
\ No newline at end of file
diff --git a/src/expr.c b/src/expr.c
index 73143c5..a79b0b7 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1848,6 +1848,20 @@
** 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;