1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Clarify comments that describe query flattener restrictions associated with

outer joins.  No code changes.

FossilOrigin-Name: 2647d73bb1876d01851f52cb3fd6af08a962ab336b6d51c160d27b1baf94f75f
This commit is contained in:
drh
2022-09-19 19:25:15 +00:00
parent 316cd40122
commit b22b493338
3 changed files with 13 additions and 16 deletions

View File

@@ -4181,9 +4181,8 @@ static void renumberCursors(
** See also (3) for restrictions on LEFT JOIN.
**
** (27) The subquery may not contain a FULL or RIGHT JOIN unless it
** is the first element of the parent query. This must be the
** the case if:
** (27a) the subquery is not compound query, and
** is the first element of the parent query. Two subcases:
** (27a) the subquery is not a compound query.
** (27b) the subquery is a compound query and the RIGHT JOIN occurs
** in any arm of the compound query. (See also (17g).)
**
@@ -4317,8 +4316,10 @@ static int flattenSubquery(
/* Restriction (29):
**
** We do not want two constraints on the same term of the flattened
** query where one constraint has EP_InnerON and the other is EP_OuterON.
** We do not want two constraints on the same FROM-clause term of the
** flattened query where one constraint has the EP_InnerON flag and the
** other has the EP_OuterON flag.
**
** To prevent this, one or the other of the following conditions must be
** false:
**
@@ -4327,10 +4328,6 @@ static int flattenSubquery(
**
** (29b) The subquery itself must not be the right operand of a
** NATURAL join or a join that has an ON or USING clause.
**
** These conditions are sufficient to keep an EP_OuterON from being
** flattened into an EP_InnerON. Restrictions (3a) and (27a) prevent
** an EP_InnerON from being flattened into an EP_OuterON.
*/
if( pSubSrc->nSrc>=2
&& (pSubSrc->a[pSubSrc->nSrc-1].fg.jointype & JT_OUTER)!=0