/ Check-in [f562d542]
Login

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

Overview
Comment:Fix the "alias.*" bug found by Bernie Cosell and reported on the newsgroup. (CVS 593)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f562d542304c0c1b18b0cee78b1ecc353327a02e
User & Date: drh 2002-05-27 03:25:52
Context
2002-05-27
12:24
A SELECT statement inside the body of a TRIGGER uses the SRT_Discard target to discard the query results. Such selects are intended to be used to call user-defined functions for their side-effects. They do not return results. (CVS 594) check-in: f8041f3d user: drh tags: trunk
03:25
Fix the "alias.*" bug found by Bernie Cosell and reported on the newsgroup. (CVS 593) check-in: f562d542 user: drh tags: trunk
01:04
Bug fixes and additional test cases for the distinct-NULL patch. (CVS 592) check-in: 0e268d0c 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.86 2002/05/26 20:54:34 drh Exp $
           15  +** $Id: select.c,v 1.87 2002/05/27 03:25:52 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   */
................................................................................
   672    672           }
   673    673           for(i=0; i<pTabList->nSrc; i++){
   674    674             Table *pTab = pTabList->a[i].pTab;
   675    675             char *zTabName = pTabList->a[i].zAlias;
   676    676             if( zTabName==0 || zTabName[0]==0 ){ 
   677    677               zTabName = pTab->zName;
   678    678             }
   679         -          if( pName && (zTabName==0 || zTabName[0]==0 ||
   680         -                sqliteStrNICmp(pName->z, zTabName, pName->n)!=0) ){
          679  +          if( pName && (zTabName==0 || zTabName[0]==0 || 
          680  +                 sqliteStrNICmp(pName->z, zTabName, pName->n)!=0 ||
          681  +                 zTabName[pName->n]!=0) ){
   681    682               continue;
   682    683             }
   683    684             tableSeen = 1;
   684    685             for(j=0; j<pTab->nCol; j++){
   685    686               Expr *pExpr, *pLeft, *pRight;
   686    687               char *zName = pTab->aCol[j].zName;
   687    688   

Changes to test/select1.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the SELECT statement.
    13     13   #
    14         -# $Id: select1.test,v 1.27 2002/05/27 01:04:51 drh Exp $
           14  +# $Id: select1.test,v 1.28 2002/05/27 03:25:52 drh Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Try to select on a non-existant table.
    20     20   #
    21     21   do_test select1-1.1 {
................................................................................
   623    623     }
   624    624   } {t3.a 1 t3.b 2 tx.max(a) 3 tx.max(b) 4}
   625    625   do_test select1-11.15 {
   626    626     execsql2 {
   627    627       SELECT y.*, t3.* FROM t3, (SELECT max(a), max(b) FROM t4) AS y
   628    628     }
   629    629   } {y.max(a) 3 y.max(b) 4 t3.a 1 t3.b 2}
          630  +do_test select1-11.16 {
          631  +  execsql2 {
          632  +    SELECT y.* FROM t3 as y, t4 as z
          633  +  }
          634  +} {y.a 1 y.b 2}
   630    635   
   631    636   # Tests of SELECT statements without a FROM clause.
   632    637   #
   633    638   do_test select1-12.1 {
   634    639     execsql2 {
   635    640       SELECT 1+2+3
   636    641     }