Minor improvements to the sqlite3SrcListShiftJoinType() routine. This started

out to be an effort to convert RIGHT JOIN to LEFT JOIN if the join was on
the first pair of relations, but that messes up the "*" expansion and so won't
work.

FossilOrigin-Name: a48902c71ed30c83de7dbd26d1c7956136c35dc53b1076bc8b1ebcba568a3fd3
This commit is contained in:
drh
2022-04-10 20:28:41 +00:00
parent fcde633f7c
commit 62ed36bb5d
3 changed files with 18 additions and 11 deletions
+11 -4
View File
@@ -5067,14 +5067,21 @@ void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, ExprList *pList){
** The operator is "natural cross join". The A and B operands are stored
** in p->a[0] and p->a[1], respectively. The parser initially stores the
** operator with A. This routine shifts that operator over to B.
**
** Additional changes:
**
** * All tables to the left of the right-most RIGHT JOIN are tagged with
** JT_LTORJ (mnemonic: Left Table Of Right Join) so that the
** code generator can easily tell that the table is part of
** the left operand of at least one RIGHT JOIN.
*/
void sqlite3SrcListShiftJoinType(SrcList *p){
if( p ){
int i;
if( p && p->nSrc>1 ){
int i = p->nSrc-1;
u8 allFlags = 0;
for(i=p->nSrc-1; i>0; i--){
do{
allFlags |= p->a[i].fg.jointype = p->a[i-1].fg.jointype;
}
}while( (--i)>0 );
p->a[0].fg.jointype = 0;
/* All terms to the left of a RIGHT JOIN should be tagged with the