summaryrefslogtreecommitdiffstats
path: root/src/sqlite-1.patch
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2015-08-22 09:09:28 (GMT)
committerMark Brand <mabrand@mabrand.nl>2015-08-22 09:10:30 (GMT)
commitc1318867db03341e68f70f51115d2cf23e96fadf (patch)
tree79120b11d69c50652cfc9109611bd78eeec245ae /src/sqlite-1.patch
parentfc91451e0231b1a6301482a287ecca5aa17abdbd (diff)
downloadmxe-c1318867db03341e68f70f51115d2cf23e96fadf.zip
mxe-c1318867db03341e68f70f51115d2cf23e96fadf.tar.gz
mxe-c1318867db03341e68f70f51115d2cf23e96fadf.tar.bz2
sqlite: backport LEFT JOIN bugfix
Diffstat (limited to 'src/sqlite-1.patch')
-rw-r--r--src/sqlite-1.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/sqlite-1.patch b/src/sqlite-1.patch
new file mode 100644
index 0000000..e8b36de
--- /dev/null
+++ b/src/sqlite-1.patch
@@ -0,0 +1,38 @@
+This file is part of MXE.
+See index.html for further information.
+
+From ea6e95e804cfff4d79cf1bee8275a30611e336b1 Mon Sep 17 00:00:00 2001
+From: Mark Brand <mabrand@mabrand.nl>
+Date: Sat, 22 Aug 2015 10:58:38 +0200
+Subject: [PATCH] backport fix for severe LEFT JOIN bug
+
+Do not apply the WHERE-clause pushdown optimization to terms that
+originate in the ON or USING clause of a LEFT JOIN.
+
+taken from https://www.sqlite.org/src/info/351bc22fa9b5a2e5
+
+diff --git a/sqlite3.c b/sqlite3.c
+index 1344938..a8a1a83 100644
+--- a/sqlite3.c
++++ b/sqlite3.c
+@@ -111380,6 +111380,9 @@ static int flattenSubquery(
+ ** enforces this restriction since this routine does not have enough
+ ** information to know.)
+ **
++** (5) The WHERE clause expression originates in the ON or USING clause
++** of a LEFT JOIN.
++**
+ ** Return 0 if no changes are made and non-zero if one or more WHERE clause
+ ** terms are duplicated into the subquery.
+ */
+@@ -111402,6 +111405,7 @@ static int pushDownWhereTerms(
+ nChng += pushDownWhereTerms(db, pSubq, pWhere->pRight, iCursor);
+ pWhere = pWhere->pLeft;
+ }
++ if( ExprHasProperty(pWhere,EP_FromJoin) ) return 0; /* restriction 5 */
+ if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
+ nChng++;
+ while( pSubq ){
+--
+2.1.4
+