Skip to content

Commit

Permalink
chore: cherry-pick f62f983b56623f0e from sqlite.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppontes committed Jan 20, 2021
1 parent 5737bac commit c25400b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion patches/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@

"src/electron/patches/ReactiveObjC": "src/third_party/squirrel.mac/vendor/ReactiveObjC",

"src/electron/patches/depot_tools": "src/third_party/depot_tools"
"src/electron/patches/depot_tools": "src/third_party/depot_tools",

"src/electron/patches/sqlite": "src/third_party/sqlite/src"
}
1 change: 1 addition & 0 deletions patches/sqlite/.patches
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix_a_problem_handling_sub-queries_with_both_a_correlated_where.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Pedro Pontes <pepontes@microsoft.com>
Date: Wed, 20 Jan 2021 23:31:45 +0100
Subject: Fix a problem handling sub-queries with both a correlated WHERE clause and a "HAVING 0" clause where the parent query is itself an aggregate. The problem was apparently introduced by check-in [6e6b3729e0549de0].
SHA3-256: f62f983b56623f0ec34f9a54ce1c21b013a20399162f5ee6ee43b23f10c2ecd5
User & Date: dan on 2020-12-22 16:23:29

diff --git a/src/select.c b/src/select.c
index 8b1fae75a510e0ec8f9fb5c5732ca7426662f801..0bc3792dce6ba1f9db7f5cc65a4c5981f74bbd19 100644
--- a/src/select.c
+++ b/src/select.c
@@ -5585,7 +5585,9 @@ static void explainSimpleCount(
static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){
if( pExpr->op!=TK_AND ){
Select *pS = pWalker->u.pSelect;
- if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){
+ if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy)
+ && ExprAlwaysFalse(pExpr)==0
+ ){
sqlite3 *db = pWalker->pParse->db;
Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1");
if( pNew ){

0 comments on commit c25400b

Please sign in to comment.