/ Check-in [a3a360b3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bug fix: allow ROWID as a column in SELECT statements where the FROM clause includes views which are flattened. (CVS 431)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a3a360b308e45eaaf19efda80e30f2d420799cf2
User & Date: drh 2002-03-14 14:33:31
Context
2002-03-18
13:03
Fix an uninitialized variable in AggReset() (CVS 432) check-in: 3dcdeae7 user: drh tags: trunk
2002-03-14
14:33
Bug fix: allow ROWID as a column in SELECT statements where the FROM clause includes views which are flattened. (CVS 431) check-in: a3a360b3 user: drh tags: trunk
2002-03-13
19:00
Version 2.4.1 (CVS 442) check-in: 9f12b880 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.75 2002/03/07 02:02:51 drh Exp $
           15  +** $Id: select.c,v 1.76 2002/03/14 14:33:31 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Allocate a new Select structure and return a pointer to that
    21     21   ** structure.
    22     22   */
................................................................................
   778    778       }
   779    779     }
   780    780   }
   781    781   
   782    782   /*
   783    783   ** Scan through the expression pExpr.  Replace every reference to
   784    784   ** a column in table number iTable with a copy of the corresponding
   785         -** entry in pEList.  When make a copy of pEList, change references
   786         -** to columns in table iSub into references to table iTable.
          785  +** entry in pEList.  (But leave references to the ROWID column 
          786  +** unchanged.)  When making a copy of an expression in pEList, change
          787  +** references to columns in table iSub into references to table iTable.
   787    788   **
   788    789   ** This routine is part of the flattening procedure.  A subquery
   789    790   ** whose result set is defined by pEList appears as entry in the
   790    791   ** FROM clause of a SELECT such that the VDBE cursor assigned to that
   791    792   ** FORM clause entry is iTable.  This routine make the necessary 
   792    793   ** changes to pExpr so that it refers directly to the source table
   793    794   ** of the subquery rather the result set of the subquery.
   794    795   */
   795    796   static void substExpr(Expr *pExpr, int iTable, ExprList *pEList, int iSub){
   796    797     if( pExpr==0 ) return;
   797         -  if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){
          798  +  if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable && pExpr->iColumn>=0 ){
   798    799       Expr *pNew;
   799         -    assert( pEList!=0 && pExpr->iColumn>=0 && pExpr->iColumn<pEList->nExpr );
          800  +    assert( pEList!=0 && pExpr->iColumn<pEList->nExpr );
   800    801       assert( pExpr->pLeft==0 && pExpr->pRight==0 && pExpr->pList==0 );
   801    802       pNew = pEList->a[pExpr->iColumn].pExpr;
   802    803       assert( pNew!=0 );
   803    804       pExpr->op = pNew->op;
   804    805       pExpr->pLeft = sqliteExprDup(pNew->pLeft);
   805    806       pExpr->pRight = sqliteExprDup(pNew->pRight);
   806    807       pExpr->pList = sqliteExprListDup(pNew->pList);

Changes to www/changes.tcl.

    14     14   
    15     15   proc chng {date desc} {
    16     16     puts "<DT><B>$date</B></DT>"
    17     17     puts "<DD><P><UL>$desc</UL></P></DD>"
    18     18   }
    19     19   
    20     20   chng {2002 Mar 13 (2.4.1)} {
    21         -<li>Using an unnamed subquery in a FROM clause would cause a segfault.</p>
    22         -<li>The parser insist on seeing a semicolon or the end of input before
           21  +<li>Using an unnamed subquery in a FROM clause would cause a segfault.</li>
           22  +<li>The parser now insists on seeing a semicolon or the end of input before
    23     23       executing a statement.  This avoids an accidental disaster if the
    24     24       WHERE keyword is misspelled in an UPDATE or DELETE statement.</li>
    25     25   }
    26     26   
    27     27   
    28     28   chng {2002 Mar 10 (2.4.0)} {
    29     29   <li>Change the name of the sanity_check PRAGMA to <b>integrity_check</b>