Home | History | Annotate | Download | only in orig

Lines Matching full:subquery

5168 ** subquery and is not a column value, then all of these functions return
5202 ** expression or subquery) then the declared type of the table
5204 ** expression or subquery, then a NULL pointer is returned.
9434 ** subquery the loop is part of. The main query has a select-id of zero.
16214 ** If the expression is a subquery then Expr.iColumn holds an integer
16215 ** register number containing the result of the subquery. If the
16216 ** subquery gives a constant result, then iTable is -1. If the subquery
16218 ** then iTable is the address of a subroutine that computes the subquery.
16440 ** Each table or subquery in the FROM clause is a separate element of
16467 int addrFillSub; /* Address of subroutine to manifest a subquery */
16555 ** Each subquery gets a new NameContext. The pNext field points to the
16585 #define NC_VarSelect 0x0040 /* A correlated subquery has been seen */
16587 #define NC_Complex 0x2000 /* True if a function or subquery seen */
16657 #define SF_ComplexResult 0x40000 /* Result set contains subquery or function */
91091 ** callback on p, but do invoke it on each FROM clause subquery
91176 ** outer query into an inner subquery.
91208 ** The nSubquery parameter specifies how many levels of subquery the
91210 ** zero but it might be more if the alias is contained within a subquery
91341 int nSubquery = 0; /* How many levels of subquery */
92327 ** already expanded this SELECT. However, if this is a subquery within
94234 ** expression list pList. In the case of a subquery on the RHS, append
94624 ** subquery of some kind. Return 0 if there are no subqueries.
94775 if( !ExprHasProperty(pX, EP_xIsSelect) ) return 0; /* Not a subquery */
94790 if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */
94801 assert( pRes->iTable==pSrc->a[0].iCursor ); /* Not a correlated subquery */
94828 ** The argument is an IN operator with a list (not a subquery) on the
94846 ** might be either a list of expressions or a subquery.
94866 ** subquery such as:
94870 ** If the RHS of the IN operator is a list or a more complex subquery, then
94893 ** if the RHS of the IN operator is a list (not a subquery) then this
95094 ** and the RHS of the IN operator is a list, not a subquery
95207 ** Generate code for scalar subqueries used as a subquery expression, EXISTS,
95210 ** (SELECT a FROM b) -- subquery
95211 ** EXISTS (SELECT a FROM b) -- EXISTS subquery
95213 ** x IN (SELECT a FROM b) -- IN operator with subquery on the right
95216 ** operator or subquery.
95251 ** * The right-hand side is a correlated subquery
95264 char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
95440 VdbeComment((v, "Init subquery result"));
95507 ** subquery. If the RHS is a subquery, the number of result columns must
101500 /* An attempt to read a column out of a subquery or other
105450 ** alias token. If the term is a subquery, then pSubquery is the
105451 ** SELECT statement that the subquery encodes. The pTable and
105464 Select *pSubquery, /* A subquery used in place of a table name */
112833 return 0; /* FROM clause cannot contain a subquery */
119868 int iSub1, /* Subquery id 1 */
119869 int iSub2, /* Subquery id 2 */
120076 ** database table or a subquery.
121845 ** This routine is part of the flattening procedure. A subquery
121850 ** of the subquery rather the result set of the subquery.
121956 ** subquery first and store the results in a temporary table, then
121975 ** The subquery and the outer query cannot both be aggregates.
121978 ** (2) If the subquery is an aggregate then
121981 ** other than the one FROM-clause subquery that is a candidate
121985 ** (3) If the subquery is the right operand of a LEFT JOIN then
121986 ** (3a) the subquery may not be a join and
121987 ** (3b) the FROM clause of the subquery may not contain a virtual
121991 ** (4) The subquery can not be DISTINCT.
121998 ** If the subquery is aggregate, the outer query may not be DISTINCT.
122000 ** (7) The subquery must have a FROM clause. TODO: For subqueries without
122005 ** (8) If the subquery uses LIMIT then the outer query may not be a join.
122007 ** (9) If the subquery uses LIMIT then the outer query may not be aggregate.
122011 ** constraint: "If the subquery is aggregate then the outer query
122014 ** (11) The subquery and the outer query may not both have ORDER BY clauses.
122019 ** (13) The subquery and outer query may not both use LIMIT.
122021 ** (14) The subquery may not use OFFSET.
122024 ** subquery may not use LIMIT.
122027 ** (16) If the outer query is aggregate, then the subquery may not
122031 ** (17) If the subquery is a compound select, then
122033 ** (17b) no terms within the subquery compound may be aggregate
122035 ** (17c) every term within the subquery compound must have a FROM clause
122043 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
122058 ** (19) If the subquery uses LIMIT then the outer query may not
122067 ** (21) If the subquery uses LIMIT then the outer query may not be
122070 ** (22) The subquery may not be a recursive CTE.
122079 ** The subquery may not be an aggregate that uses the built-in min() or
122086 ** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
122093 ** the subquery before this routine runs.
122098 int iFrom, /* Index in p->pSrc->a[] of the inner subquery */
122103 Select *pSub; /* The inner query or "subquery" */
122106 SrcList *pSubSrc; /* The FROM clause of the subquery */
122112 struct SrcList_item *pSubitem; /* The subquery */
122157 ** If the subquery is the right operand of a LEFT JOIN, then the
122158 ** subquery may not be a join itself (3a). Example of why this is not
122169 ** If the subquery is the right operand of a LEFT JOIN, then the outer
122186 ** every reference to any result column from subquery in a join, even
122230 ** subquery is for the subquery to be one term of a join. But if the
122231 ** subquery is a join, then the flattening has already been stopped by
122240 /* Authorize the subquery */
122277 ** We call this the "compound-subquery flattening".
122302 ("compound-subquery flattener creates %s.%p as peer\n",
122314 ** subquery
122325 ** subquery until code generation is
122327 ** refer to the subquery even after flattening. Ticket #3346.
122343 /* The following loop runs once for each term in a compound-subquery
122345 ** of flattening - a flattening other than a compound-subquery flattening -
122348 ** This loop moves all of the FROM elements of the subquery into the
122353 ** those references with expressions that resolve to the subquery FROM
122359 pSubSrc = pSub->pSrc; /* FROM clause of subquery */
122360 nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */
122375 /* The subquery uses a single slot of the FROM clause of the outer
122376 ** query. If the subquery has more than one element in its FROM clause,
122378 ** of the subquery.
122385 ** outer query (the middle slot) is used by the subquery. The next
122388 ** for the two elements in the FROM clause of the subquery.
122397 /* Transfer the FROM clause terms from the subquery into the
122409 /* Now begin substituting subquery result set expressions for
122415 ** \ \_____________ subquery __________/ /
122473 /* Finially, delete what is left of the subquery and return
122494 ** the WHERE clause of subquery. Example:
122511 ** The added HAVING clause is pointless if the subquery lacks
122529 ** terms are duplicated into the subquery.
122533 Select *pSubq, /* The subquery whose WHERE clause is to be augmented */
122535 int iCursor /* Cursor number of the subquery */
122694 ** These are rewritten as a subquery:
122942 pCte->zCteErr = "recursive reference in a subquery: %s";
123032 ** an entry of the FROM clause is a subquery instead of a table or view,
123033 ** then create a transient table structure to describe the subquery.
123289 ** subquery in the parser tree.
123298 ** subquery in the parser tree.
123348 ** For each FROM-clause subquery, add Column.zType and Column.zColl
123350 ** of that subquery.
123677 struct SrcList_item *pThis /* Search for prior reference to this subquery */
123710 ** * The subquery is a UNION ALL of two or more terms
123729 if( pSub==0 ) return 0; /* The FROM is a subquery */
123891 /* Do not try to flatten an aggregate subquery.
123893 ** Flattening an aggregate subquery is only possible if the outer query
123894 ** is not a join. But if the outer query is not a join, then the subquery
123903 ** and if the subquery contains an ORDER BY clause and if
123929 /* This subquery can be absorbed into its parent. */
123993 /* Sometimes the code for a subquery will be generated more than
123994 ** once, if the subquery is part of the WHERE clause in a LEFT JOIN,
124003 ** encodes a correlated subquery. */
124020 ** inside the subquery. This can help the subquery to run more efficiently.
124036 /* Generate code to implement the subquery
124038 ** The subquery is implemented as a co-routine if the subquery is
124069 ** the content of this subquery. pItem->addrFillSub will point
124083 /* If the subquery is not correlated and if we are not inside of
124084 ** a trigger, then we only need to compute the value of the subquery
128777 ** subquery on one operand of an OR operator in the WHERE clause.
128782 LogEst rRun; /* Cost of running this subquery */
128783 LogEst nOut; /* Number of outputs for this subquery */
128787 ** correspond to the subquery(s) of OR-clause processing. Only the
129324 sqlite3XPrintf(&str, " SUBQUERY %d", pItem->iSelectId);
130397 /* Special case of a FROM clause subquery implemented as a co-routine */
135757 && !pSrc->fg.isCorrelated /* Not a correlated subquery */