diff options
author | drh <drh@noemail.net> | 2015-04-20 01:32:53 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-04-20 01:32:53 +0000 |
commit | 850b0d031d6097e6d8a45a801b1370c61d152293 (patch) | |
tree | 34659df749c80a4ac94edbe4f1a92d122a85f64c /src/resolve.c | |
parent | 10dc553c13ae43064717f173ebd7717c97fbf63b (diff) | |
parent | b496a8f547853a12c02d16cd4cfb100a3ee5ba70 (diff) | |
download | sqlite-850b0d031d6097e6d8a45a801b1370c61d152293.tar.gz sqlite-850b0d031d6097e6d8a45a801b1370c61d152293.zip |
Merge all recent trunk enhancements and fixes into the sessions branch.
FossilOrigin-Name: b8ef1cdee307441e8d97b4bfc21f8547692eea9f
Diffstat (limited to 'src/resolve.c')
-rw-r--r-- | src/resolve.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/resolve.c b/src/resolve.c index 6294ba26e..32e0a98fd 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -460,7 +460,6 @@ static int lookupName( if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){ pExpr->op = TK_STRING; pExpr->pTab = 0; - pExpr->iTable = -1; return WRC_Prune; } @@ -1300,8 +1299,15 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ ** The ORDER BY clause for compounds SELECT statements is handled ** below, after all of the result-sets for all of the elements of ** the compound have been resolved. + ** + ** If there is an ORDER BY clause on a term of a compound-select other + ** than the right-most term, then that is a syntax error. But the error + ** is not detected until much later, and so we need to go ahead and + ** resolve those symbols on the incorrect ORDER BY for consistency. */ - if( !isCompound && resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER") ){ + if( isCompound<=nCompound /* Defer right-most ORDER BY of a compound */ + && resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER") + ){ return WRC_Abort; } if( db->mallocFailed ){ |