aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2022-05-13 16:38:40 +0000
committerdrh <>2022-05-13 16:38:40 +0000
commita6e8ee12e2bbb353ae4548e38083d1855f7b86aa (patch)
tree2deb2ba455110c582a814ae4065d3bdb17aa123b /src
parentf8d2745f99fdde443cbc8c828c231f536c17884b (diff)
downloadsqlite-a6e8ee12e2bbb353ae4548e38083d1855f7b86aa.tar.gz
sqlite-a6e8ee12e2bbb353ae4548e38083d1855f7b86aa.zip
Redefine the acccess rules for the Expr.w union so that the Expr.w.iJoin
member is accessible on either EP_OuterON or EP_InnerON. FossilOrigin-Name: 6f741d6cfb8831a3ac966257ac4519bcc8156293447bf50323c2d9b170125974
Diffstat (limited to 'src')
-rw-r--r--src/expr.c1
-rw-r--r--src/printf.c4
-rw-r--r--src/sqliteInt.h2
-rw-r--r--src/treeview.c4
-rw-r--r--src/whereexpr.c4
5 files changed, 9 insertions, 6 deletions
diff --git a/src/expr.c b/src/expr.c
index 2965457d9..64c065168 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1069,6 +1069,7 @@ Expr *sqlite3ExprFunction(
sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */
return 0;
}
+ assert( !ExprHasProperty(pNew, EP_InnerON|EP_OuterON) );
pNew->w.iOfst = (int)(pToken->z - pParse->zTail);
if( pList
&& pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG]
diff --git a/src/printf.c b/src/printf.c
index 41ce4ac7a..f0bfa5327 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -954,7 +954,9 @@ void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){
** as the error offset.
*/
void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){
- while( pExpr && (ExprHasProperty(pExpr,EP_OuterON) || pExpr->w.iOfst<=0) ){
+ while( pExpr
+ && (ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) || pExpr->w.iOfst<=0)
+ ){
pExpr = pExpr->pLeft;
}
if( pExpr==0 ) return;
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index ff11d12a2..22f38ae91 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2847,7 +2847,7 @@ struct Expr {
** TK_SELECT_COLUMN: column of the result vector */
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
union {
- int iJoin; /* If EP_OuterON, the right table of the join */
+ int iJoin; /* If EP_OuterON or EP_InnerON, the right table */
int iOfst; /* else: start of token from start of statement */
} w;
AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
diff --git a/src/treeview.c b/src/treeview.c
index 4e9ff3eb2..90408b0a5 100644
--- a/src/treeview.c
+++ b/src/treeview.c
@@ -490,10 +490,10 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
sqlite3_str_appendf(&x, " fg.af=%x.%c",
pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
if( ExprHasProperty(pExpr, EP_OuterON) ){
- sqlite3_str_appendf(&x, " iJoin=%d", pExpr->w.iJoin);
+ sqlite3_str_appendf(&x, " outer.iJoin=%d", pExpr->w.iJoin);
}
if( ExprHasProperty(pExpr, EP_InnerON) ){
- sqlite3_str_appendf(&x, " inner-ON");
+ sqlite3_str_appendf(&x, " inner.iJoin=%d", pExpr->w.iJoin);
}
if( ExprHasProperty(pExpr, EP_FromDDL) ){
sqlite3_str_appendf(&x, " DDL");
diff --git a/src/whereexpr.c b/src/whereexpr.c
index 8559bd57d..22dd730ef 100644
--- a/src/whereexpr.c
+++ b/src/whereexpr.c
@@ -461,8 +461,8 @@ static int isAuxiliaryVtabOperator(
** a join, then transfer the appropriate markings over to derived.
*/
static void transferJoinMarkings(Expr *pDerived, Expr *pBase){
- if( pDerived ){
- pDerived->flags |= pBase->flags & EP_OuterON;
+ if( pDerived && ExprHasProperty(pBase, EP_OuterON|EP_InnerON) ){
+ pDerived->flags |= pBase->flags & (EP_OuterON|EP_InnerON);
pDerived->w.iJoin = pBase->w.iJoin;
}
}