Do not use transitive WHERE-clause constraints on LEFT JOINs (#1034714)

This commit is contained in:
Debarshi Ray 2013-11-26 16:51:45 +01:00
parent f75c937c9d
commit 6ac28fc9c6
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From c098d918e1e19088be9659c409f1a6fa32b0efe6 Mon Sep 17 00:00:00 2001
From: "D. Richard Hipp" <drh@hwaci.com>
Date: Mon, 28 Oct 2013 20:15:56 +0000
Subject: [PATCH] Do not use transitive WHERE-clause constraints on LEFT JOINs.
Fix for ticket [c620261b5b5dc].
---
src/where.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/where.c b/src/where.c
index 266dc92..4868a7a 100644
--- a/src/where.c
+++ b/src/where.c
@@ -878,7 +878,10 @@ static WhereTerm *whereScanNext(WhereScan *pScan){
iColumn = pScan->aEquiv[pScan->iEquiv-1];
while( (pWC = pScan->pWC)!=0 ){
for(pTerm=pWC->a+k; k<pWC->nTerm; k++, pTerm++){
- if( pTerm->leftCursor==iCur && pTerm->u.leftColumn==iColumn ){
+ if( pTerm->leftCursor==iCur
+ && pTerm->u.leftColumn==iColumn
+ && (pScan->iEquiv<=2 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin))
+ ){
if( (pTerm->eOperator & WO_EQUIV)!=0
&& pScan->nEquiv<ArraySize(pScan->aEquiv)
){
--
1.8.4.2

View File

@ -10,7 +10,7 @@
Summary: Library that implements an embeddable SQL database engine
Name: sqlite
Version: %{rpmver}
Release: 1%{?dist}
Release: 2%{?dist}
License: Public Domain
Group: Applications/Databases
URL: http://www.sqlite.org/
@ -32,6 +32,8 @@ Patch4: sqlite-3.7.15-no-malloc-usable-size.patch
Patch5: sqlite-3.7.16-man-missing-options.patch
# Temporary workaround for failed percentile test, see patch for details
Patch6: sqlite-3.8.0-percentile-test.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1034714
Patch7: 0001-Do-not-use-transitive-WHERE-clause-constraints-on-LE.patch
BuildRequires: ncurses-devel readline-devel glibc-devel
BuildRequires: autoconf
@ -107,6 +109,7 @@ This package contains the tcl modules for %{name}.
%patch4 -p1 -b .no-malloc-usable-size
%patch5 -p1 -b .man-missing-options
%patch6 -p1 -b .nonprecise-percentile-test
%patch7 -p1 -b .transitive-where-clause-constraints
# Remove cgi-script erroneously included in sqlite-doc-3070500
rm -f %{name}-doc-%{realver}/search
@ -197,6 +200,9 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Tue Nov 26 2013 Debarshi Ray <rishi@fedoraproject.org> - 3.8.1-2
- Do not use transitive WHERE-clause constraints on LEFT JOINs (#1034714)
* Tue Oct 22 2013 Jan Stanek <jstanek@redhat.com> - 3.8.1-1
- Update to 3.8.1 (http://www.sqlite.org/releaselog/3_8_1.html)